Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by ikegami (Pope)
on Nov 22, 2007 at 19:32 UTC ( #652436=note: print w/ replies, xml ) Need Help??


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

When barewords are involved like in

print(foo + 2);

Perl must guess at what it means. Perl usually guesses the above means

print(foo(+2));

but if foo's prototype is ($), it'll take that as a hint that you meant

print(foo() + 2);

It's the same for

Foo->method();

Perl usually guesses the above means

"Foo"->method();

but if Foo is a function, it'll take that as a hint that you meant

Foo()->method();

where Foo is presumably a function that returns a class name or an object.


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2015-07-04 13:12 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