| 1 | package ExtUtils::Helpers; | ||||||||||||
| 2 | 4 | $ExtUtils::Helpers::VERSION = '0.026'; | |||||||||||
| 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'
MC/DC0%0/1
$impl_for{$^O} || 'Unix'
$impl_for{$^O}
Truth table50%1/2
A
A= $impl_for{$^O}
| |||||||||||||
| 17 | 4 | ▶ | my $impl = $impl_for{$^O} || 'Unix'; | ||||||||||
|
Condition50%1/2
$impl_for{$^O} || 'Unix'
MC/DC0%0/1
$impl_for{$^O} || 'Unix'
$impl_for{$^O}
Truth table50%1/2
A
A= $impl_for{$^O}
| |||||||||||||
| 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
| |||||||||||||
| 26 | 5 | $string =~ s/^\s+|\s+$//g; | |||||||||||
| 27 | 5 | ▶ | return if not length $string; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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} || '::'
MC/DC0%0/1
$separator{$^O} || '::'
$separator{$^O}
Truth table50%1/2
A
A= $separator{$^O}
| |||||||||||||
| 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"
MC/DC0%0/1
$base ||= "lib"
$base
Truth table50%1/2
A
A= $base
| |||||||||||||
| 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__ | ||||||||||||