line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AutoXS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23729
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
53
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#require XSLoader; |
10
|
|
|
|
|
|
|
#XSLoader::load('AutoXS', $VERSION); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use vars qw/%ScanClasses $Debug/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
77
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use B; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
54
|
|
15
|
1
|
|
|
1
|
|
1007
|
use B::Utils (); |
|
1
|
|
|
|
|
7142
|
|
|
1
|
|
|
|
|
29
|
|
16
|
1
|
|
|
1
|
|
903
|
use B::Generate; |
|
1
|
|
|
|
|
2508
|
|
|
1
|
|
|
|
|
34
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
7
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
19
|
|
|
|
|
|
|
use Module::Pluggable |
20
|
0
|
|
|
|
|
|
except => qr/(?:::b?lib::|^AutoXS::Header$)/, |
21
|
|
|
|
|
|
|
search_path => 'AutoXS', |
22
|
|
|
|
|
|
|
sub_name => 'plugins', |
23
|
1
|
|
|
1
|
|
453
|
; |
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use vars qw/@ISA/; |
26
|
|
|
|
|
|
|
sub import { |
27
|
|
|
|
|
|
|
my $class = shift; |
28
|
|
|
|
|
|
|
my ($callerpkg) = caller; |
29
|
|
|
|
|
|
|
return if $callerpkg =~ /^AutoXS/; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my @importclasses; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
if (@_ == 1) { |
34
|
|
|
|
|
|
|
# load all plugins |
35
|
|
|
|
|
|
|
if ($_[0] eq ':all') { |
36
|
|
|
|
|
|
|
push @importclasses, $class->plugins(); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
|
|
|
|
|
|
croak("Invalid arguments to 'use $class;'"); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif (@_ == 0) { |
43
|
|
|
|
|
|
|
if ($class =~ /^AutoXS::(.+)$/) { |
44
|
|
|
|
|
|
|
# called on a plugin class (inherited) |
45
|
|
|
|
|
|
|
# apply that plugin |
46
|
|
|
|
|
|
|
push @importclasses, $class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
|
|
|
|
|
|
my %args = @_; |
51
|
|
|
|
|
|
|
$AutoXS::Debug = 1 if $args{debug}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return if not defined $args{plugins}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
push @importclasses, (ref($args{plugins}) ? @{$args{plugins}} : ($args{plugins})); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
foreach my $importclass (@importclasses) { |
59
|
|
|
|
|
|
|
$importclass = "AutoXS::$importclass" if not $importclass =~ /^AutoXS::/; |
60
|
|
|
|
|
|
|
eval "require $importclass;"; |
61
|
|
|
|
|
|
|
if ($@) { |
62
|
|
|
|
|
|
|
die "Cannot load AutoXS scanner plugin '$importclass': $@"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
warn "Registering AutoXS scanner class '$importclass' for scanning '$callerpkg'.\n" if $AutoXS::Debug; |
65
|
|
|
|
|
|
|
$importclass->register_class($callerpkg, $importclass); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub register_class { |
70
|
|
|
|
|
|
|
my $class = shift; |
71
|
|
|
|
|
|
|
$class = shift if $class =~ /^AutoXS/; |
72
|
|
|
|
|
|
|
die "Cannot register undefined class!" if not defined $class; |
73
|
|
|
|
|
|
|
my @plugins = @_; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
foreach my $plugin (@plugins) { |
76
|
|
|
|
|
|
|
$ScanClasses{$plugin}{$class} = 1; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub get_symbol { |
81
|
|
|
|
|
|
|
my $class = shift; |
82
|
|
|
|
|
|
|
my $edit_pkg = shift; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
no strict 'refs'; |
85
|
|
|
|
|
|
|
my $sym = \%{$edit_pkg."::"}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return $sym; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
__END__ |