Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://649893]
help
Chatterbox?
NodeReaper buffs his metatarsals

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2018-06-23 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?