Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Is this a symbolic reference?

by bdimych (Monk)
on Nov 09, 2007 at 12:57 UTC ( #649893=note: print w/replies, xml ) Need Help??

in reply to Is this a symbolic reference?

O'Reilly "Programming Perl" (with camel) => 12.3.1. Method Invocation Using the Arrow Operator:

Sometimes you want to invoke a method without knowing its name ahead of time. You can use the arrow form of method invocation and replace the method name with a simple scalar variable:

$method = "summon"; $mage = Wizard->$method("Gandalf"); # Invoke Wizard->summon $travel = $companion eq "Shadowfax" ? "ride" : "walk"; $mage->$travel("seven leagues"); # Invoke $mage->ride or $mage-> +walk
Although you're using the name of the method to invoke it indirectly, this usage is not forbidden by use strict 'refs', since all method calls are in fact looked up symbolically at the time they're resolved.

as a result the term may be "symbolic method invocation"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2018-03-24 16:10 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.