[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: question about r8708 (Perl warning pragmas)

From: Daniel L. Rall <dlr_at_collab.net>
Date: 2004-03-04 18:22:46 CET

Colin Watson wrote:
> On Tue, Mar 02, 2004 at 11:57:49PM -0600, kfogel@collab.net wrote:
>
>>r8708 applies a patch like this to three Perl hook scripts:
>>
>> -# The warning switch is set here and not in the shebang line above
>> -# with /usr/bin/env because env will try to find the binary named
>> -# 'perl -w', which won't work.
>> -BEGIN
>> - {
>> - $^W = 1;
>> - }
>> -
>> +require 5.6.0; # minimum Perl version for "warnings" module
>> +use warnings;
>>
>>Some time ago, Ben Collins-Sussman and I looked at this and wondered
>>why the "require 5.6.0;" line wasn't controversial.
>
>
> For an entirely separate reason than the version requirement itself,
> 'require 5.6.0;' isn't a very good idea. Here's why:
>
> $ perl -MConfig -le 'print $Config{version}'
> 5.00503
> $ perl -e 'require 5.6.0;'
> Can't locate 5.60 in @INC (@INC contains: /usr/lib/perl5/5.005/i386-linux /usr/lib/perl5/5.005 /usr/local/lib/site_perl/i386-linux /usr/local/lib/site_perl /usr/lib/perl5 .) at -e line 1.
> $ perl -e 'require 5.006;'
> Perl 5.006 required--this is only version 5.00503, stopped at -e line 1.
>
> Versions older than 5.6.0 didn't understand the "5.6.0" syntax for
> versions, so you should use the "5.006" form instead. Both will fail,
> but the former gives a very confusing and misleading error message.

Alternatively, could the 'use warnings;' (the reason for the 'require 5.6.0;')
be wrapped in an eval {} to provide the equivalent of 'require 5.6.0;'?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 4 18:21:49 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.