[Israel.pm] abs_path vs. rel2abs

Yuval Yaari yuval at windax.com
Thu Feb 10 11:23:13 PST 2005


Offer Kaye wrote:

>Hi,
>What is the difference between abs_path from the Cwd module and
>rel2abs from the File::Spec module? Their descriptions make them sound
>the same, but rel2abs didn't seem to do what I thought it should do,
>which is what abs_path turns out to do.
>
>Sorry if I confused you, I'm confused myself... :-)
>  
>
rel2abs can get a 2nd argument - base path (and uses cwd as default).
The 2nd argument is also converted using rel2base.

Another thing (citing the docs for rel2base, $path is the first argument):
<CITE>
If $path is absolute, it is cleaned up and returned using "canonpath()".
</CITE>

So as minor as it may be, there is a difference.

  --Yuval




More information about the Perl mailing list