line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Build::Plugin; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
235557
|
use strict; |
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
271
|
|
4
|
9
|
|
|
9
|
|
49
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
246
|
|
5
|
9
|
|
|
9
|
|
4580
|
use autodie; |
|
9
|
|
|
|
|
127703
|
|
|
9
|
|
|
|
|
57
|
|
6
|
9
|
|
|
9
|
|
67215
|
use File::Spec::Functions qw( catdir catfile ); |
|
9
|
|
|
|
|
8320
|
|
|
9
|
|
|
|
|
4674
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Platform and local customizations of FFI::Build |
9
|
|
|
|
|
|
|
our $VERSION = '2.08'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
11
|
|
|
11
|
0
|
17992
|
my($class) = @_; |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
24
|
my %plugins; |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
34
|
foreach my $inc (@INC) |
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
# CAVEAT: won't work with an @INC hook. Plugins must be in a "real" directory. |
21
|
109
|
|
|
|
|
510
|
my $path = catdir($inc, 'FFI', 'Build', 'Plugin'); |
22
|
109
|
100
|
|
|
|
1192
|
next unless -d $path; |
23
|
2
|
|
|
|
|
6
|
my $dh; |
24
|
2
|
|
|
|
|
10
|
opendir $dh, $path; |
25
|
2
|
|
|
|
|
1533
|
my @list = readdir $dh; |
26
|
2
|
|
|
|
|
15
|
closedir $dh; |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
639
|
foreach my $name (map { my $x = $_; $x =~ s/\.pm$//; $x } grep /\.pm$/, @list) |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
13
|
|
29
|
|
|
|
|
|
|
{ |
30
|
4
|
50
|
|
|
|
11
|
next if defined $plugins{$name}; |
31
|
4
|
|
|
|
|
25
|
my $pm = catfile('FFI', 'Build', 'Plugin', "$name.pm"); |
32
|
4
|
|
|
|
|
1129
|
require $pm; |
33
|
4
|
|
|
|
|
13
|
my $class = "FFI::Build::Plugin::$name"; |
34
|
4
|
50
|
33
|
|
|
58
|
if($class->can("api_version") && $class->api_version == 0) |
35
|
|
|
|
|
|
|
{ |
36
|
4
|
|
|
|
|
12
|
$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
|
|
|
|
|
77
|
bless \%plugins, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub call |
49
|
|
|
|
|
|
|
{ |
50
|
208
|
|
|
208
|
0
|
3149
|
my($self, $method, @args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
208
|
|
|
|
|
1555
|
foreach my $name (sort keys %$self) |
53
|
|
|
|
|
|
|
{ |
54
|
2
|
|
|
|
|
5
|
my $plugin = $self->{$name}; |
55
|
2
|
100
|
|
|
|
27
|
$plugin->$method(@args) if $plugin->can($method); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
208
|
|
|
|
|
951
|
1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |