catfi" /> catfi" /> catfi"/>

Why is File::Spec dropping './' on files in sub directories?

70 views Asked by At

File::Spec is a core module to "portably perform operations on file names". This behavior makes perfect sense to me,

# returns ./foo
File::Spec->catfile(".", "foo");

However, this has my mind boggled.

# returns foo/bar
File::Spec->catfile(File::Spec->catfile(".", "foo"), "bar");
File::Spec->catfile("./foo", "bar");

For a library that supposed to standardize this stuff, why is my ./ gone? Is there a reason for this behavior?

Just weird to have this returned,

CP-JobApp/t/lib/Testing.pm
CP-JobApp/t/pod.t
CP-JobApp/t/find.t
./h
./problem1.pl

Is it normal to post-process file names the module returns?

1

There are 1 answers

0
ikegami On BEST ANSWER

File::Spec::Unix canonizes the directory part of the path.

Why doesn't it canoninize the whole path (so that catfile('.', 'file') produces file)? No idea. This seems like an oversight to me. Feel free to file a bug report.