Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Anonymous Hash in Constructor

by tobyink (Abbot)
on Oct 19, 2012 at 23:09 UTC ( #1000067=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Anonymous Hash in Constructor
in thread Anonymous Hash in Constructor

Then this will blow your mind...

sub x { print {+shift} "this is a method happening\n" } bless \*STDOUT, main::; (\*STDOUT)->x;
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^5: Anonymous Hash in Constructor
Download Code
Re^6: Anonymous Hash in Constructor
by Jim (Curate) on Oct 19, 2012 at 23:42 UTC

    Then will this blow yours?

    sub new { print {+shift} "This is a method happening.\n" } bless \*STDOUT; (\*STDOUT)->new;

    Probably not.

    (I'd have to have this explained to me to understand it.)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2015-07-04 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls