From: Nicholas Clark Date: Mon, 26 Feb 2007 11:07:06 +0000 (+0000) Subject: Fix bug #41550 - AUTOLOAD :lvalue not working the same in blead as in X-Git-Tag: perl-5.9.5~933 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/cb0d96b9c873979acbc861b2863a39dda41d3ace Fix bug #41550 - AUTOLOAD :lvalue not working the same in blead as in 5.8.8 (a code example from "Extending and Embedding Perl") p4raw-id: //depot/perl@30407 --- diff --git a/op.h b/op.h index 746e635..1505932 100644 --- a/op.h +++ b/op.h @@ -203,14 +203,14 @@ Deprecated. Use C instead. #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) */ diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index 2e4db52..a159bac 100755 --- a/t/op/sub_lval.t +++ b/t/op/sub_lval.t @@ -3,7 +3,7 @@ BEGIN { @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 { ${\shift} } @@ -539,3 +539,14 @@ TODO: { 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"); +}