Up the F::S subpackage versions; up the JPL JNI.pm version
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / Cygwin.pm
1 package File::Spec::Cygwin;
2
3 use strict;
4 use vars qw(@ISA $VERSION);
5 require File::Spec::Unix;
6
7 $VERSION = '1.1';
8
9 @ISA = qw(File::Spec::Unix);
10
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
39 sub canonpath {
40     my($self,$path) = @_;
41     $path =~ s|\\|/|g;
42     return $self->SUPER::canonpath($path);
43 }
44
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
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
61 =item tmpdir (override)
62
63 Returns a string representation of the first existing directory
64 from the following list:
65
66     $ENV{TMPDIR}
67     /tmp
68     C:/temp
69
70 Since Perl 5.8.0, if running under taint mode, and if the environment
71 variables are tainted, they are not used.
72
73 =cut
74
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 }
81
82 1;