Commit | Line | Data |
---|---|---|
fa6a1c44 OF |
1 | package File::Spec::Epoc; |
2 | ||
3 | use strict; | |
07824bd1 JH |
4 | use vars qw($VERSION @ISA); |
5 | ||
e0580a69 | 6 | $VERSION = '3.45_01'; |
3d2a0adf | 7 | $VERSION =~ tr/_//; |
07824bd1 | 8 | |
fa6a1c44 OF |
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 | |
483ad829 | 23 | there. This package overrides the implementation of these methods, not |
fa6a1c44 OF |
24 | the semantics. |
25 | ||
483ad829 | 26 | This package is still a work in progress. ;-) |
fa6a1c44 | 27 | |
e021ab8e | 28 | =cut |
fa6a1c44 | 29 | |
fa6a1c44 OF |
30 | sub case_tolerant { |
31 | return 1; | |
32 | } | |
33 | ||
e021ab8e JH |
34 | =pod |
35 | ||
36 | =over 4 | |
37 | ||
59605c55 | 38 | =item canonpath() |
fa6a1c44 OF |
39 | |
40 | No physical check on the filesystem, but a logical cleanup of a | |
483ad829 | 41 | path. On UNIX eliminated successive slashes and successive "/.". |
fa6a1c44 | 42 | |
e021ab8e JH |
43 | =back |
44 | ||
fa6a1c44 OF |
45 | =cut |
46 | ||
47 | sub canonpath { | |
48 | my ($self,$path) = @_; | |
bf7c0a3d | 49 | return unless defined $path; |
fa6a1c44 | 50 | |
2585f9a3 | 51 | $path =~ s|/+|/|g; # xx////xx -> xx/xx |
fa6a1c44 OF |
52 | $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx |
53 | $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx | |
54 | $path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx | |
2585f9a3 | 55 | $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx |
fa6a1c44 OF |
56 | return $path; |
57 | } | |
58 | ||
72f15715 T |
59 | =pod |
60 | ||
99f36a73 RGS |
61 | =head1 AUTHOR |
62 | ||
63 | o.flebbe@gmx.de | |
64 | ||
65 | =head1 COPYRIGHT | |
66 | ||
67 | Copyright (c) 2004 by the Perl 5 Porters. All rights reserved. | |
68 | ||
69 | This program is free software; you can redistribute it and/or modify | |
70 | it under the same terms as Perl itself. | |
71 | ||
fa6a1c44 OF |
72 | =head1 SEE ALSO |
73 | ||
72f15715 T |
74 | See L<File::Spec> and L<File::Spec::Unix>. This package overrides the |
75 | implementation of these methods, not the semantics. | |
fa6a1c44 OF |
76 | |
77 | =cut | |
78 | ||
79 | 1; |