slightly edited version of suggested patch
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / OS2.pm
CommitLineData
270d1e39 1package File::Spec::OS2;
2
270d1e39 3use strict;
270d1e39 4use vars qw(@ISA);
cbc7acb0 5require File::Spec::Unix;
270d1e39 6@ISA = qw(File::Spec::Unix);
7
cbc7acb0 8sub devnull {
9 return "/dev/nul";
10}
270d1e39 11
12sub file_name_is_absolute {
cbc7acb0 13 my ($self,$file) = @_;
14 return scalar($file =~ m{^([a-z]:)?[\\/]}i);
270d1e39 15}
16
17sub path {
270d1e39 18 my $path = $ENV{PATH};
19 $path =~ s:\\:/:g;
cbc7acb0 20 my @path = split(';',$path);
21 foreach (@path) { $_ = '.' if $_ eq '' }
22 return @path;
270d1e39 23}
24
cbc7acb0 25my $tmpdir;
26sub tmpdir {
27 return $tmpdir if defined $tmpdir;
28 my $self = shift;
29 foreach (@ENV{qw(TMPDIR TEMP TMP)}, qw(/tmp /)) {
30 next unless defined && -d;
31 $tmpdir = $_;
32 last;
33 }
34 $tmpdir = '' unless defined $tmpdir;
35 $tmpdir =~ s:\\:/:g;
36 $tmpdir = $self->canonpath($tmpdir);
37 return $tmpdir;
99804bbb 38}
39
270d1e39 401;
41__END__
42
43=head1 NAME
44
45File::Spec::OS2 - methods for OS/2 file specs
46
47=head1 SYNOPSIS
48
cbc7acb0 49 require File::Spec::OS2; # Done internally by File::Spec if needed
270d1e39 50
51=head1 DESCRIPTION
52
53See File::Spec::Unix for a documentation of the methods provided
54there. This package overrides the implementation of these methods, not
55the semantics.