line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Build::Plugin; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
223469
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
264
|
|
4
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
230
|
|
5
|
9
|
|
|
9
|
|
4155
|
use autodie; |
|
9
|
|
|
|
|
121644
|
|
|
9
|
|
|
|
|
55
|
|
6
|
9
|
|
|
9
|
|
66481
|
use File::Spec::Functions qw( catdir catfile ); |
|
9
|
|
|
|
|
7708
|
|
|
9
|
|
|
|
|
5119
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Platform and local customizations of FFI::Build |
9
|
|
|
|
|
|
|
our $VERSION = '2.06_01'; # TRIAL VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
11
|
|
|
11
|
0
|
20628
|
my($class) = @_; |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
24
|
my %plugins; |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
35
|
foreach my $inc (@INC) |
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
# CAVEAT: won't work with an @INC hook. Plugins must be in a "real" directory. |
21
|
109
|
|
|
|
|
515
|
my $path = catdir($inc, 'FFI', 'Build', 'Plugin'); |
22
|
109
|
100
|
|
|
|
1193
|
next unless -d $path; |
23
|
2
|
|
|
|
|
6
|
my $dh; |
24
|
2
|
|
|
|
|
13
|
opendir $dh, $path; |
25
|
2
|
|
|
|
|
1821
|
my @list = readdir $dh; |
26
|
2
|
|
|
|
|
19
|
closedir $dh; |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
630
|
foreach my $name (map { my $x = $_; $x =~ s/\.pm$//; $x } grep /\.pm$/, @list) |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
12
|
|
29
|
|
|
|
|
|
|
{ |
30
|
4
|
50
|
|
|
|
16
|
next if defined $plugins{$name}; |
31
|
4
|
|
|
|
|
24
|
my $pm = catfile('FFI', 'Build', 'Plugin', "$name.pm"); |
32
|
4
|
|
|
|
|
1166
|
require $pm; |
33
|
4
|
|
|
|
|
13
|
my $class = "FFI::Build::Plugin::$name"; |
34
|
4
|
50
|
33
|
|
|
55
|
if($class->can("api_version") && $class->api_version == 0) |
35
|
|
|
|
|
|
|
{ |
36
|
4
|
|
|
|
|
13
|
$plugins{$name} = $class->new; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
0
|
warn "$class is not the correct api version. You may need to upgrade the plugin, platypus or uninstall the plugin"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
11
|
|
|
|
|
83
|
bless \%plugins, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub call |
49
|
|
|
|
|
|
|
{ |
50
|
208
|
|
|
208
|
0
|
5413
|
my($self, $method, @args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
208
|
|
|
|
|
1366
|
foreach my $name (sort keys %$self) |
53
|
|
|
|
|
|
|
{ |
54
|
2
|
|
|
|
|
4
|
my $plugin = $self->{$name}; |
55
|
2
|
100
|
|
|
|
28
|
$plugin->$method(@args) if $plugin->can($method); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
208
|
|
|
|
|
928
|
1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |