line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=for gpg |
2
|
|
|
|
|
|
|
-----BEGIN PGP SIGNED MESSAGE----- |
3
|
|
|
|
|
|
|
Hash: SHA1 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Function::ID - Variables to let functions know their names. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This documentation describes version 0.02 of Function::ID, March 29, 2003. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
505
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
16
|
|
|
|
|
|
|
package Function::ID; |
17
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
74
|
|
18
|
1
|
|
|
1
|
|
4
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
78
|
|
19
|
|
|
|
|
|
|
$VERSION = 0.02; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use vars '$this_fn', '$this_function'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
185
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub TIESCALAR |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
|
|
2
|
|
3
|
my $class = shift; |
26
|
2
|
|
|
|
|
2
|
my $name = shift; |
27
|
2
|
|
|
|
|
5
|
return bless \$name, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub STORE |
31
|
|
|
|
|
|
|
{ |
32
|
2
|
|
|
2
|
|
71
|
my $self = shift; |
33
|
2
|
|
|
|
|
265
|
croak "Attempt to assign to \$$$self"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub FETCH |
37
|
|
|
|
|
|
|
{ |
38
|
6
|
|
|
6
|
|
52
|
my $self = shift; |
39
|
6
|
|
|
|
|
15
|
my $callfunc = (caller 1)[3]; |
40
|
6
|
100
|
|
|
|
27
|
$callfunc =~ s/.*::// if $$self eq 'this_fn'; |
41
|
6
|
|
|
|
|
15
|
return $callfunc; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
tie $this_fn, __PACKAGE__, 'this_fn'; |
47
|
|
|
|
|
|
|
tie $this_function, __PACKAGE__, 'this_function'; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub import |
50
|
|
|
|
|
|
|
{ |
51
|
2
|
|
|
2
|
|
9
|
my $caller_pkg = caller; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
54
|
2
|
|
|
|
|
2
|
*{$caller_pkg."::this_fn"} = \$this_fn; |
|
2
|
|
|
|
|
7
|
|
55
|
2
|
|
|
|
|
4
|
*{$caller_pkg."::this_function"} = \$this_function; |
|
2
|
|
|
|
|
1760
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; # Modules must return true, for silly historical reasons. |
59
|
|
|
|
|
|
|
__END__ |