Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Bug or inconsitency? FQN of Package and sub name identical

by ysth (Canon)
on Nov 22, 2007 at 16:32 UTC ( #652413=note: print w/ replies, xml ) Need Help??


in reply to Re: Bug or inconsitency? FQN of Package and sub name identical
in thread Bug or inconsitency? FQN of Package and sub name identical

Yes, Foo-> compiles to (&Foo())-> if a sub Foo already exists; otherwise it's ("Foo")->:

$ perl -wl sub Foo::new{"new in Foo"} sub Bar::new{"new in Bar"} print "before sub Foo: ", Foo->new; sub Foo {"Bar"} print "after sub Foo: ", Foo->new __END__ before sub Foo: new in Foo after sub Foo: new in Bar
You can disambiguate by saying Foo::->new or "Foo"->new. I prefer the former.


Comment on Re^2: Bug or inconsitency? FQN of Package and sub name identical
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-09-01 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (13 votes), past polls