Cleanup the File::Spec tmpdir() implementations:
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / Epoc.pm
CommitLineData
fa6a1c44 1package File::Spec::Epoc;
2
3use strict;
4use Cwd;
07824bd1 5use vars qw($VERSION @ISA);
6
7$VERSION = '1.1';
8
fa6a1c44 9require File::Spec::Unix;
10@ISA = qw(File::Spec::Unix);
11
12=head1 NAME
13
14File::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
22See File::Spec::Unix for a documentation of the methods provided
23there. This package overrides the implementation of these methods, not
24the semantics.
25
26This package is still work in progress ;-)
27o.flebbe@gmx.de
28
29
4ac9195f 30=over 4
fa6a1c44 31
fa6a1c44 32sub case_tolerant {
33 return 1;
34}
35
59605c55 36=item canonpath()
fa6a1c44 37
38No physical check on the filesystem, but a logical cleanup of a
39path. On UNIX eliminated successive slashes and successive "/.".
40
41=cut
42
43sub 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
58L<File::Spec>
59
60=cut
61
621;