|
Posted by dummy on May 11, 2008, 5:37 pm
Please log in for more thread options On Sun, 11 May 2008 11:06:21 +0000 (UTC), Ben Bullock
>On Sat, 10 May 2008 20:51:54 -0700, dummy wrote:
>
>> I understand that one can specify that a script must be run under a perl
>> version no earlier than a particular version. So, if I say 'use 5.6.0',
>> that code will throw an error if one tries to run it under perl 5.5.0,
>> right?
>
>#!/usr/local/bin/perl
>
>use warnings;
>
>use 5.6.0;
>
>v-string in use/require non-portable at ./usenet-2008-5-11.pl line 5.
>
>So you have to say
>
>use 5.006;
>
>> But how about the reverse case?
>>
>> Suppose I write code on my desktop, which has perl 5.10.0 installed, and
>> later transfer that code to a system that only has perl as far as 5.8.8.
>> How can I cause an error on the desktop if I accidentally use any of the
>> new features of 5.10.0, as I would want to do to signal incompatibility?
>
>> Is this sort of thing impossible?
>
>I believe the new features are all turned off by default anyway, so you
>have to "use 5.010;" anyway:
>
>#!/usr/local/bin/perl
>
>use warnings;
>
>use 5.010;
>
>say "say say what you want";
Thank you; I do need to specify the 5.10.0 features. But I can use
either 5.10.0 or 5.010 to do so. At least on my system, using
strawberry; see below. Why is it different for you?
------ start quote -----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
c:\>perl
say "hi";
String found where operator expected at - line 1, near "say "hi""
(Do you need to predeclare say?)
^D
syntax error at - line 1, near "say "hi""
Execution of - aborted due to compilation errors.
c:\>perl
use 5.10.0;
say "hi";
^D
hi
c:\>perl
use 5.010;
say "hi"
^D
hi
c:\>perl
use 5.6.0;
print "hi\n";
^D
hi
c:\>
----------- end quote
|