line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Nooo; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub import |
6
|
|
|
|
|
|
|
{ |
7
|
2
|
|
|
2
|
|
16
|
my $nooo = shift; |
8
|
2
|
|
|
|
|
5
|
my ($class, @stubs) = @_; |
9
|
2
|
|
|
|
|
3
|
my $obj; |
10
|
2
|
100
|
|
|
|
9
|
if (ref $class eq 'ARRAY') { |
|
|
50
|
|
|
|
|
|
11
|
1
|
|
|
|
|
2
|
my @args; |
12
|
1
|
|
|
|
|
4
|
($class, @args) = @$class; |
13
|
1
|
|
|
1
|
|
334
|
eval "use $class"; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
180
|
|
14
|
1
|
|
|
|
|
8
|
$obj = new $class @args; |
15
|
|
|
|
|
|
|
} elsif (!ref $class) { |
16
|
1
|
|
|
1
|
|
13864
|
eval "use $class"; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
64
|
|
17
|
1
|
|
|
|
|
27
|
$obj = new $class; |
18
|
|
|
|
|
|
|
} else { |
19
|
0
|
|
|
|
|
0
|
$obj = $class; |
20
|
|
|
|
|
|
|
} |
21
|
2
|
|
|
|
|
18
|
my $pack = caller; |
22
|
|
|
|
|
|
|
# my $obj = ($nooo eq 'Acme::Nooo') ? new $class @_ : $class; |
23
|
2
|
50
|
|
|
|
11
|
@stubs = keys %{"$class\::"} unless @stubs; |
|
2
|
|
|
|
|
13
|
|
24
|
2
|
|
|
|
|
7
|
for (@stubs) { |
25
|
5
|
100
|
|
|
|
1697
|
if (UNIVERSAL::can($obj, $_)) { |
26
|
4
|
|
|
|
|
6
|
my $subname = $_; |
27
|
4
|
|
|
2
|
|
16
|
*{"$pack\::$subname"} = sub { $obj->$subname(@_); }; |
|
4
|
|
|
|
|
106
|
|
|
2
|
|
|
|
|
578
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
## A bit too evil |
31
|
|
|
|
|
|
|
# eval { |
32
|
|
|
|
|
|
|
# for (keys %$obj) { |
33
|
|
|
|
|
|
|
# ${"$class\::$_"} = $obj->{$_}; |
34
|
|
|
|
|
|
|
# } |
35
|
|
|
|
|
|
|
# }; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# our %AUTO; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# sub autoload |
41
|
|
|
|
|
|
|
# { |
42
|
|
|
|
|
|
|
# $AUTOLOAD =~ s/.*:://; |
43
|
|
|
|
|
|
|
# my $pack = caller; |
44
|
|
|
|
|
|
|
# for (@{$AUTO{$pack}}) { |
45
|
|
|
|
|
|
|
# if (UNIVERSAL::can($_, $AUTOLOAD)) { |
46
|
|
|
|
|
|
|
# return $_->$AUTOLOAD(@_); |
47
|
|
|
|
|
|
|
# } |
48
|
|
|
|
|
|
|
# } |
49
|
|
|
|
|
|
|
# die "$AUTOLOAD: Nooooo can do..."; |
50
|
|
|
|
|
|
|
# } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# sub import |
53
|
|
|
|
|
|
|
# { |
54
|
|
|
|
|
|
|
# shift; |
55
|
|
|
|
|
|
|
# my $obj = shift; |
56
|
|
|
|
|
|
|
# my $pack = caller; |
57
|
|
|
|
|
|
|
# *{"$pack\::AUTOLOAD"} = \&autoload |
58
|
|
|
|
|
|
|
# unless \&{"$pack\::AUTOLOAD"} eq \&autoload; |
59
|
|
|
|
|
|
|
# push @{$AUTO{$pack}}, $obj; |
60
|
|
|
|
|
|
|
# } |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |