Commit | Line | Data |
ecf68df6 |
1 | package File::Spec::Cygwin; |
2 | |
3 | use strict; |
4 | use vars qw(@ISA $VERSION); |
5 | require File::Spec::Unix; |
6 | |
6f0dcf97 |
7 | $VERSION = '1.1'; |
ecf68df6 |
8 | |
9 | @ISA = qw(File::Spec::Unix); |
10 | |
07824bd1 |
11 | =head1 NAME |
12 | |
13 | File::Spec::Cygwin - methods for Cygwin file specs |
14 | |
15 | =head1 SYNOPSIS |
16 | |
17 | require File::Spec::Cygwin; # Done internally by File::Spec if needed |
18 | |
19 | =head1 DESCRIPTION |
20 | |
21 | See File::Spec::Unix for a documentation of the methods provided |
22 | there. This package overrides the implementation of these methods, not |
23 | the semantics. |
24 | |
25 | This module is still in beta. Cygwin-knowledgeable folks are invited |
26 | to offer patches and suggestions. |
27 | |
28 | =cut |
29 | |
30 | =pod |
31 | |
32 | =item canonpath |
33 | |
34 | Any C<\> (backslashes) are converted to C</> (forward slashes), |
35 | and then File::Spec::Unix canonpath() is called on the result. |
36 | |
37 | =cut |
38 | |
ecf68df6 |
39 | sub canonpath { |
40 | my($self,$path) = @_; |
41 | $path =~ s|\\|/|g; |
42 | return $self->SUPER::canonpath($path); |
43 | } |
44 | |
07824bd1 |
45 | =pod |
46 | |
47 | =item file_name_is_absolute |
48 | |
49 | True is returned if the file name begins with C<drive_letter:>, |
50 | and if not, File::Spec::Unix file_name_is_absolute() is called. |
51 | |
52 | =cut |
53 | |
54 | |
3ed25742 |
55 | sub file_name_is_absolute { |
56 | my ($self,$file) = @_; |
57 | return 1 if $file =~ m{^([a-z]:)?[\\/]}is; # C:/test |
58 | return $self->SUPER::file_name_is_absolute($file); |
59 | } |
60 | |
07824bd1 |
61 | =item tmpdir (override) |
f534ab20 |
62 | |
07824bd1 |
63 | Returns a string representation of the first existing directory |
64 | from the following list: |
ecf68df6 |
65 | |
07824bd1 |
66 | $ENV{TMPDIR} |
67 | /tmp |
68 | C:/temp |
ecf68df6 |
69 | |
07824bd1 |
70 | Since Perl 5.8.0, if running under taint mode, and if the environment |
71 | variables are tainted, they are not used. |
ecf68df6 |
72 | |
07824bd1 |
73 | =cut |
ecf68df6 |
74 | |
07824bd1 |
75 | my $tmpdir; |
76 | sub tmpdir { |
77 | return $tmpdir if defined $tmpdir; |
78 | my $self = shift; |
79 | $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' ); |
80 | } |
ecf68df6 |
81 | |
07824bd1 |
82 | 1; |