line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id$ |
2
|
|
|
|
|
|
|
# $Source$ |
3
|
|
|
|
|
|
|
# $Author$ |
4
|
|
|
|
|
|
|
# $HeadURL$ |
5
|
|
|
|
|
|
|
# $Revision$ |
6
|
|
|
|
|
|
|
# $Date$ |
7
|
|
|
|
|
|
|
package Class::Dot::Meta::Method; |
8
|
|
|
|
|
|
|
|
9
|
16
|
|
|
16
|
|
79
|
use strict; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
3210
|
|
10
|
16
|
|
|
16
|
|
78
|
use warnings; |
|
16
|
|
|
|
|
24
|
|
|
16
|
|
|
|
|
370
|
|
11
|
16
|
|
|
16
|
|
71
|
use version; |
|
16
|
|
|
|
|
48
|
|
|
16
|
|
|
|
|
90
|
|
12
|
16
|
|
|
16
|
|
1109
|
use 5.00600; |
|
16
|
|
|
|
|
49
|
|
|
16
|
|
|
|
|
837
|
|
13
|
|
|
|
|
|
|
|
14
|
16
|
|
|
16
|
|
81
|
use Carp qw(croak); |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
4836
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = qv('2.0.0_15'); |
17
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:ASKSH'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my %EXPORT_OK = map { $_ => 1 } qw( |
20
|
|
|
|
|
|
|
install_sub_from_class |
21
|
|
|
|
|
|
|
install_sub_from_coderef |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub import { |
25
|
94
|
|
|
94
|
|
256
|
my ($this_class, @subs) = @_; |
26
|
94
|
|
|
|
|
249
|
my $caller_class = caller 0; |
27
|
|
|
|
|
|
|
|
28
|
94
|
|
|
|
|
691
|
for my $sub (@subs) { |
29
|
156
|
50
|
|
|
|
479
|
if (! exists $EXPORT_OK{$sub}) { |
30
|
0
|
|
|
|
|
0
|
croak "$sub is not exported by " . __PACKAGE__; |
31
|
|
|
|
|
|
|
} |
32
|
156
|
|
|
|
|
307
|
install_sub_from_class(($this_class, $sub) => $caller_class); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
94
|
|
|
|
|
100203
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub install_sub_from_class { |
39
|
923
|
|
|
923
|
1
|
4432
|
my ($pkg_from, $sub_name, $pkg_to) = @_; |
40
|
923
|
|
|
|
|
1777
|
my $from = join q{::}, ($pkg_from, $sub_name); |
41
|
923
|
|
|
|
|
1496
|
my $to = join q{::}, ($pkg_to, $sub_name); |
42
|
|
|
|
|
|
|
|
43
|
16
|
|
|
16
|
|
106
|
no strict 'refs'; ## no critic |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
704
|
|
44
|
16
|
|
|
16
|
|
91
|
no warnings 'once'; ## no critic |
|
16
|
|
|
|
|
48
|
|
|
16
|
|
|
|
|
1668
|
|
45
|
923
|
|
|
|
|
919
|
*{$to} = *{$from}; |
|
923
|
|
|
|
|
4722
|
|
|
923
|
|
|
|
|
2552
|
|
46
|
|
|
|
|
|
|
|
47
|
923
|
|
|
|
|
3003
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub install_sub_from_coderef { |
51
|
364
|
|
|
364
|
1
|
550
|
my ($coderef, $pkg_to, $sub_name) = @_; |
52
|
364
|
|
|
|
|
769
|
my $to = join q{::}, ($pkg_to, $sub_name); |
53
|
|
|
|
|
|
|
|
54
|
16
|
|
|
16
|
|
78
|
no strict 'refs'; ## no critic |
|
16
|
|
|
|
|
115
|
|
|
16
|
|
|
|
|
533
|
|
55
|
16
|
|
|
16
|
|
82
|
no warnings 'redefine'; ## no critic |
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
750
|
|
56
|
16
|
|
|
16
|
|
81
|
no warnings 'once'; ## no critic |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
1019
|
|
57
|
364
|
|
|
|
|
363
|
*{$to} = $coderef; |
|
364
|
|
|
|
|
1613
|
|
58
|
|
|
|
|
|
|
|
59
|
364
|
|
|
|
|
1241
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |