List Info

Thread: Re: AUTOLOAD :lvalue not working the same in blead as in 5.8.8




Re: AUTOLOAD :lvalue not working the same in blead as in 5.8.8
user name
2007-02-26 05:09:41
On Sun, Feb 25, 2007 at 05:32:07PM -0500, Rick Delaney
wrote:
> On Feb 25 2007, Nicholas Clark wrote:
> > 
> > Curiously, OPpMAYBE_LVSUB is only used in this
part of Perl_peep()
> 
> See also LVRET.

Thanks for the explanation of why.

> #define OPpDONT_INIT_GV 32 ?

I was wondering about 4. I tried 32, and didn't get past
dynaloader. Whilst
16 seems to work (no tests fail) comments in op.h and the
code of op.c suggests
that that flag value is already possible for OP_RV2GV. So I
used 4.

Nicholas Clark

Change 30407 by nicholasnicholas-saigo on
2007/02/26 11:07:06

	Fix bug #41550 -  AUTOLOAD :lvalue not working the same in
blead as in
	5.8.8 (a code example from "Extending and Embedding
Perl"

Affected files ...

... //depot/perl/op.h#166 edit
... //depot/perl/t/op/sub_lval.t#11 edit

Differences ...

==== //depot/perl/op.h#166 (text) ====

 -203,14
+203,14 
 #define OPpLVAL_DEFER		16	/* Defer creation of array/hash
elem */
   /* OP_RV2?V, OP_GVSV, OP_ENTERITER only */
 #define OPpOUR_INTRO		16	/* Variable was in an our() */
-  /* OP_RV2[AH]V, OP_PAD[AH]V, OP_[AH]ELEM */
+  /* OP_RV2[AGH]V, OP_PAD[AH]V, OP_[AH]ELEM */
 #define OPpMAYBE_LVSUB		8	/* We might be an lvalue to
return */
   /* OP_PADSV only */
 #define OPpPAD_STATE		16	/* is a "state" pad */
   /* for OP_RV2?V, lower bits carry hints (currently only
HINT_STRICT_REFS) */
 
   /* OP_RV2GV only */
-#define OPpDONT_INIT_GV		8	/* Call gv_fetchpv with
GV_NOINIT */
+#define OPpDONT_INIT_GV		4	/* Call gv_fetchpv with
GV_NOINIT */
 /* (Therefore will return whatever is currently in the
symbol table, not
    guaranteed to be a PVGV)  */
 

==== //depot/perl/t/op/sub_lval.t#11 (xtext) ====

 -3,7
+3,7 
     INC = '../lib';
     require './test.pl';
 }
-plan tests=>68;
+plan tests=>69;
 
 sub a : lvalue { my $a = 34; ${(bless $a)} }  # Return a
temporary
 sub b : lvalue { $ }
 -539,3
+539,14 
 
     is($line, "zeroonetwothree");
 }
+
+{
+    package Foo;
+    sub AUTOLOAD :lvalue { *{$AUTOLOAD} };
+    package main;
+    my $foo = bless {},"Foo";
+    my $result;
+    $foo->bar = sub { $result = "bar" };
+    $foo->bar;
+    is ($result, 'bar', "RT #41550");
+}

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )