Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 contemplating the Monastery: (6)
As of 2014-12-20 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls