8 Einträge, 1 Seite |
print &{$subref};
1
2
3
4
5
6
7
8
9
10
11
sub test { 1 }
my $code = \&test;
use B;
my $class = B::svref_2object($code)->STASH->NAME;
my $name = '';
for my $sym ( values %{ $class . '::' } ) {
if ( *{$sym}{CODE} && *{$sym}{CODE} == $code ) {
$name = *{$sym}{NAME};
}
}
print "Name is $name\n";
print B::svref_2object($code)->GV->NAME
print B::svref_2object($code)->GV->NAME
1
2
3
4
5
6
7
8
9
10
11
12
13
14
*test = sub { 1 };
my $code = \&test;
print "taulmarill says: " . B::svref_2object($code)->GV->NAME . "\n";
use B;
my $class = B::svref_2object($code)->STASH->NAME;
my $name = '';
for my $sym ( values %{ $class . '::' } ) {
if ( *{$sym}{CODE} && *{$sym}{CODE} == $code ) {
$name = *{$sym}{NAME};
}
}
print "sri says: $name\n";
8 Einträge, 1 Seite |