Commit | Line | Data |
fa6a1c44 |
1 | package File::Spec::Epoc; |
2 | |
8de1277c |
3 | our $VERSION = '1.00'; |
4 | |
fa6a1c44 |
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 | |
4ac9195f |
29 | =over 4 |
fa6a1c44 |
30 | |
fa6a1c44 |
31 | sub case_tolerant { |
32 | return 1; |
33 | } |
34 | |
59605c55 |
35 | =item canonpath() |
fa6a1c44 |
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) = @_; |
fa6a1c44 |
44 | |
2585f9a3 |
45 | $path =~ s|/+|/|g; # xx////xx -> xx/xx |
fa6a1c44 |
46 | $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx |
47 | $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx |
48 | $path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx |
2585f9a3 |
49 | $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx |
fa6a1c44 |
50 | return $path; |
51 | } |
52 | |
fa6a1c44 |
53 | =back |
54 | |
55 | =head1 SEE ALSO |
56 | |
57 | L<File::Spec> |
58 | |
59 | =cut |
60 | |
61 | 1; |