Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 romping around the Monastery: (8)
As of 2015-07-04 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls