This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Do not edit perltoc since it is autogenerated.
[perl5.git] / lib / File / Spec / Cygwin.pm
CommitLineData
ecf68df6
DR
1package File::Spec::Cygwin;
2
3use strict;
4use vars qw(@ISA $VERSION);
5require File::Spec::Unix;
6
6f0dcf97 7$VERSION = '1.1';
ecf68df6
DR
8
9@ISA = qw(File::Spec::Unix);
10
07824bd1
JH
11=head1 NAME
12
13File::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
72f15715
T
21See L<File::Spec> and L<File::Spec::Unix>. This package overrides the
22implementation of these methods, not the semantics.
07824bd1
JH
23
24This module is still in beta. Cygwin-knowledgeable folks are invited
25to offer patches and suggestions.
26
27=cut
28
29=pod
30
31=item canonpath
32
33Any C<\> (backslashes) are converted to C</> (forward slashes),
34and then File::Spec::Unix canonpath() is called on the result.
35
36=cut
37
ecf68df6
DR
38sub canonpath {
39 my($self,$path) = @_;
40 $path =~ s|\\|/|g;
41 return $self->SUPER::canonpath($path);
42}
43
07824bd1
JH
44=pod
45
46=item file_name_is_absolute
47
48True is returned if the file name begins with C<drive_letter:>,
49and if not, File::Spec::Unix file_name_is_absolute() is called.
50
51=cut
52
53
3ed25742
GN
54sub file_name_is_absolute {
55 my ($self,$file) = @_;
56 return 1 if $file =~ m{^([a-z]:)?[\\/]}is; # C:/test
57 return $self->SUPER::file_name_is_absolute($file);
58}
59
07824bd1 60=item tmpdir (override)
f534ab20 61
07824bd1
JH
62Returns a string representation of the first existing directory
63from the following list:
ecf68df6 64
07824bd1
JH
65 $ENV{TMPDIR}
66 /tmp
67 C:/temp
ecf68df6 68
07824bd1
JH
69Since Perl 5.8.0, if running under taint mode, and if the environment
70variables are tainted, they are not used.
ecf68df6 71
07824bd1 72=cut
ecf68df6 73
07824bd1
JH
74my $tmpdir;
75sub tmpdir {
76 return $tmpdir if defined $tmpdir;
77 my $self = shift;
78 $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' );
79}
ecf68df6 80
07824bd1 811;