line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Wrap; |
2
|
|
|
|
|
|
|
require Exporter; |
3
|
1
|
|
|
1
|
|
37101
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw(wrap); |
7
|
|
|
|
|
|
|
our @ISA= qw(Exporter); |
8
|
|
|
|
|
|
|
our $VERSION = "1.0"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub wrap (&$) { |
11
|
1
|
|
|
1
|
0
|
407
|
my ($subref, $class) = @_; |
12
|
1
|
|
|
1
|
|
5
|
no strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
37
|
|
13
|
1
|
|
|
1
|
|
5
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
257
|
|
14
|
1
|
|
|
|
|
2
|
for my $c (keys %{"${class}::"}) { |
|
1
|
|
|
|
|
5
|
|
15
|
3
|
|
|
|
|
4
|
*{"hidden::".$class."::$c"} = *{$class."::$c"}{CODE}; |
|
3
|
|
|
|
|
44
|
|
|
3
|
|
|
|
|
7
|
|
16
|
3
|
|
|
|
|
11
|
*{$class."::$c"} = sub { |
17
|
2
|
|
|
2
|
|
244
|
my $continue = 1; |
18
|
2
|
50
|
66
|
|
|
18
|
$continue = $subref->($c,@_) |
19
|
|
|
|
|
|
|
unless $c eq "AUTOLOAD" and $AUTOLOAD =~ /DESTROY$/; |
20
|
2
|
100
|
|
|
|
1502
|
${"${class}::AUTOLOAD"} = $AUTOLOAD if $c eq "AUTOLOAD"; |
|
1
|
|
|
|
|
5
|
|
21
|
2
|
100
|
|
|
|
114
|
goto &{"hidden::${class}::$c"} if $continue; |
|
1
|
|
|
|
|
8
|
|
22
|
3
|
|
|
|
|
13
|
}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |