Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: rel2abs doesn't resolve relative paths?

by halley (Prior)
on Jun 05, 2003 at 15:31 UTC ( [id://263374]=note: print w/replies, xml ) Need Help??


in reply to rel2abs doesn't resolve relative paths?

The definition of "absolute" just means it starts with a slash. Some people refer to your intended result as a "canonical" path, and removing all backtracking as the "canonicalization" of a path. There are other elements to canonicalization, such as discovering aliased mount points or symlinks.

Perhaps something like this will work for you.

1 while ($path =~ s{ [^/]+ / \.\. / }{}x);

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: rel2abs doesn't resolve relative paths?
by tye (Sage) on Jun 05, 2003 at 15:36 UTC

    And it is too bad that canonpath from File::Spec doesn't do even this (based on my testing on two systems, one Unix, one Win32).

                    - tye

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://263374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-25 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found