line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Easy::Base; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
36380
|
use Class::Easy::Import; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Class::Easy; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
4
|
|
|
4
|
|
32
|
my $mypkg = shift; |
9
|
4
|
|
|
|
|
9
|
my $callpkg = caller; |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
|
|
8
|
my %params = @_; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# use warnings |
14
|
4
|
|
|
|
|
21
|
${^WARNING_BITS} ^= ${^WARNING_BITS} ^ $Class::Easy::Import::WARN; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# use strict, use utf8; |
17
|
4
|
|
|
|
|
6
|
$^H |= $Class::Easy::Import::H; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# use feature |
20
|
4
|
|
|
|
|
29
|
$^H{feature_switch} = $^H{feature_say} = $^H{feature_state} = 1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# probably check for try_to_use is enough |
23
|
|
|
|
|
|
|
return |
24
|
4
|
|
|
|
|
48
|
if defined *{"$callpkg\::try_to_use"}{CODE} |
|
0
|
|
|
|
|
0
|
|
25
|
4
|
50
|
33
|
|
|
6
|
and Class::Easy::sub_fullname (*{"$callpkg\::try_to_use"}{CODE}) eq 'Class::Easy::__ANON__'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# export subs |
28
|
4
|
|
|
|
|
12
|
*{"$callpkg\::$_"} = \&{"Class::Easy::$_"} foreach @Class::Easy::EXPORT; |
|
28
|
|
|
|
|
113
|
|
|
28
|
|
|
|
|
65
|
|
29
|
4
|
|
|
|
|
13
|
foreach my $p (keys %Class::Easy::EXPORT_FOREIGN) { |
30
|
4
|
|
|
|
|
6
|
*{"$callpkg\::$_"} = \&{"$p\::$_"} foreach @{$Class::Easy::EXPORT_FOREIGN{$p}}; |
|
4
|
|
|
|
|
9
|
|
|
24
|
|
|
|
|
86
|
|
|
24
|
|
|
|
|
63
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
5
|
push @{"$callpkg\::ISA"}, 'Class::Easy::Base'; |
|
4
|
|
|
|
|
236
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
3
|
|
|
3
|
1
|
573
|
my $class = shift; |
39
|
3
|
|
|
|
|
7
|
my $params = {@_}; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
13
|
bless $params, $class; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub set_field_values { |
45
|
2
|
|
|
2
|
1
|
449
|
my $self = shift; |
46
|
2
|
|
|
|
|
6
|
my %params = @_; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
6
|
foreach my $k (keys %params) { |
49
|
2
|
|
|
|
|
8
|
$self->$k ($params{$k}); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub list_all_subs { |
54
|
1
|
|
|
1
|
1
|
3
|
my $class = shift; |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
5
|
$class = ref $class if ref $class; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
5
|
my $sub_by_type = Class::Easy::list_all_subs_for ($class); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
wantarray |
61
|
|
|
|
|
|
|
? ( |
62
|
0
|
|
|
|
|
0
|
keys %{$sub_by_type->{method}}, |
|
0
|
|
|
|
|
0
|
|
63
|
0
|
|
|
|
|
0
|
keys %{$sub_by_type->{runtime}}, |
64
|
1
|
50
|
|
|
|
7
|
map {@{$sub_by_type->{inherited}->{$_}}} keys %{$sub_by_type->{inherited}}) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
65
|
|
|
|
|
|
|
: $sub_by_type; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub attach_paths { |
70
|
1
|
|
|
1
|
1
|
3
|
my $class = shift; |
71
|
|
|
|
|
|
|
|
72
|
1
|
50
|
|
|
|
4
|
$class = ref $class if ref $class; |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
4
|
my @pack_chunks = split(/\:\:/, $class); |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
5
|
require File::Spec; |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
3
|
my $FS = 'File::Spec'; |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
51
|
my $pack_path = join ('/', @pack_chunks) . '.pm'; |
81
|
1
|
|
|
|
|
3
|
my $pack_inc_path = $INC{$pack_path}; |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
13
|
$pack_path = $FS->canonpath ($pack_path); |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
42
|
my $pack_abs_path = $FS->rel2abs ($FS->canonpath ($pack_inc_path)); |
86
|
1
|
|
|
|
|
5
|
Class::Easy::make_accessor ($class, 'package_path', default => $pack_abs_path); |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
3
|
my $lib_path = substr ($pack_abs_path, 0, rindex ($pack_abs_path, $pack_path)); |
89
|
1
|
|
|
|
|
6
|
Class::Easy::make_accessor ($class, 'lib_path', default => $FS->canonpath ($lib_path)); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |