[perl #8599] s/catenate/concatenate/
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / Epoc.pm
1 package File::Spec::Epoc;
2
3 use strict;
4 use Cwd;
5 use vars qw($VERSION @ISA);
6
7 $VERSION = '1.1';
8
9 require File::Spec::Unix;
10 @ISA = qw(File::Spec::Unix);
11
12 =head1 NAME
13
14 File::Spec::Epoc - methods for Epoc file specs
15
16 =head1 SYNOPSIS
17
18  require File::Spec::Epoc; # Done internally by File::Spec if needed
19
20 =head1 DESCRIPTION
21
22 See File::Spec::Unix for a documentation of the methods provided
23 there. This package overrides the implementation of these methods, not
24 the semantics.
25
26 This package is still work in progress ;-)
27 o.flebbe@gmx.de
28
29
30 =over 4
31
32 sub case_tolerant {
33     return 1;
34 }
35
36 =item canonpath()
37
38 No physical check on the filesystem, but a logical cleanup of a
39 path. On UNIX eliminated successive slashes and successive "/.".
40
41 =cut
42
43 sub canonpath {
44     my ($self,$path) = @_;
45
46     $path =~ s|/+|/|g;                             # xx////xx  -> xx/xx
47     $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
48     $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
49     $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
50     $path =~  s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
51     return $path;
52 }
53
54 =back
55
56 =head1 SEE ALSO
57
58 L<File::Spec>
59
60 =cut
61
62 1;