Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: how to get a subroutine name?

by hdb (Prior)
on Jun 26, 2013 at 12:54 UTC ( #1040774=note: print w/replies, xml ) Need Help??

in reply to Re^2: how to get a subroutine name?
in thread how to get a subroutine name?

However, __SUB__ returns a reference to the currently running subroutine according to perlsub. Not sure how you will get its name?

Replies are listed 'Best First'.
Re^4: how to get a subroutine name?
by tobyink (Abbot) on Jun 26, 2013 at 14:05 UTC


    Still, that's rather a roundabout way to do things.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2016-10-28 19:03 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (386 votes). Check out past polls.