-
Notifications
You must be signed in to change notification settings - Fork 602
Description
Description
When code has many ANON subs it becomes nightmare to debug that code. Code traces becomes not so useful.
There are many workarounds exists for the issue:
https://www.perlmonks.org/?node_id=304883
https://www.masteringperl.org/2014/02/naming-anonymous-subroutines/
https://metacpan.org/pod/Sub::Util#set_subname
Steps to Reproduce
sub{ die "Here" }->();
This will show something like "died at main::ANON line 1".
Expected behavior
I am not sure what is the technical issue to not have this elegant solution:
sub name{ die "Here" }->();
OR:
my $x = sub name{ die "Here" }; $x->();
Which will show "name" instead of "__ ANON__" for dumped stack frames.
The difference with the regular subroutines will be that it will not be available through STASH and only affects names in frames returned by the call to caller.
at the moment both variants are "syntax error".