This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
whichsig() really does return -1 for unknown signals.
[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
7$VERSION = '1.0';
8
9@ISA = qw(File::Spec::Unix);
10
11sub canonpath {
12 my($self,$path) = @_;
13 $path =~ s|\\|/|g;
14 return $self->SUPER::canonpath($path);
15}
16
3ed25742
GN
17sub file_name_is_absolute {
18 my ($self,$file) = @_;
19 return 1 if $file =~ m{^([a-z]:)?[\\/]}is; # C:/test
20 return $self->SUPER::file_name_is_absolute($file);
21}
22
f534ab20
JH
23my $tmpdir;
24sub tmpdir {
25 return $tmpdir if defined $tmpdir;
26 my @dirlist = ($ENV{TMPDIR}, "/tmp", 'C:/temp');
27 {
28 no strict 'refs';
29 if (${"\cTAINT"}) { # Check for taint mode on perl >= 5.8.0
30 require Scalar::Util;
31 shift @dirlist if Scalar::Util::tainted($ENV{TMPDIR});
32 }
33 }
34 foreach (@dirlist) {
35 next unless defined && -d && -w _;
36 $tmpdir = $_;
37 last;
38 }
9ceb3593 39 $tmpdir = File::Spec->curdir unless defined $tmpdir;
f534ab20
JH
40 return $tmpdir;
41}
42
ecf68df6
DR
431;
44__END__
45
46=head1 NAME
47
48File::Spec::Cygwin - methods for Cygwin file specs
49
50=head1 SYNOPSIS
51
52 require File::Spec::Cygwin; # Done internally by File::Spec if needed
53
54=head1 DESCRIPTION
55
56See File::Spec::Unix for a documentation of the methods provided
57there. This package overrides the implementation of these methods, not
58the semantics.
59
60This module is still in beta. Cygwin-knowledgeable folks are invited
61to offer patches and suggestions.