blib/lib/ExtUtils/Helpers.pm

filter: Statementstmt 100% 45 / 45 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 4 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 11 / 11 Podpod 100% 3 / 3 totaltotal 86.6% 65 / 75 CC 6 SCAR 6.5
CC
6
Cov
89%
BEGIN
3.1
split_like_shell
3.1
man3_pagename
2.0
CRAP 1.9
« blib/lib/ExtUtils/Helpers/Windows.pm ↑ Summary
1 package ExtUtils::Helpers;
2 4 $ExtUtils::Helpers::VERSION = '0.025';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Exporter 5.57 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use File::Basename qw/basename/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use File::Spec::Functions qw/splitpath canonpath abs2rel splitdir/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Text::ParseWords 3.24 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 our @EXPORT_OK = qw/make_executable split_like_shell man1_pagename man3_pagename detildefy/;
13  
14 BEGIN {
15 4 ▶ my %impl_for = ( MSWin32 => 'Windows', VMS => 'VMS');
Subroutine BEGIN: called CC=3 SCAR=11.3
16 4 ▶ my $package = 'ExtUtils::Helpers::' . ($impl_for{$^O} || 'Unix');
Condition50%1/2
$impl_for{$^O} || 'Unix'
l!l
04
MC/DC0%0/1
$impl_for{$^O} || 'Unix'
$impl_for{$^O}
Truth table50%1/2
A
A= $impl_for{$^O}
Aresult
11
00
17 4 ▶ my $impl = $impl_for{$^O} || 'Unix';
Condition50%1/2
$impl_for{$^O} || 'Unix'
l!l
04
MC/DC0%0/1
$impl_for{$^O} || 'Unix'
$impl_for{$^O}
Truth table50%1/2
A
A= $impl_for{$^O}
Aresult
11
00
18 4 require "ExtUtils/Helpers/$impl.pm";
19 4 "ExtUtils::Helpers::$impl"->import();
20 }
21  
22 sub split_like_shell {
23 5 ▶ my ($string) = @_;
Subroutine split_like_shell: called CC=3 SCAR=11.3
Pod documented
24  
25 5 ▶ return if not defined $string;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $string 0 5 5
26 5 $string =~ s/^\s+|\s+$//g;
27 5 ▶ return if not length $string;
Branch: 1 branch
BranchTrueFalseTotal
unless length $string 0 5 5
28  
29 5 return Text::ParseWords::shellwords($string);
30 }
31  
32 sub man1_pagename {
33 1 ▶ my $filename = shift;
Subroutine man1_pagename: called CC=1 SCAR=0.0
Pod documented
34 1 return basename($filename).".$Config{man1ext}";
35 }
36  
37 4 my %separator = (
38 MSWin32 => '.',
39 VMS => '__',
40 os2 => '.',
41 cygwin => '.',
42 );
43 4 ▶my $separator = $separator{$^O} || '::';
Condition50%1/2
$separator{$^O} || '::'
l!l
04
MC/DC0%0/1
$separator{$^O} || '::'
$separator{$^O}
Truth table50%1/2
A
A= $separator{$^O}
Aresult
11
00
44  
45 sub man3_pagename {
46 3 ▶ my ($filename, $base) = @_;
Subroutine man3_pagename: called CC=2 SCAR=7.0
Pod documented
47 3 ▶ $base ||= 'lib';
Condition50%1/2
$base ||= "lib"
l!l
03
MC/DC0%0/1
$base ||= "lib"
$base
Truth table50%1/2
A
A= $base
Aresult
11
00
48 3 my ($vols, $dirs, $file) = splitpath(canonpath(abs2rel($filename, $base)));
49 3 $file = basename($file, qw/.pm .pod/);
50 3 my @dirs = grep { length } splitdir($dirs);
51 3 return join $separator, @dirs, "$file.$Config{man3ext}";
52 }
53  
54 4 1;
55  
56 # ABSTRACT: Various portability utilities for module builders
57  
58 __END__
« blib/lib/ExtUtils/Helpers/Windows.pm ↑ Summary