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

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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2015-03-31 22:53 GMT
Find Nodes?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:

    Results (673 votes), past polls