Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by swampyankee (Parson)
on Nov 22, 2007 at 15:28 UTC ( #652390=note: print w/replies, xml ) Need Help??


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

Odd behavior when package and sub names are identical? My first suggestion is "don't do that." Perl is probably resolving its subs based, at least partly, on which ones it sees first, so it will use the first one it finds. I don't think this is either a bug or an inconsistency; it's a design decision. It does mean that the order subs are defined matters, which is not a concern unique to Perl: quite a few linkers do the same thing.


emc

Information about American English usage here and here.

Any Northeastern US area jobs? I'm currently unemployed.

  • Comment on Re: Bug or inconsitency? FQN of Package and sub name identical

Replies are listed 'Best First'.
Re^2: Bug or inconsitency? FQN of Package and sub name identical
by ysth (Canon) on Nov 22, 2007 at 16:32 UTC
    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://652390]
help
Chatterbox?
[1nickt]: hm, what did I do wrong? No download link in a code secrtion of a node I just posted ...
[Corion]: I see a download link there?
[Corion]: (at least the curl stuff is in a download link)
[Corion]: Also, I think the OPs problem is on their intranet and not on the internet (also, they should likely use WWW::Mechanize instead, which knows about cookie)
[1nickt]: yes, could be.
[1nickt]: I don;t see the link , definitely, after reloading the node
[1nickt]: Is it possible to disable it?
[Discipulus]: if you mean [download] after the code it is there 1nickt
[1nickt]: yes, Corion sees it too, and I see it when not logged in.
[Corion]: I think you can disable download links in your settings?

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-05-23 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?