Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | package File::Spec::Epoc; |
2 | ||
3 | our $VERSION = '1.00'; | |
4 | ||
5 | use strict; | |
6 | use Cwd; | |
7 | use vars qw(@ISA); | |
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 | o.flebbe@gmx.de | |
27 | ||
28 | ||
29 | =over 4 | |
30 | ||
31 | sub case_tolerant { | |
32 | return 1; | |
33 | } | |
34 | ||
35 | =item canonpath() | |
36 | ||
37 | No physical check on the filesystem, but a logical cleanup of a | |
38 | path. On UNIX eliminated successive slashes and successive "/.". | |
39 | ||
40 | =cut | |
41 | ||
42 | sub canonpath { | |
43 | my ($self,$path) = @_; | |
44 | ||
45 | $path =~ s|/+|/|g; # xx////xx -> xx/xx | |
46 | $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx | |
47 | $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx | |
48 | $path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx | |
49 | $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx | |
50 | return $path; | |
51 | } | |
52 | ||
53 | =back | |
54 | ||
55 | =head1 SEE ALSO | |
56 | ||
57 | L<File::Spec> | |
58 | ||
59 | =cut | |
60 | ||
61 | 1; |