« lib/Perlmazing/Perlmazing/Precompile/is_integer.pm
↑ Summary
blib/lib/Perlmazing/Perlmazing/unix_path.pm »
| 1 | use File::Spec (); | ||
| 2 | require File::Spec::Win32; | ||
| 3 | |||
| 4 | sub main { | ||
| 5 | my $path = shift; | ||
| 6 | # A little hack is needed for UNC paths under File::Spec | ||
| 7 | my $is_unc = $path =~ /^\\\\/ ? 1 : 0; | ||
| 8 | my @items = File::Spec::Win32->splitdir($path); | ||
| 9 | if ($is_unc and @items >= 3 and length($items[0]) == 0 and length($items[1]) == 0) { | ||
| 10 | @items = ('\\\\'.$items[2], @items[3..$#items]); | ||
| 11 | } | ||
| 12 | @items; | ||
| 13 | } | ||
| 14 | |||
| 15 | 1; |