line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
######################################################################## |
2
|
|
|
|
|
|
|
# housekeeping |
3
|
|
|
|
|
|
|
######################################################################## |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Object::Wrapper; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
18565
|
use 5.8.0; |
|
11
|
|
|
|
|
35
|
|
|
11
|
|
|
|
|
591
|
|
8
|
11
|
|
|
11
|
|
56
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
305
|
|
9
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
|
53
|
use Carp; |
|
11
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
903
|
|
11
|
|
|
|
|
|
|
|
12
|
11
|
|
|
11
|
|
55
|
use Scalar::Util qw( blessed refaddr reftype ); |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
6175
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
######################################################################## |
15
|
|
|
|
|
|
|
# package variables |
16
|
|
|
|
|
|
|
######################################################################## |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = 0.01; |
19
|
|
|
|
|
|
|
our $AUTOLOAD = ''; |
20
|
|
|
|
|
|
|
my %cleanupz = (); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
######################################################################## |
23
|
|
|
|
|
|
|
# utility subs |
24
|
|
|
|
|
|
|
######################################################################## |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
AUTOLOAD |
27
|
|
|
|
|
|
|
{ |
28
|
3
|
|
|
3
|
|
664
|
my $franger = shift; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
11
|
my $i = rindex $AUTOLOAD, '::'; |
31
|
3
|
|
|
|
|
10
|
my $name = substr $AUTOLOAD, 2 + $i; |
32
|
|
|
|
|
|
|
|
33
|
3
|
50
|
|
|
|
43
|
my $sub = $franger->[0]->can( $name ) |
34
|
|
|
|
|
|
|
or confess "Bogus $AUTOLOAD: '$franger->[0]' cannot '$name'"; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
20
|
$franger->[0]->$sub( @_ ) |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
DESTROY |
40
|
|
|
|
|
|
|
{ |
41
|
8
|
|
|
8
|
|
688320
|
my $franger = shift; |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
33
|
|
|
361
|
my $class = blessed $franger || $franger; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# $cleanupz{ $class } may be a method name or coderef. |
46
|
|
|
|
|
|
|
|
47
|
8
|
50
|
33
|
|
|
556
|
my $cleanup = $cleanupz{ $class } || $franger->can( 'cleanup' ) |
48
|
|
|
|
|
|
|
or confess "Bogus franger: no cleanup for '$franger' or '$class'"; |
49
|
|
|
|
|
|
|
|
50
|
8
|
50
|
|
|
|
183
|
my $sub |
|
|
50
|
|
|
|
|
|
51
|
|
|
|
|
|
|
= ref $cleanup |
52
|
|
|
|
|
|
|
? $cleanup |
53
|
|
|
|
|
|
|
: $franger->can( $cleanup ) |
54
|
|
|
|
|
|
|
or confess "Bogus $class: no cleanup for '$franger' ($class)"; |
55
|
|
|
|
|
|
|
|
56
|
8
|
50
|
|
|
|
338
|
'CODE' eq reftype $sub |
57
|
|
|
|
|
|
|
or confess "Bogus $class: not a coderef '$sub'"; |
58
|
|
|
|
|
|
|
|
59
|
8
|
|
|
|
|
145
|
$cleanup->( @$franger ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return |
62
|
8
|
|
|
|
|
2424
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
######################################################################## |
65
|
|
|
|
|
|
|
# public interface |
66
|
|
|
|
|
|
|
######################################################################## |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub new |
69
|
|
|
|
|
|
|
{ |
70
|
8
|
|
|
8
|
1
|
2038
|
my $proto = shift; |
71
|
8
|
|
33
|
|
|
90
|
my $class = blessed $proto || $proto; |
72
|
|
|
|
|
|
|
|
73
|
8
|
50
|
|
|
|
77
|
my $object = shift |
74
|
|
|
|
|
|
|
or croak "Bogus franger: missing object"; |
75
|
|
|
|
|
|
|
|
76
|
8
|
|
|
|
|
46
|
bless [ $object, @_ ], $class |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub cleanup_handler :lvalue |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
0
|
1
|
0
|
my $proto = shift; |
82
|
0
|
|
0
|
|
|
0
|
my $class = blessed $proto || $proto; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
@_ |
85
|
0
|
0
|
|
|
|
0
|
and $cleanupz{ $class } = shift; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
my $tmp = \$cleanupz{ $class }; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
0
|
$$tmp |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# stub cleanup for cases where the AUTOLOAD validation |
93
|
|
|
|
|
|
|
# is sufficient by itself. |
94
|
|
|
|
|
|
|
|
95
|
5
|
|
|
5
|
1
|
27
|
sub cleanup {} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# keep require happy |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |