Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: method dispatch question

by ysth (Canon)
on Jul 10, 2008 at 09:52 UTC ( [id://696659]=note: print w/replies, xml ) Need Help??


in reply to Re: method dispatch question
in thread method dispatch question

the following notations are perfectly equivalent:
Other than one being a method call and the other not. Which is exposed by Devel::Caller::called_as_method.

Replies are listed 'Best First'.
Re^3: method dispatch question
by parv (Parson) on Jul 10, 2008 at 10:07 UTC
    But does that matter when all the arguments are there (other than OO based things, like inheritance & polymorphism, not working obviously)?
      Inheritance and polymorphism wouldn't work anyway because the method to call has already been established. I think that ysth's point is that the two forms are not 100% equivalent, because there's some means to tell them apart. This seems to privilege the $object->$method() notation over the other IMHO.

      Whether this information will ever be used is something that only the particular implementation will be able to tell, but I'd inclined to think that in the vast majority of cases the two forms are interchangeable without any problem. But I'm eager to see comments contradicting this statement!

      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Io ho capito... ma tu che hai detto?
      Potentially. Search perlmonks for called_as_method and you'll see it given as the answer to requests for "how do I make my sub do something different when called as a method"?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-26 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found