http://qs321.pair.com?node_id=690403


in reply to CPAN Module for mixing Unix/Windows path

Path::Class, which you've already looked at, actually seems like a good one. It conveniently has the new_foreign and as_foreign methods. So you can do

use Path::Class; my $path = dir($from_outside)->as_foreign('Unix');
and $path will be Unix style. So if you normalize your paths, i.e. consistantly make your paths into the same type, when you first see them you don't have to worry about it later on. Everything will Just Work. If you know that a path from outside is of a non-native type you can use foreign_dir($type, $path) instead.

Nowadays I pretty much only use Path::Class instead of File::Spec because path manipulation quickly gets dirty and Path::Class has handy methods, while retaining a good control of what's what regarding file system type and file/dir.

lodin