Hey there, Perl6'ers!
Can anyone tell me if this is seriously slow? If so, is there a better way to write it?
method CALLING-METHOD($nf is copy = 3) {
my $c = callframe($nf).code;
while $c !~~ Routine {
my $cf = callframe(++$nf);
die 'Exceeded backtrace when searching for calling routine'
if $cf ~~ Failure;
$c = $cf.code;
next if $c.^name eq 'Block';
# Special casing is hell!
if
$c.package.^name eq 'GLOBAL' ||
'is-hidden-from-backtrace' ∈ $c.^roles.map( *.^name )
{
$c = False;
next;
}
}
"{ $c.package.^name }.{ $c.name }";
}
OK, so I ended up with this:
It seems to work well enough, but I do dislike the special casing required to get it working.