diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-08 19:48:11 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-08 19:48:11 +0000 |
commit | 377b21bb1127ac5ca00091f9cc395d44f5adff24 (patch) | |
tree | 98997496e8cc4f7a591430e8cc8abf03d913c075 | |
parent | 5276f2afd97082686f7aed04c4d725334991a21d (diff) | |
download | perl-377b21bb1127ac5ca00091f9cc395d44f5adff24.tar.gz |
allow AV/HV dereferences on pseudohashes ($ph->{foo}[1], etc.)
p4raw-id: //depot/perl@3335
-rw-r--r-- | op.c | 2 | ||||
-rwxr-xr-x | t/lib/fields.t | 16 |
2 files changed, 16 insertions, 2 deletions
@@ -5588,7 +5588,7 @@ peep(register OP *o) char *key; STRLEN keylen; - if (o->op_private & (OPpDEREF_HV|OPpDEREF_AV|OPpLVAL_INTRO) + if ((o->op_private & (OPpLVAL_INTRO)) || ((BINOP*)o)->op_last->op_type != OP_CONST) break; rop = (UNOP*)((BINOP*)o)->op_first; diff --git a/t/lib/fields.t b/t/lib/fields.t index 5aae3451cc..6f3ea5bb48 100755 --- a/t/lib/fields.t +++ b/t/lib/fields.t @@ -82,7 +82,7 @@ my %expect = ( 'Foo::Bar::Baz' => 'b1:1,b2:2,b3:3,foo:4,bar:5,baz:6', ); -print "1..", int(keys %expect)+3, "\n"; +print "1..", int(keys %expect)+5, "\n"; my $testno = 0; while (my($class, $exp) = each %expect) { no strict 'refs'; @@ -110,3 +110,17 @@ print "not " unless $@ && $@ =~ /^No such field "notthere"/; print "ok ", ++$testno, "\n"; #fields::_dump(); + +# check if +{ + package Foo; + use fields qw(foo bar); + sub new { bless [], $_[0]; } + + package main; + my Foo $a = Foo->new(); + $a->{foo} = ['a', 'ok ' . ++$testno, 'c']; + $a->{bar} = { A => 'ok ' . ++$testno }; + print $a->{foo}[1], "\n"; + print $a->{bar}->{A}, "\n"; +} |