home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / lib / File / Spec / OS2.pm < prev    next >
Text File  |  2000-02-28  |  1KB  |  60 lines

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