On Thu, Mar 04, 2004 at 09:22:46AM -0800, Daniel L. Rall wrote:
> Colin Watson wrote:
> >On Tue, Mar 02, 2004 at 11:57:49PM -0600, kfogel@collab.net wrote:
> >> +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;'?
I'm not quite sure what you mean (wouldn't that weaken the
requirement?), but indeed it occurs to me that with 'use warnings;' the
require is almost useless:
$ perl -MConfig -le 'print $Config{version}'
5.00503
$ perl -e 'require 5.6.0; use warnings;'
Can't locate warnings.pm 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.
The require should probably be in a BEGIN block.
--
Colin Watson [cjwatson@flatline.org.uk]
---------------------------------------------------------------------
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:26:38 2004