Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Invoke a method on an object

by pobocks (Chaplain)
on Jan 13, 2009 at 15:32 UTC ( [id://735968]=note: print w/replies, xml ) Need Help??


in reply to Re: Invoke a method on an object
in thread Invoke a method on an object

Since I believe he is talking about $method being a string, wouldn't the first version need no strict 'refs', and a leading ampersand?

for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";

Replies are listed 'Best First'.
Re^3: Invoke a method on an object
by Corion (Patriarch) on Jan 13, 2009 at 15:36 UTC

    No:

    perl -Mstrict -le "sub P::p{print 'p'};my $p=bless {},'P';my $m='p';$p +->$m;"

      I acknowledge that this works, and runs under "use strict"; but how is $m not a symbolic reference? I'm a little confused here.

      for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
        Yes. It is a symbolic reference (a name instead of a "real" reference).

        Yes. It still works even under "use strict 'refs'".

        That's the way it works, and always has.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-26 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found