Thread Hash im Methodenaufruf (15 answers)
Opened by bianca at 2014-04-12 10:11

Gast wer
 2014-04-12 17:38
#174721 #174721
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sub JSON::set_encoding {
  my ($self,$encoding)=@_;

  my $ok = eval {
   $self->can($encoding) or return 0;
   $self->$encoding();
   return 1;
  };

  die("UNKOWN ENCODING $encoding") unless($ok);

  return $self;
}

JSON->new->set_encoding($parameter{json_charset})->encode(\%hash);

Last edited: 2014-04-12 18:36:40 +0200 (CEST)

View full thread Hash im Methodenaufruf