delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/24/20:29:56

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4A6A51EC.3020509@bobsbits.net>
Date: Fri, 24 Jul 2009 20:29:32 -0400
From: bob davis <bob AT bobsbits DOT net>
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
MIME-Version: 1.0
To: Reini Urban <rurban AT x-ray DOT at>
CC: cygwin AT cygwin DOT com
Subject: Re: cygwin 1.7 and perl Fcntl.pm and Touch.pm
References: <4046 DOT 12 DOT 105 DOT 86 DOT 170 DOT 1248381402 DOT squirrel AT bobsbits DOT net> <6910a60907241153ue99dc0cuc9558de6849d4ba8 AT mail DOT gmail DOT com>
In-Reply-To: <6910a60907241153ue99dc0cuc9558de6849d4ba8@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com


Reini Urban wrote:
>> installed cygwin 1.7
>>
>> bob AT 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 AT 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 AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019