| 1 | package FFI::Build::Plugin; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use autodie; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use File::Spec::Functions qw( catdir catfile ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # ABSTRACT: Platform and local customizations of FFI::Build | ||||||||||||||||||||||||||||
| 9 | 11 | our $VERSION = '2.12'; # VERSION | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub new | ||||||||||||||||||||||||||||
| 13 | 13 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 13 | my($class) = @_; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 13 | my %plugins; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 13 | foreach my $inc (@INC) | |||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||
| 20 | # CAVEAT: won't work with an @INC hook. Plugins must be in a "real" directory. | ||||||||||||||||||||||||||||
| 21 | 98 | my $path = catdir($inc, 'FFI', 'Build', 'Plugin'); | |||||||||||||||||||||||||||
| 22 | 98 | ▶ | next unless -d $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 2 | my $dh; | |||||||||||||||||||||||||||
| 24 | 2 | opendir $dh, $path; | |||||||||||||||||||||||||||
| 25 | 2 | my @list = readdir $dh; | |||||||||||||||||||||||||||
| 26 | 2 | closedir $dh; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | foreach my $name (map { my $x = $_; $x =~ s/\.pm$//; $x } grep /\.pm$/, @list) | |||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||
| 30 | 4 | ▶ | next if defined $plugins{$name}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 4 | my $pm = catfile('FFI', 'Build', 'Plugin', "$name.pm"); | |||||||||||||||||||||||||||
| 32 | 4 | require $pm; | |||||||||||||||||||||||||||
| 33 | 4 | my $class = "FFI::Build::Plugin::$name"; | |||||||||||||||||||||||||||
| 34 | 4 | ▶ | if($class->can("api_version") && $class->api_version == 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->can("api_version") and $class->api_version == 0
MC/DC0%0/2
$class->can("api_version") and $class->api_version == 0
$class->can("api_version")
$class->api_version == 0
Truth table33%1/3
A and B
A= $class->can("api_version")B= $class->api_version == 0
| |||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 4 | $plugins{$name} = $class->new; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | else | ||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||
| 40 | 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 | 13 | bless \%plugins, $class; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub call | ||||||||||||||||||||||||||||
| 49 | 256 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
call: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 256 | my($self, $method, @args) = @_; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 256 | foreach my $name (sort keys %$self) | |||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||
| 54 | 2 | my $plugin = $self->{$name}; | |||||||||||||||||||||||||||
| 55 | 2 | ▶ | $plugin->$method(@args) if $plugin->can($method); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 256 | 1; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 11 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||