in reply to How to get a true canonical path

I use URI:

#!/usr/bin/perl use strict; use warnings; use URI; my $base_uri = URI->new( '/home/httpd/project/' ); while (my $path = <DATA>) { chomp($path); my $absolute = URI->new_abs( $path, $base_uri ); printf "%s + %s: %s\n", $base_uri->canonical, $path, $absolute->cano +nical; } __DATA__ ../another/ subdir/ ../../../etc/very/dangerous ../project/
update: it seems that I didn't understand the question, sorry.
update2: However, it seems that URI::file does understand OS differences and does what you want:
use URI::file; my $base_uri = URI::file->new( URI::file->cwd ); while (my $path = <DATA>) { chomp($path); my $absolute = URI::file->new_abs( $path, $base_uri ); printf "%s + %s: %s\n", $base_uri->canonical, $path, $absolute->file +; } __DATA__ ../another/ subdir/ ../../../some/other/place ../project/

HTH, Valerio