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 ;-) |
27 | o.flebbe@gmx.de |
28 | |
29 | |
4ac9195f |
30 | =over 4 |
fa6a1c44 |
31 | |
fa6a1c44 |
32 | sub case_tolerant { |
33 | return 1; |
34 | } |
35 | |
59605c55 |
36 | =item canonpath() |
fa6a1c44 |
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) = @_; |
fa6a1c44 |
45 | |
2585f9a3 |
46 | $path =~ s|/+|/|g; # xx////xx -> xx/xx |
fa6a1c44 |
47 | $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx |
48 | $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx |
49 | $path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx |
2585f9a3 |
50 | $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx |
fa6a1c44 |
51 | return $path; |
52 | } |
53 | |
fa6a1c44 |
54 | =back |
55 | |
56 | =head1 SEE ALSO |
57 | |
58 | L<File::Spec> |
59 | |
60 | =cut |
61 | |
62 | 1; |