cygwin 1.7 and perl Fcntl.pm and Touch.pm

bob davis bob@bobsbits.net
Sun Jul 26 10:35:00 GMT 2009



Reini Urban wrote:
>> 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
>
>   

Hey thanks reini.
It worked great.
So to summarize it wasnt a cygwin 1.7 bug it was a perl 5.8 vs perl 5.10
I am a little rusty to with typeglobs so I didnt understand what 
Fcntl.pm was doing. Plus it looks like all the work was being done in 
the dll.

thanks again
bob

p.s. I just got a new work laptop and I decided to go with new stuff. 
Cygwin and all my perl utils have been giving me trouble. Also I went 
with vim 7.2 vs 7.1 and now I have network file editing slowness. I 
tracked down one slow down to matchparen.vim and disabled it but there 
still seems to be something else. Wrong list to complain in I guess.


--
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



More information about the Cygwin mailing list