line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::Lazy::Ref; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
5686
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings;
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
70
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.12';
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
8
|
use Carp qw(croak);
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
202
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %register;
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN {
|
13
|
2
|
|
|
2
|
|
11
|
my $old_core_global_ref = *CORE::GLOBAL::ref;
|
14
|
|
|
|
|
|
|
*CORE::GLOBAL::ref = sub ($) {
|
15
|
6
|
|
|
6
|
|
10106
|
my $ref = shift;
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
return
|
18
|
|
|
|
|
|
|
exists $register{$ref}
|
19
|
|
|
|
|
|
|
? $register{$ref}
|
20
|
6
|
100
|
|
|
|
30
|
: do {
|
21
|
5
|
|
|
|
|
13
|
local *CORE::GLOBAL::ref = $old_core_global_ref;
|
22
|
5
|
|
|
|
|
25
|
ref $ref;
|
23
|
|
|
|
|
|
|
};
|
24
|
|
|
|
|
|
|
}
|
25
|
2
|
|
|
|
|
98
|
}
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub register {
|
28
|
1
|
|
|
1
|
1
|
2
|
my $object = shift;
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
19
|
$register{$object} = $object->{ref};
|
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
2
|
return;
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# $Id$
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1;
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__
|