line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Discovery; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1336
|
use 5.005; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
73
|
|
4
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
58
|
|
5
|
1
|
|
|
1
|
|
9
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
153
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '1.11'; |
8
|
|
|
|
|
|
|
@ISA = 'Tie::StdHash'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
133
|
|
11
|
1
|
|
|
1
|
|
1929
|
use Tie::Hash; |
|
1
|
|
|
|
|
1870
|
|
|
1
|
|
|
|
|
55
|
|
12
|
1
|
|
|
1
|
|
10
|
use constant SELF => 0; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
127
|
|
13
|
1
|
|
|
1
|
|
10
|
use constant KEY => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
14
|
1
|
|
|
1
|
|
8
|
use constant VALUE => 2; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
726
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub TIEHASH { |
17
|
1
|
|
|
1
|
|
62
|
return bless { debug => 0 }, shift; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub STORE { |
21
|
0
|
|
|
0
|
|
0
|
carp "Please don't do this. Use \$obj->store or \$obj->register instead."; |
22
|
0
|
|
|
|
|
0
|
store(@_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub store { # ($$$) |
26
|
2
|
|
|
2
|
1
|
27
|
$_[SELF]{ $_[KEY] } = $_[VALUE]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub register { # ($$\&) |
30
|
7
|
100
|
|
7
|
1
|
370
|
UNIVERSAL::isa($_[VALUE] => 'CODE') |
31
|
|
|
|
|
|
|
or croak "Second argument to register() should be coderef"; |
32
|
6
|
|
|
|
|
20
|
$_[SELF]{ $_[KEY] } = $_[VALUE]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub FETCH { |
36
|
11
|
|
|
11
|
|
67
|
my $value = $_[SELF]{ $_[KEY] }; |
37
|
11
|
|
|
|
|
35
|
while (UNIVERSAL::isa($value, 'CODE')) { |
38
|
8
|
50
|
|
|
|
21
|
print STDERR "(Discovering $_[KEY]... " if $_[SELF]{debug} > 0; |
39
|
8
|
|
|
|
|
21
|
$value = $_[SELF]{ $_[KEY] } = $value->(@_); |
40
|
8
|
50
|
|
|
|
64
|
print STDERR ")" if $_[SELF]->{debug} > 0; |
41
|
|
|
|
|
|
|
} |
42
|
11
|
|
|
|
|
33
|
return $value; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |