Thread Welches Modul zum Pfade auflösen? (22 answers)
Opened by lichtkind at 2013-07-01 22:32

GUIfreund
 2013-07-03 13:47
#168713 #168713
User since
2011-08-08
559 Artikel
BenutzerIn
[default_avatar]
2013-07-01T20:32:02 lichtkind
kennt ihr etwas das mir
"project/editor/dev/sp1/kephra/lib/../../../sp3/Kephra/lib/Kephra.pm"
zu
"project/editor/dev/sp3/Kephra/lib/Kephra.pm"
auflöst. Hatte erwatet das canonpath von File::Spec das kann aber offensichtlich nicht.

Nein, das kann es nicht. In der Doku steht
Quote
canonpath

No physical check on the filesystem, but a logical cleanup of a path.

$cpath = File::Spec->canonpath( $path ) ;

Note that this does *not* collapse x/../y sections into y. This is by design. If /foo on your system is a symlink to /bar/baz, then /foo/../quux is actually /bar/quux, not /quux as a naive ../-removal would give you. If you want to do this kind of processing, you probably want Cwd's realpath() function to actually traverse the filesystem cleaning up paths like this.
Gruß
GUIfreund

View full thread Welches Modul zum Pfade auflösen?