Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 lurking in the Monastery: (10)
As of 2014-09-21 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (173 votes), past polls