Front page | perl.perl5.porters |
Postings from August 2001
Re: perlmodstyle take 2
Thread Previous
|
Thread Next
From:
Ronald J Kimball
Date:
August 12, 2001 07:56
Subject:
Re: perlmodstyle take 2
Message ID:
20010812105614.A675496@linguist.thayer.dartmouth.edu
On Sun, Aug 12, 2001 at 03:22:34AM -0400, Michael G Schwern wrote:
> On Sun, Aug 12, 2001 at 09:20:26AM +0200, Philip Newton wrote:
> > > Specify Perl version requirements with C<use>
>
> Foolish inconsitencies aside, you want to use require and the old
> version style for backwards compatibility. C<use VERSION> is a 5.6
> thing. So is 5.6.1. So if you say C<use 5.6> and someone with
> 5.005_03 runs it, it's a syntax error. Not much help.
>
> C<require 5.006_01> is the way to go.
>
That's only half right. You should avoid version strings, but you should
*not* write require rather than use. Consider the following:
#!perl
require 5.006_01;
use warnings;
__END__
#!perl
require 5.006_01;
use strict;
our $foo;
__END__
perl5.6.0 includes new features that, when utilized, will cause errors at
compile time in previous versions of Perl.
The only proper way to require a recent Perl version is:
use 5.006;
use 5.006_01;
Aside: Oddly, C<perl -e 'use 5.6'> does generate a syntax error, but in
general C<use 5.6;> is not a syntax error. However, in perl5.6 it reports
'Perl 5.600.0 required' because 5.6 is not a version string.
Ronald
Thread Previous
|
Thread Next