Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: how to get alias name of anonymous sub?

by PeterPeiGuo (Hermit)
on Nov 29, 2010 at 03:32 UTC ( [id://874171] : note . print w/replies, xml ) Need Help??


in reply to how to get alias name of anonymous sub?

Observe the result from print Dumper(caller(0));

Peter (Guo) Pei

Replies are listed 'Best First'.
Re^2: how to get alias name of anonymous sub?
by gian (Novice) on Nov 29, 2010 at 03:39 UTC
    this is output with Dumper.
    $VAR1 = 'main'; $VAR2 = 'D:\\test.pl'; $VAR3 = 12; $VAR4 = 'main::__ANON__'; $VAR5 = 1; $VAR6 = undef; $VAR7 = undef; $VAR8 = undef; $VAR9 = 0; $VAR10 = ' '; $VAR1 = 'main'; $VAR2 = 'D:\\test.pl'; $VAR3 = 13; $VAR4 = 'main::__ANON__'; $VAR5 = 1; $VAR6 = undef; $VAR7 = undef; $VAR8 = undef; $VAR9 = 0; $VAR10 = ' ';
    it seem not useful.caller only return these values
    # 0 1 2 3 4 ($package, $filename, $line, $subroutine, $hasargs, # 5 6 7 8 9 10 $wantarray, $evaltext, $is_require, $hints, $bitmask, $hinthash) += caller($i);
    maybe we should try another way.