line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MaybeXSAccessor; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-05-04'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
36988
|
use 5.010001; |
|
2
|
|
|
|
|
14
|
|
7
|
2
|
|
|
2
|
|
7
|
use strict 'subs', 'vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
8
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
299
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $_target_spec; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
13
|
2
|
|
|
2
|
|
14
|
my $pkg = shift; |
14
|
2
|
|
|
|
|
1
|
my $spec = shift; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
4
|
my $caller = caller(); |
17
|
|
|
|
|
|
|
|
18
|
2
|
100
|
|
|
|
2
|
if (eval { require Class::XSAccessor; 1 }) { |
|
2
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
3
|
|
19
|
|
|
|
|
|
|
# XXX bad, bad implementation. we need to call _generate_method directly |
20
|
|
|
|
|
|
|
$_target_spec = { |
21
|
|
|
|
|
|
|
constructor => 'new', |
22
|
1
|
|
50
|
|
|
1
|
accessors => { map { $_ => $_ } @{ $spec->{accessors} // [] } }, |
|
2
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
4
|
|
23
|
|
|
|
|
|
|
}; |
24
|
1
|
|
|
|
|
50
|
eval "package $caller; Class::XSAccessor->import(\$Class::MaybeXSAccessor::_target_spec);"; |
25
|
1
|
50
|
|
|
|
162
|
die if $@; |
26
|
|
|
|
|
|
|
} else { |
27
|
1
|
|
|
|
|
91
|
require Class::Accessor; |
28
|
1
|
|
|
|
|
1760
|
push @{"$caller\::ISA"}, "Class::Accessor"; |
|
1
|
|
|
|
|
11
|
|
29
|
1
|
|
|
|
|
1
|
$caller->_mk_accessors('rw', @{ $spec->{accessors} }); |
|
1
|
|
|
|
|
6
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
# ABSTRACT: Generate accessors/constructor |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |