xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/File/Spec/Epoc.pm (revision 0:68f95e015346)
1*0Sstevel@tonic-gatepackage File::Spec::Epoc;
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse strict;
4*0Sstevel@tonic-gateuse vars qw($VERSION @ISA);
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gate$VERSION = '1.1';
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gaterequire File::Spec::Unix;
9*0Sstevel@tonic-gate@ISA = qw(File::Spec::Unix);
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gate=head1 NAME
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gateFile::Spec::Epoc - methods for Epoc file specs
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gate=head1 SYNOPSIS
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gate require File::Spec::Epoc; # Done internally by File::Spec if needed
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gate=head1 DESCRIPTION
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gateSee File::Spec::Unix for a documentation of the methods provided
22*0Sstevel@tonic-gatethere. This package overrides the implementation of these methods, not
23*0Sstevel@tonic-gatethe semantics.
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gateThis package is still work in progress ;-)
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate=head1 AUTHORS
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateo.flebbe@gmx.de
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate=cut
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gatesub case_tolerant {
34*0Sstevel@tonic-gate    return 1;
35*0Sstevel@tonic-gate}
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gate=pod
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate=over 4
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gate=item canonpath()
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gateNo physical check on the filesystem, but a logical cleanup of a
44*0Sstevel@tonic-gatepath. On UNIX eliminated successive slashes and successive "/.".
45*0Sstevel@tonic-gate
46*0Sstevel@tonic-gate=back
47*0Sstevel@tonic-gate
48*0Sstevel@tonic-gate=cut
49*0Sstevel@tonic-gate
50*0Sstevel@tonic-gatesub canonpath {
51*0Sstevel@tonic-gate    my ($self,$path) = @_;
52*0Sstevel@tonic-gate
53*0Sstevel@tonic-gate    $path =~ s|/+|/|g;                             # xx////xx  -> xx/xx
54*0Sstevel@tonic-gate    $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
55*0Sstevel@tonic-gate    $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
56*0Sstevel@tonic-gate    $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
57*0Sstevel@tonic-gate    $path =~  s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
58*0Sstevel@tonic-gate    return $path;
59*0Sstevel@tonic-gate}
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gate=pod
62*0Sstevel@tonic-gate
63*0Sstevel@tonic-gate=head1 SEE ALSO
64*0Sstevel@tonic-gate
65*0Sstevel@tonic-gateSee L<File::Spec> and L<File::Spec::Unix>.  This package overrides the
66*0Sstevel@tonic-gateimplementation of these methods, not the semantics.
67*0Sstevel@tonic-gate
68*0Sstevel@tonic-gate=cut
69*0Sstevel@tonic-gate
70*0Sstevel@tonic-gate1;
71