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