In Perl, once you say $a->{$b}->{$c}, $a->{$b} will "spring into
existence". From perlref:
The left side of the arrow can be any expression returning a
reference, including a
previous dereference. Note that $array[$x] is not the same thing
as "$array->[$x]"
here:
$array[$x]->{"foo"}->[0] = "January";
This is one of the cases we mentioned earlier in which references
could spring into
existence when in an lvalue context. Before this statement,
$array[$x] may have been
undefined. If so, it's automatically defined with a hash
reference so that we can look
up "{"foo"}" in it. Likewise "$array[$x]->{"foo"}" will
automatically get defined with
an array reference so that we can look up "[0]" in it. This
process is called
autovivification.
On Sun, Sep 11, 2011 at 4:24 PM, Chanan Berler <[email protected]> wrote:
> Hello All,
>
> # check if result key GetUmsPlayerData found
> if (
> exists($result->{'response'}->{'Player'}->{'GetUmsPlayerData'}->{'player_data'})
> )
> {
> #
> $result->{'response'}->{'Player'}->{'GetUmsPlayerData'}->{'player_data'}
> = $self->_player_data_by_key_to_name_($result->{'response'}->{'Player'});
> }
>
> Funny after adding this condition (see no action is done - comments)
> and printing using Data::Dumper i found this:
>
> Sep 11 13:18:17 dev-host-03.playtechtv.tv: [pid:26150] [debug]
> [mixtv::payment::PlaytechUMS_base::_PARSE_RESPONSE_] response returned
> with error (0). system-error-code was set to 100.
> Sep 11 13:18:17 dev-host-03.playtechtv.tv: [pid:26150] [debug]
> [mixtv::payment::PlaytechUMS_base::_simple_trace_] =========>
> params=$VAR1 = { 'req_ref' => '7864384', 'req_name' => 'LOGIN', 'data'
> => { 'Player' => { 'errorText' => '', 'errorCode' => '0',
> 'GetUmsPlayerData' => {}, 'Login' => { 'sessionToken' =>
> '1DC46A42BAFD44A4714F6C33FBBA84CE', 'sessionValidationData' => undef,
> 'errorText' => '', 'errorCode' => '0', 'playerCode' => '2752191',
> 'phone' => undef, 'username' => 'MBTEST10' } } }, 'type' => 'RESPONSE'
> };
>
> Notice GetUmsPlayerData was added to my Hash ?? is this a memory
> problem with exists ? checking same thing using defined i found same
> problem :-(
>
> -Chanan
>
>
> --
> ===================
> ---- Chanan Berler ----
> ===================
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
--
Gaal Yahas <[email protected]>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl