develooper Front page | perl.perl5.porters | Postings from January 2009

Re: S_IFLNK() Availability on Win32 (and other non-UNIX systems)

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
January 14, 2009 01:29
Subject:
Re: S_IFLNK() Availability on Win32 (and other non-UNIX systems)
Message ID:
b77c1dce0901140129h20bb1468ld2b8bd68eacad345@mail.gmail.com
2009/1/14 Shlomi Fish <shlomif@iglu.org.il>:
> Hi all,
>
> I recently uploaded File-Find-Object-0.1.6 to CPAN and got this errror report
> on MSWin32:
>
> http://www.nntp.perl.org/group/perl.cpan.testers/2009/01/msg3039451.html
>
> Reading from there, we see the following:
>
> {{{
> Your vendor has not defined Fcntl macro S_IFLNK, used at C:/Perl/lib/Fcntl.pm
> line 214.
> # Looks like you planned 3 tests but ran 2.
> # Looks like your test exited with 255 just after 2.
>  Dubious, test returned 255 (wstat 65280, 0xff00)
>  Failed 1/3 subtests
> }}}
>
> This appears multiple times for each test script. The reason it happens is
> that instead of doing -l / -d / -f / etc. I just do one stat() and then use
> S_IFLNK() from Fcntl on the mode field of stat (the one with index 2). (To
> save on system calls).

What's wrong with using _ instead ?

> Obviously, it doesn't work on Windows at that report. My questions are:
>
> 1. Can I ever expect it to work on Windows?

Dunno. Does Windows 7 implement symbolic links ? I think that's
unlikely.

> 2. Is it fixed on perl-5.8.9 or perl-5.10.0 there?

What do you mean, fixed ? If the OS doesn't support S_IFLNK, you can't
use it. That's not a bug.

> 3. The error report seems to come from ActivePerl (or otherwise a Perl that
> was built using MS DevStudio). Does S_IFLNK work better on Mingw32-based
> Perls?

I bet it doesn't, since the libc won't support it anyway. Maybe on
cygwin there's some kind of compatibility layer ?

> 4. Why doesn't Perl do the right thing with this macro, like it does using -l.

Because you're using a low level API, comparable to using POSIX.pm for
example : it tries to be close to your libc, to enable you to do
difficult things.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About