Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652413]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-10-21 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (270 votes). Check out past polls.

    Notices?