| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package ExtUtils::Helpers; | 
| 2 |  |  |  |  |  |  | $ExtUtils::Helpers::VERSION = '0.024'; # TRIAL | 
| 3 | 4 |  |  | 4 |  | 57375 | use strict; | 
|  | 4 |  |  |  |  | 7 |  | 
|  | 4 |  |  |  |  | 98 |  | 
| 4 | 4 |  |  | 4 |  | 12 | use warnings FATAL => 'all'; | 
|  | 4 |  |  |  |  | 3 |  | 
|  | 4 |  |  |  |  | 136 |  | 
| 5 | 4 |  |  | 4 |  | 12 | use Exporter 5.57 'import'; | 
|  | 4 |  |  |  |  | 71 |  | 
|  | 4 |  |  |  |  | 108 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 4 |  |  | 4 |  | 12 | use Config; | 
|  | 4 |  |  |  |  | 3 |  | 
|  | 4 |  |  |  |  | 115 |  | 
| 8 | 4 |  |  | 4 |  | 12 | use File::Basename qw/basename/; | 
|  | 4 |  |  |  |  | 3 |  | 
|  | 4 |  |  |  |  | 253 |  | 
| 9 | 4 |  |  | 4 |  | 1188 | use File::Spec::Functions qw/splitpath canonpath abs2rel splitdir/; | 
|  | 4 |  |  |  |  | 1583 |  | 
|  | 4 |  |  |  |  | 216 |  | 
| 10 | 4 |  |  | 4 |  | 1578 | use Text::ParseWords 3.24 (); | 
|  | 4 |  |  |  |  | 3873 |  | 
|  | 4 |  |  |  |  | 287 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | our @EXPORT_OK = qw/make_executable split_like_shell man1_pagename man3_pagename detildefy/; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | BEGIN { | 
| 15 | 4 |  |  | 4 |  | 11 | my %impl_for = ( MSWin32 => 'Windows', VMS => 'VMS'); | 
| 16 | 4 |  | 50 |  |  | 33 | my $package = 'ExtUtils::Helpers::' . ($impl_for{$^O} || 'Unix'); | 
| 17 | 4 |  | 50 |  |  | 17 | my $impl = $impl_for{$^O} || 'Unix'; | 
| 18 | 4 |  |  |  |  | 1298 | require "ExtUtils/Helpers/$impl.pm"; | 
| 19 | 4 |  |  |  |  | 974 | "ExtUtils::Helpers::$impl"->import(); | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub split_like_shell { | 
| 23 | 5 |  |  | 5 | 1 | 3918 | my ($string) = @_; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 5 | 50 |  |  |  | 12 | return if not defined $string; | 
| 26 | 5 |  |  |  |  | 28 | $string =~ s/^\s+|\s+$//g; | 
| 27 | 5 | 50 |  |  |  | 11 | return if not length $string; | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 5 |  |  |  |  | 11 | return Text::ParseWords::shellwords($string); | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | sub man1_pagename { | 
| 33 | 1 |  |  | 1 | 1 | 13 | my $filename = shift; | 
| 34 | 1 |  |  |  |  | 123 | return basename($filename).".$Config{man1ext}"; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | my %separator = ( | 
| 38 |  |  |  |  |  |  | MSWin32 => '.', | 
| 39 |  |  |  |  |  |  | VMS => '__', | 
| 40 |  |  |  |  |  |  | os2 => '.', | 
| 41 |  |  |  |  |  |  | cygwin => '.', | 
| 42 |  |  |  |  |  |  | ); | 
| 43 |  |  |  |  |  |  | my $separator = $separator{$^O} || '::'; | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | sub man3_pagename { | 
| 46 | 3 |  |  | 3 | 1 | 5 | my ($filename, $base) = @_; | 
| 47 | 3 |  | 50 |  |  | 12 | $base ||= 'lib'; | 
| 48 | 3 |  |  |  |  | 8 | my ($vols, $dirs, $file) = splitpath(canonpath(abs2rel($filename, $base))); | 
| 49 | 3 |  |  |  |  | 314 | $file = basename($file, qw/.pm .pod/); | 
| 50 | 3 |  |  |  |  | 8 | my @dirs = grep { length } splitdir($dirs); | 
|  | 5 |  |  |  |  | 10 |  | 
| 51 | 3 |  |  |  |  | 92 | return join $separator, @dirs, "$file.$Config{man3ext}"; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | 1; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | # ABSTRACT: Various portability utilities for module builders | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | __END__ |