develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [DOCPATCH] BEGIN, CHECK, INIT, END explained more

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
November 30, 2003 21:53
Subject:
Re: [DOCPATCH] BEGIN, CHECK, INIT, END explained more
Message ID:
20031201055237.GB3888@efn.org
On Sun, Nov 30, 2003 at 10:13:40PM +0200, Enache Adrian <enache@rdslink.ro> wrote:
> On Sun, Nov 30, 2003 a.d., Tels wrote:
> > Why is CLONE special, but FOO not? That doesn't follow from Liz' example:
> > 
> > te@null:~/perl/math/Math-BigInt-1.67> perl -MO=Deparse -e 'FOO { foo => 
> > "bar" }'
> > do {
> >     'foo', 'bar'
> > }->FOO;
> > - -e syntax OK
> 
> Deparse is wrong :-)
> 
> $ perl -e 'foo { bar => "baz" }'
> Can't locate object method "foo" via package "bar" (perhaps you forgot to load "bar"?) at -e line 1.
> $ perl -MO=Deparse -e 'foo { bar => "baz" }' | perl
> -e syntax OK
> Can't locate object method "foo" via package "baz" (perhaps you forgot to load "baz"?) at - line 1.
> 
> Or maybe Perl itself is wrong ?

No, you are feeding it indirect object syntax ("method object") where
object is a BLOCK.  Deparse is just showing it as the equivalent ->
method call.

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