| 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]")
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"
| |||||||||||||||
| 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
| |||||||||||||||
| 32 | 1 | ▶ | ($arg eq 'mode') && do { $mode = $args{'mode'}; last }; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 46 | 89 | ▶ | if ($in) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 47 | 81 | ▶ | if (m/^\s*no\s+$class\s*;\s*$/) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 48 | 1 | $in = 0; | |||||||||||||
| 49 | 1 | $_= ''; | |||||||||||||
| 50 | 1 | next; | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | 80 | ▶ | if (my @configs = m/$ident/g) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 54 | 12 | foreach my $var (@configs) { | |||||||||||||
| 55 | croak "ExtUtils::ConfigPL: Unknown configuration variable: $var" | ||||||||||||||
| 56 | 16 | ▶ | unless exists $Config{$var}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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__ | ||||||||||||||