| 1 | package File::Spec::Functions; | ||
| 2 | |||
| 3 | use File::Spec; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); | ||
| 7 | |||
| 8 | $VERSION = '3.67'; | ||
| 9 | $VERSION =~ tr/_//d; | ||
| 10 | |||
| 11 | require Exporter; | ||
| 12 | |||
| 13 | @ISA = qw(Exporter); | ||
| 14 | |||
| 15 | @EXPORT = qw( | ||
| 16 | canonpath | ||
| 17 | catdir | ||
| 18 | catfile | ||
| 19 | curdir | ||
| 20 | rootdir | ||
| 21 | updir | ||
| 22 | no_upwards | ||
| 23 | file_name_is_absolute | ||
| 24 | path | ||
| 25 | ); | ||
| 26 | |||
| 27 | @EXPORT_OK = qw( | ||
| 28 | devnull | ||
| 29 | tmpdir | ||
| 30 | splitpath | ||
| 31 | splitdir | ||
| 32 | catpath | ||
| 33 | abs2rel | ||
| 34 | rel2abs | ||
| 35 | case_tolerant | ||
| 36 | ); | ||
| 37 | |||
| 38 | %EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] ); | ||
| 39 | |||
| 40 | require File::Spec::Unix; | ||
| 41 | my %udeps = ( | ||
| 42 | canonpath => [], | ||
| 43 | catdir => [qw(canonpath)], | ||
| 44 | catfile => [qw(canonpath catdir)], | ||
| 45 | case_tolerant => [], | ||
| 46 | curdir => [], | ||
| 47 | devnull => [], | ||
| 48 | rootdir => [], | ||
| 49 | updir => [], | ||
| 50 | ); | ||
| 51 | |||
| 52 | foreach my $meth (@EXPORT, @EXPORT_OK) { | ||
| 53 | my $sub = File::Spec->can($meth); | ||
| 54 | no strict 'refs'; | ||
| 55 | if (exists($udeps{$meth}) && $sub == File::Spec::Unix->can($meth) && | ||
| 56 | !(grep { | ||
| 57 | File::Spec->can($_) != File::Spec::Unix->can($_) | ||
| 58 | } @{$udeps{$meth}}) && | ||
| 59 | defined(&{"File::Spec::Unix::_fn_$meth"})) { | ||
| 60 | *{$meth} = \&{"File::Spec::Unix::_fn_$meth"}; | ||
| 61 | } else { | ||
| 62 | *{$meth} = sub {&$sub('File::Spec', @_)}; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | 1; | ||
| 68 | __END__ |