This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygwin 1.7 and perl Fcntl.pm and Touch.pm
- From: Reini Urban <rurban at x-ray dot at>
- To: cygwin at cygwin dot com, bob at bobsbits dot net, nwetters at cpan dot org
- Date: Fri, 24 Jul 2009 20:53:50 +0200
- Subject: Re: cygwin 1.7 and perl Fcntl.pm and Touch.pm
- References: <4046.12.105.86.170.1248381402.squirrel@bobsbits.net>
> installed cygwin 1.7
>
> bob@davisrs/c/src654$ cygcheck -c cygwin
> Cygwin Package Information
> Package ? ? ? ? ? ? ?Version ? ? ? ?Status
> cygwin ? ? ? ? ? ? ? 1.7.0-51 ? ? ? OK
>
> used cpan to install File::Touch
>
> The install fails from what appears to be an error with this module:
>
> bob@davisrs/c/src654$ perl -MFcntl -e ' print $Fcntl::{"O_NONBLOCK"}, "\n" '
> SCALAR(0x100c22a0)
Hmm, this looks like an incorrect usage of the Fcntl exported constants.
Perl constants are subs and not scalars.
The right usage would be:
perl -MFcntl -le ' print O_NONBLOCK'
-l is a trick to add \n to every output line.
and this is 16384 on 1.5 and 1.7 with all perl's I have.
perl -MFcntl -le ' print &O_NONBLOCK'
> Whereas on a cygwin 1.5 system this produces:
> bob@davisrs1~$ perl -MFcntl -e ' print $Fcntl::{"O_NONBLOCK"}, "\n"'
> *Fcntl::O_NONBLOCK
This is perl-5.8 specific and not cygwin-1.5.
The idea is this:
This is the internal typeglob for the O_NONBLOCK symbol in the Fcntl
package namespace.
&{ $Fcntl::{'O_NONBLOCK'} } uses the sub of this typeglob, which
results in 16384.
Using &{ $Fcntl::{'O_NONBLOCK'} } ensures that the definition of O_NONBLOCK is
checked and not the value, e.g. if O_NONBLOCK would be 0.
But the perl-5.10 Exporter was improved and therefore $Fcntl::{'O_NONBLOCK'}
autovivifies to a scalar, without any coderef. So it fails.
> The failing line(s) in touch.pm is:
>
> eval {
> ? ?$SYSOPEN_MODE |= &{ $Fcntl::{'O_NONBLOCK'} };
> };
> if($@) {
> ? ?if($@ =~ /Your vendor has not defined/) {
> ? ? ? ?# probably running on Windows.
> ? ?} else {
> ? ? ? ?die "$@"; # Rethrow exception, must be something different
> ? ?}
The next failure with this module are two wrong MacOS X files in the distro
._Makefile.PL and ._test.pl with binary garbage causing
Writing Makefile for File::Touch
(/usr/bin/perl Makefile.PL exited with 0)
CPAN::Reporter: Makefile.PL result is 'pass', No errors.
cp ._test.pl blib/lib/File/._test.pl
cp Touch.pm blib/lib/File/Touch.pm
Manifying blib/man3/File.Touch.3pm
/usr/bin/perl.exe "-Iblib/arch" "-Iblib/lib" ._Makefile.PL ._Makefile
Unrecognized character \x05 in column 2 at ._Makefile.PL line 1.
make: *** [._Makefile] Error 255
(/usr/bin/make exited with 512)
go to ~/.cpan/build/File-Touch-0.06-*
rm ._*
change the two lines of
$SYSOPEN_MODE |= &{ $Fcntl::{'O_NONBLOCK'} }
to
$SYSOPEN_MODE |= O_NONBLOCK
perl Makefile.PL
make
make test install clean
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple