blib/lib/Perlmazing/Perlmazing/splitpath.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 37 CC 5 SCAR 30.9
CC
5
Cov
0%
main
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 22.0
1 use File::Spec ();
2 require File::Spec::Win32;
3  
4 sub main {
5 my $path = shift;
6 return unless defined $path;
7 # A little hack is needed for UNC paths under File::Spec
8 local $1;
9 my $unc_name = $path =~ /^\\\\(\w+)/ ? $1 : undef;
10 if (defined $unc_name) {
11 # Let's have it treat it like a regular Win32 path
12 $path =~ s/^\\\\$unc_name/C:/;
13 }
14 my @items = File::Spec::Win32->splitpath($path);
15 if (defined $unc_name and @items and length $items[0]) {
16 $items[0] = "\\\\$unc_name";
17 }
18 @items;
19 }
20  
21 1;