line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Class::Delegation::Simple; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
26227
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
105
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import |
12
|
|
|
|
|
|
|
{ |
13
|
2
|
|
|
2
|
|
16
|
my ($class, @args) = @_; |
14
|
2
|
|
|
|
|
7
|
my ($caller) = caller; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Install the handler(s): |
17
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
18
|
1
|
|
|
1
|
|
5
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
192
|
|
19
|
2
|
|
|
|
|
12
|
while( my $set = shift(@args) ) |
20
|
|
|
|
|
|
|
{ |
21
|
2
|
|
|
|
|
5
|
my $to = $set->{to}; |
22
|
2
|
|
|
|
|
2
|
my $method = $set->{send}; |
23
|
2
|
|
66
|
|
|
10
|
my $as = $set->{as} || $method; |
24
|
2
|
|
|
|
|
299
|
*{"$caller\::$method"} = sub { |
25
|
1004
|
|
|
1004
|
|
318942
|
my $s = shift; |
26
|
1004
|
100
|
|
|
|
2246
|
if( ref($to) ) |
27
|
|
|
|
|
|
|
{ |
28
|
2
|
|
|
|
|
5
|
my @res; |
29
|
2
|
|
|
|
|
18
|
push @res, $s->{$_}->$as( @_ ) foreach @$to; |
30
|
2
|
50
|
|
|
|
59
|
return @res if defined(wantarray); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else |
33
|
|
|
|
|
|
|
{ |
34
|
1002
|
|
|
|
|
6136
|
$s->{$to}->$as( @_ ); |
35
|
|
|
|
|
|
|
}# end if() |
36
|
2
|
|
|
|
|
8
|
}; |
37
|
|
|
|
|
|
|
}# end while() |
38
|
|
|
|
|
|
|
}# end import() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1;# return true: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |