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

5.16 added __SUB__ for this purpose.

My bad! It returns a coderef.

Replies are listed 'Best First'.
Re^3: how to get a subroutine name?
by hdb (Monsignor) on Jun 26, 2013 at 12:54 UTC

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

      Sub::Identify?

      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