1*0Sstevel@tonic-gatepackage File::Spec::Cygwin; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateuse strict; 4*0Sstevel@tonic-gateuse vars qw(@ISA $VERSION); 5*0Sstevel@tonic-gaterequire File::Spec::Unix; 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gate$VERSION = '1.1'; 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate@ISA = qw(File::Spec::Unix); 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate=head1 NAME 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gateFile::Spec::Cygwin - methods for Cygwin file specs 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate=head1 SYNOPSIS 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate require File::Spec::Cygwin; # Done internally by File::Spec if needed 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate=head1 DESCRIPTION 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gateSee L<File::Spec> and L<File::Spec::Unix>. This package overrides the 22*0Sstevel@tonic-gateimplementation of these methods, not the semantics. 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gateThis module is still in beta. Cygwin-knowledgeable folks are invited 25*0Sstevel@tonic-gateto offer patches and suggestions. 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate=cut 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate=pod 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate=over 4 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate=item canonpath 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gateAny C<\> (backslashes) are converted to C</> (forward slashes), 36*0Sstevel@tonic-gateand then File::Spec::Unix canonpath() is called on the result. 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate=cut 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gatesub canonpath { 41*0Sstevel@tonic-gate my($self,$path) = @_; 42*0Sstevel@tonic-gate $path =~ s|\\|/|g; 43*0Sstevel@tonic-gate return $self->SUPER::canonpath($path); 44*0Sstevel@tonic-gate} 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate=pod 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate=item file_name_is_absolute 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gateTrue is returned if the file name begins with C<drive_letter:>, 51*0Sstevel@tonic-gateand if not, File::Spec::Unix file_name_is_absolute() is called. 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate=cut 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gatesub file_name_is_absolute { 57*0Sstevel@tonic-gate my ($self,$file) = @_; 58*0Sstevel@tonic-gate return 1 if $file =~ m{^([a-z]:)?[\\/]}is; # C:/test 59*0Sstevel@tonic-gate return $self->SUPER::file_name_is_absolute($file); 60*0Sstevel@tonic-gate} 61*0Sstevel@tonic-gate 62*0Sstevel@tonic-gate=item tmpdir (override) 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gateReturns a string representation of the first existing directory 65*0Sstevel@tonic-gatefrom the following list: 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate $ENV{TMPDIR} 68*0Sstevel@tonic-gate /tmp 69*0Sstevel@tonic-gate C:/temp 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gateSince Perl 5.8.0, if running under taint mode, and if the environment 72*0Sstevel@tonic-gatevariables are tainted, they are not used. 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate=cut 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gatemy $tmpdir; 77*0Sstevel@tonic-gatesub tmpdir { 78*0Sstevel@tonic-gate return $tmpdir if defined $tmpdir; 79*0Sstevel@tonic-gate my $self = shift; 80*0Sstevel@tonic-gate $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' ); 81*0Sstevel@tonic-gate} 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate=back 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate=cut 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate1; 88