home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _2ca133a1ed72abd256a13db74c70c370 < prev    next >
Text File  |  2004-06-01  |  1KB  |  71 lines

  1. package File::Spec::Epoc;
  2.  
  3. use strict;
  4. use vars qw($VERSION @ISA);
  5.  
  6. $VERSION = '1.1';
  7.  
  8. require File::Spec::Unix;
  9. @ISA = qw(File::Spec::Unix);
  10.  
  11. =head1 NAME
  12.  
  13. File::Spec::Epoc - methods for Epoc file specs
  14.  
  15. =head1 SYNOPSIS
  16.  
  17.  require File::Spec::Epoc; # 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 package is still work in progress ;-)
  26.  
  27. =head1 AUTHORS
  28.  
  29. o.flebbe@gmx.de
  30.  
  31. =cut
  32.  
  33. sub case_tolerant {
  34.     return 1;
  35. }
  36.  
  37. =pod
  38.  
  39. =over 4
  40.  
  41. =item canonpath()
  42.  
  43. No physical check on the filesystem, but a logical cleanup of a
  44. path. On UNIX eliminated successive slashes and successive "/.".
  45.  
  46. =back
  47.  
  48. =cut
  49.  
  50. sub canonpath {
  51.     my ($self,$path) = @_;
  52.  
  53.     $path =~ s|/+|/|g;                             # xx////xx  -> xx/xx
  54.     $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
  55.     $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
  56.     $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
  57.     $path =~  s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
  58.     return $path;
  59. }
  60.  
  61. =pod
  62.  
  63. =head1 SEE ALSO
  64.  
  65. See L<File::Spec> and L<File::Spec::Unix>.  This package overrides the
  66. implementation of these methods, not the semantics.
  67.  
  68. =cut
  69.  
  70. 1;
  71.