Perl package File::Spec confused under cygwin
Fri Dec 20 14:54:00 GMT 2002
On Fri, 20 Dec 2002 21:27:50 GMT, "linda w \(cyg\)" <email@example.com>
wrote in news:firstname.lastname@example.org:
> File::Spec is supposed to provide a OS independent way of parsing and
> creating pathnames. For example, a 'splitpath' can product a volume
> $dir and $file.
> I'm not sure what constitutes a volume but I'd think C: D: would count
> as separate.
> Under cygwin, it only handles/parses unix pathnames but not native
> windows pathnames 'c:\windows\filename' will yield a vol='', dir='' and
> filename='d:\windows\filelname' -- not what one would expect. Using
> forward slashes yields: vdf='', 'd:/windows/,'filename'.
> Further use to break down the directory path into components would
> yield D: as a first directory and 'windows' as a 2nd level dir.
> Note that the forward slash has now disappeared indicating what I believe
> to be improper symantics as d:windows != D:\windows unless d:'s curdir
> is = to the root dir.
By this point, you are looking WAY to hard in the wrong direction.
> Guess when the module detects the OS type, it needs to have a separate
> type for the cygwin environment.
This is why I wrote a module specific to Cygwin and how it handles
pathels (path elELEMENTs) and file specs. Or doesn't.
What you expected File::Spec to do perhaps seemed intuitive and natural,
but in fact the situation on Cygwin is kind of unprecedented and no, Perl
hasn't been "ported" to Cygwin to THAT degree. The fact is it is a pretty
complex set of issues.
First of all, the $^O (Eng: $OS_NAME) on CygwinPerl is *not* 'MSWin32'. You
need to be clear on that because if you rtfm the File::Spec module you'll
see that it matters. The value of $^O on Cygwin is "cygwin". Because Cygwin
perl is not Win32 perl, it is a hardly-changed vanilla Unix Perl.
On Cygwin we have a possibility to access files on the local filesystem (as
distinguished from any sort of "remoteness") via two different "modes": the
correct "cygwin" mode which is otherwise knows as the POSIX filesystem; and
the completely different Win32 mode. Never the twain shall meet. They are
fundamentally incompatible, as a little thought will show to anyone who
ponders it (and many have).
The module I wrote, which is in existence as a pre-release on CPAN but
hasn't been officially Registered in its namespace, is
Filesys::CygwinPaths. Look in the Authors directory of CPAN under my
CPAN id, SOMIAN, or search on search.cpan.org (new pre-releases have
shown up in the daily roundup, to my surprise).
If you go back and rtfm on File::Spec and still cannot get the tools you
are looking to get, then my module almost undoubtedly addresses your
need. Whether you'll enjoy using it or find it pretty is another
Yes, it's really SÃ¶ren, not Soren.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
More information about the Cygwin