develooper Front page | perl.perl5.porters | Postings from May 2004

Re: my $x->{foo} doesn't work

Thread Previous | Thread Next
From:
Shinya Hayakawa
Date:
May 21, 2004 03:35
Subject:
Re: my $x->{foo} doesn't work
Message ID:
200405211909.32725.hayakawa@livedoor.jp
Hi,

On Friday 21 May 2004 6:29 pm, Dave Mitchell wrote:
> The patch incorrectly removes introduction:
>
>     for (1..4) {
> 	(my $x)->{foo} = 1;
> 	print "$_: already exists!!\n" if exists $x->{bar};
> 	$x->{bar} = 1;
>     }
>
> with the patch outputs:
>
>     2: already exists!!
>     3: already exists!!
>     4: already exists!!

Thanks.
I rewrote the patch as follows.

--- pp_hot.c.orig       2004-05-21 10:49:37.000000000 +0900
+++ pp_hot.c    2004-05-21 18:43:46.000000000 +0900
@@ -204,7 +204,7 @@
     if (PL_op->op_flags & OPf_MOD) {
        if (PL_op->op_private & OPpLVAL_INTRO)
            SAVECLEARSV(PAD_SVl(PL_op->op_targ));
-        else if (PL_op->op_private & OPpDEREF) {
+        if (PL_op->op_private & OPpDEREF) {
            PUTBACK;
            vivify_ref(PAD_SVl(PL_op->op_targ), PL_op->op_private & OPpDEREF);
            SPAGAIN;



-- 
Shinya Hayakawa
hayakawa@livedoor.jp

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About