« blib/lib/Alien/Build/Plugin/PkgConfig/LibPkgConf.pm
↑ Summary
corpus/lib/Alien/Foo2/ConfigData.pm »
| 1 | package Alien::Foo1::ConfigData; | |||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | |||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | my $arrayref = eval do {local $/; <DATA>} | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 4 | or die "Couldn't load ConfigData data: $@"; | |||||||||||||||||||||||||||||||||
| 5 | 1 | close DATA; | ||||||||||||||||||||||||||||||||
| 6 | 1 | my ($config, $features, $auto_features) = @$arrayref; | ||||||||||||||||||||||||||||||||
| 7 | ||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | sub config { $config->{$_[1]} } | |||||||||||||||||||||||||||||||
|
Subroutine
config: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub set_config { $config->{$_[1]} = $_[2] } | |||||||||||||||||||||||||||||||
|
Subroutine
set_config: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub set_feature { $features->{$_[1]} = 0+!!$_[2] } # Constrain to 1 or 0 | |||||||||||||||||||||||||||||||
|
Subroutine
set_feature: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 12 | ||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub auto_feature_names { grep !exists $features->{$_}, keys %$auto_features } | |||||||||||||||||||||||||||||||
|
Subroutine
auto_feature_names: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 14 | ||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub feature_names { | |||||||||||||||||||||||||||||||
|
Subroutine
feature_names: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 16 | 0 | my @features = (keys %$features, auto_feature_names()); | ||||||||||||||||||||||||||||||||
| 17 | 0 | @features; | ||||||||||||||||||||||||||||||||
| 18 | } | |||||||||||||||||||||||||||||||||
| 19 | ||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub config_names { keys %$config } | |||||||||||||||||||||||||||||||
|
Subroutine
config_names: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub write { | |||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=6 SCAR=37.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 23 | 0 | my $me = __FILE__; | ||||||||||||||||||||||||||||||||
| 24 | ||||||||||||||||||||||||||||||||||
| 25 | # Can't use Module::Build::Dumper here because M::B is only a | |||||||||||||||||||||||||||||||||
| 26 | # build-time prereq of this module | |||||||||||||||||||||||||||||||||
| 27 | 0 | require Data::Dumper; | ||||||||||||||||||||||||||||||||
| 28 | ||||||||||||||||||||||||||||||||||
| 29 | 0 | my $mode_orig = (stat $me)[2] & 07777; | ||||||||||||||||||||||||||||||||
| 30 | 0 | chmod($mode_orig | 0222, $me); # Make it writeable | ||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | open(my $fh, '+<', $me) or die "Can't rewrite $me: $!"; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 32 | 0 | seek($fh, 0, 0); | ||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | while (<$fh>) { | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | last if /^__DATA__$/; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 35 | } | |||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | die "Couldn't find __DATA__ token in $me" if eof($fh); | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 37 | ||||||||||||||||||||||||||||||||||
| 38 | 0 | seek($fh, tell($fh), 0); | ||||||||||||||||||||||||||||||||
| 39 | 0 | my $data = [$config, $features, $auto_features]; | ||||||||||||||||||||||||||||||||
| 40 | 0 | print($fh 'do{ my ' | ||||||||||||||||||||||||||||||||
| 41 | . Data::Dumper->new([$data],['x'])->Purity(1)->Dump() | |||||||||||||||||||||||||||||||||
| 42 | . '$x; }' ); | |||||||||||||||||||||||||||||||||
| 43 | 0 | truncate($fh, tell($fh)); | ||||||||||||||||||||||||||||||||
| 44 | 0 | close $fh; | ||||||||||||||||||||||||||||||||
| 45 | ||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | chmod($mode_orig, $me) | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 47 | or warn "Couldn't restore permissions on $me: $!"; | |||||||||||||||||||||||||||||||||
| 48 | } | |||||||||||||||||||||||||||||||||
| 49 | ||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub feature { | |||||||||||||||||||||||||||||||
|
Subroutine
feature: not called CC=10 SCAR=47.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||
| 51 | 0 | my ($package, $key) = @_; | ||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | return $features->{$key} if exists $features->{$key}; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 53 | ||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my $info = $auto_features->{$key} or return 0; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 55 | ||||||||||||||||||||||||||||||||||
| 56 | # Under perl 5.005, each(%$foo) isn't working correctly when $foo | |||||||||||||||||||||||||||||||||
| 57 | # was reanimated with Data::Dumper and eval(). Not sure why, but | |||||||||||||||||||||||||||||||||
| 58 | # copying to a new hash seems to solve it. | |||||||||||||||||||||||||||||||||
| 59 | 0 | my %info = %$info; | ||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||
| 61 | 0 | require Module::Build; # XXX should get rid of this | ||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | while (my ($type, $prereqs) = each %info) { | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | next if $type eq 'description' || $type eq 'recommends'; | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "description" or $type eq "recommends"
MC/DC0%0/2
$type eq "description" or $type eq "recommends"
$type eq "description"
$type eq "recommends"
Truth table0%0/3
A or B
A= $type eq "description"B= $type eq "recommends"
| ||||||||||||||||||||||||||||||||||
| 64 | ||||||||||||||||||||||||||||||||||
| 65 | 0 | my %p = %$prereqs; # Ditto here. | ||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | while (my ($modname, $spec) = each %p) { | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 67 | 0 | my $status = Module::Build->check_installed_status($modname, $spec); | ||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ((!$status->{ok}) xor ($type =~ /conflicts$/)) { return 0; } | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
not $status->{"ok"} xor $type =~ /conflicts$/
MC/DC0%0/2
not $status->{"ok"} xor $type =~ /conflicts$/
not $status->{"ok"}
$type =~ /conflicts$/
Truth table0%0/4
not(A) xor B
A= not $status->{"ok"}B= $type =~ /conflicts$/
| ||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ( ! eval "require $modname; 1" ) { return 0; } | |||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||
| 70 | } | |||||||||||||||||||||||||||||||||
| 71 | } | |||||||||||||||||||||||||||||||||
| 72 | 0 | return 1; | ||||||||||||||||||||||||||||||||
| 73 | } | |||||||||||||||||||||||||||||||||
| 74 | ||||||||||||||||||||||||||||||||||
| 75 | ||||||||||||||||||||||||||||||||||
| 76 | __DATA__ | |||||||||||||||||||||||||||||||||