blib/lib/ExtUtils/configPL.pm

filter: Statementstmt 98.3% 59 / 60 Branchbran 87.5% 14 / 16 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 94.4% 85 / 90 CC 12 SCAR 14.3
CC
12
Cov
95%
__ANON__
8.0
import
4.0
BEGIN
2.1
CRAP 4.2
↑ Summary
1 package ExtUtils::configPL;
2  
3 4 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our ($VERSION) = '$Revision: 1.1 $' =~ /\$Revision:\s+([^\s]+)/;
8  
9 4 ▶use Filter::Util::Call;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use File::Basename qw(dirname);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 our $filename;
16  
17 4 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.2
18 4 $filename = dirname($0) . '/' . $main::ARGV[0];
19 4 ▶ open OUT, ">$filename" || croak "Unable to open: $main::ARGV[0]";
Condition50%1/2
">$ExtUtils::configPL::filename" || croak("Unable to open: $ARGV[0]")
l!l
40
MC/DC0%0/1
">$ExtUtils::configPL::filename" || croak("Unable to open: $ARGV[0]")
">$ExtUtils::configPL::filename"
Truth table50%1/2
A
A= ">$ExtUtils::configPL::filename"
Aresult
11
00
20 }
21  
22 4 ▶sub import {
Subroutine import: called CC=4 SCAR=13.9
23 4 my ($class, %args) = @_;
24  
25 # Verify the arguments
26 4 my $ident = '<<--(\w+)-->>';
27 4 my $mode = 0755;
28  
29 4 foreach my $arg (keys %args) {
30 CONTROLS: {
31 2 ▶ ($arg eq 'identifier') && do { $ident = $args{'identifier'}; last };
Branch: 1 branch
BranchTrueFalseTotal
$arg eq "identifier" and do { $ident = $args{"identifier"}; last } 1 1 2
32 1 ▶ ($arg eq 'mode') && do { $mode = $args{'mode'}; last };
Branch: 1 branch
BranchTrueFalseTotal
$arg eq "mode" and do { $mode = $args{"mode"}; last } 1 0 1
33 0 croak "ExtUtils::configPL: Unknow control: $arg";
34 }
35 }
36  
37 4 chmod $mode, $filename;
38  
39 # Pick apart the parts of the identifier
40 4 my ($pre, $post) = ($ident =~ m/(.*)(?<!\\)\(.+(?<!\\)\)(.*)/);
41  
42 filter_add (
43 4 ▶ sub {
Subroutine __ANON__: called CC=8 SCAR=20.8
44 4 my $in = 1;
45 4 ▶ while (my $status = filter_read()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $status = &filter_read()) 89 4 93
46 89 ▶ if ($in) {
Branch: 2 branches
BranchTrueFalseTotal
if ($in) { } 81 8 89
elsif (/^\s*use\s+$class\s*;\s*$/) { } 1 7 8
47 81 ▶ if (m/^\s*no\s+$class\s*;\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*no\s+$class\s*;\s*$/) 1 80 81
48 1 $in = 0;
49 1 $_= '';
50 1 next;
51 }
52  
53 80 ▶ if (my @configs = m/$ident/g) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@configs) = /$ident/g) 12 68 80
54 12 foreach my $var (@configs) {
55 croak "ExtUtils::ConfigPL: Unknown configuration variable: $var"
56 16 ▶ unless exists $Config{$var};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ExtUtils::configPL::Config{$var} 0 16 16
57 16 s/${pre}${var}${post}/$Config{$var}/g;
58 }
59 }
60 } elsif (m/^\s*use\s+$class\s*;\s*$/) {
61 1 $in = 1;
62 1 $_= '';
63 1 next;
64 }
65 87 print OUT;
66 87 $_ = '';
67 }
68 4 exit;
69 }
70 4 );
71 }
72  
73 4 1;
74 __END__
↑ Summary