Update to File::Spec 0.90
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / Epoc.pm
CommitLineData
fa6a1c44 1package File::Spec::Epoc;
2
3use strict;
07824bd1 4use vars qw($VERSION @ISA);
5
6$VERSION = '1.1';
7
fa6a1c44 8require File::Spec::Unix;
9@ISA = qw(File::Spec::Unix);
10
11=head1 NAME
12
13File::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
21See File::Spec::Unix for a documentation of the methods provided
22there. This package overrides the implementation of these methods, not
23the semantics.
24
25This package is still work in progress ;-)
fa6a1c44 26
e021ab8e 27=head1 AUTHORS
fa6a1c44 28
e021ab8e 29o.flebbe@gmx.de
30
31=cut
fa6a1c44 32
fa6a1c44 33sub case_tolerant {
34 return 1;
35}
36
e021ab8e 37=pod
38
39=over 4
40
59605c55 41=item canonpath()
fa6a1c44 42
43No physical check on the filesystem, but a logical cleanup of a
44path. On UNIX eliminated successive slashes and successive "/.".
45
e021ab8e 46=back
47
fa6a1c44 48=cut
49
50sub canonpath {
51 my ($self,$path) = @_;
fa6a1c44 52
2585f9a3 53 $path =~ s|/+|/|g; # xx////xx -> xx/xx
fa6a1c44 54 $path =~ s|(/\.)+/|/|g; # xx/././xx -> xx/xx
55 $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx
56 $path =~ s|^/(\.\./)+|/|s; # /../../xx -> xx
2585f9a3 57 $path =~ s|/\Z(?!\n)|| unless $path eq "/"; # xx/ -> xx
fa6a1c44 58 return $path;
59}
60
72f15715 61=pod
62
fa6a1c44 63=head1 SEE ALSO
64
72f15715 65See L<File::Spec> and L<File::Spec::Unix>. This package overrides the
66implementation of these methods, not the semantics.
fa6a1c44 67
68=cut
69
701;