In Perl 6, how can I get name of the function/subroutine from within its body, at runtime?
For example,
sub foo {
say "My name is: " ~ <WHAT-API-HERE??> ;
}
...
foo();
The above code should print:
My name is: foo
I've looked in places like MOP, FAQ, and Functions.
sub foo { say &?ROUTINE.name }
foo
displays:
foo
See the &$ROUTINE
doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With