Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Injected-Via-Gmane: http://gmane.org/ To: cygwin AT cygwin DOT com Path: not-for-mail From: Soren A Subject: Re: Perl package File::Spec confused under cygwin Date: Fri, 20 Dec 2002 22:05:35 +0000 (UTC) Organization: Sporadically Occasionally Lines: 65 Message-ID: References: <001b01c2a86e$a5da95f0$1403a8c0 AT sc DOT tlinx DOT org> X-Complaints-To: usenet AT main DOT gmane DOT org User-Agent: Xnews/5.04.25 X-Archive: encrypt On Fri, 20 Dec 2002 21:27:50 GMT, "linda w \(cyg\)" wrote in news:001b01c2a86e$a5da95f0$1403a8c0 AT sc DOT tlinx DOT 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. Linda, 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 question entirely. Regards, Soren A -- Yes, it's really Sören, not Soren. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/