|
Posted by Abigail on May 13, 2008, 6:31 am
Please log in for more thread options
_
Sir Robin (robsku@NO-SPAM-REMOVE-THIS.fiveam.org) wrote on VCCCLXIX
,, wrote:
,,
,, >> On Sun, 11 May 2008 11:06:21 +0000 (UTC), Ben Bullock
,, >>>I believe the new features are all turned off by default anyway, so you
,, >>>have to "use 5.010;" anyway:
,, >>
,, >> On what versions of perl5 do you believe has new features off by default?
,, >
,, >In 5.10 you have to explicitely enable new features by adding a
,, >"use 5.010;" line.
,,
,, Too bad that they didn't come up with this, hmm, let's say somewhere around
,, when 5.6.x came,
But 5.6.x didn't come with new keywords that could conflict with a possibly
choosen user defined subroutine. That's why 5.010 has "use feature", to turn
specific features that could break backwards compatability.
,, that would have resulted in all my perl code beeing certain
,, working with the version mentioned with 'use' - because now that I have give
,, thought to it I am quite confident on one single thing of this subject and
,, that is I started with perl 5.6.x, so... So having now checked "Whats New in
,, 5.6.0" list of new stuff I'd say that if I one day install couple older
,, versions of perl5 to examine if my scripts/apps needs newer version than
,, whatever I have I pretty much know that theres not much point to test most o
,, the scripts with anythin before 5.6.0.. well at least not much before.
You are misunderstanding "use feature". 5.010 came with a ton of new
features that will be there regardless of whether you use "use feature"
or not. Out of the many new features, only three of them require "use
feature" (or "use 5.010").
Abigail
--
# Perl 5.6.0 broke this.
%0=mapABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$01$2$0$0$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
|
|
Posted by Sir Robin on May 16, 2008, 7:10 pm
Please log in for more thread options
>,, that would have resulted in all my perl code beeing certain
>,, working with the version mentioned with 'use' - because now that I have give
>,, thought to it I am quite confident on one single thing of this subject and
>,, that is I started with perl 5.6.x, so... So having now checked "Whats New in
>,, 5.6.0" list of new stuff I'd say that if I one day install couple older
>,, versions of perl5 to examine if my scripts/apps needs newer version than
>,, whatever I have I pretty much know that theres not much point to test most o
>,, the scripts with anythin before 5.6.0.. well at least not much before.
>
>You are misunderstanding "use feature". 5.010 came with a ton of new
>features that will be there regardless of whether you use "use feature"
>or not. Out of the many new features, only three of them require "use
>feature" (or "use 5.010").
Ok, thank you very much for clearing this up for me :)
>Abigail
--
***/--- Sir Robin (aka Jani Saksa) Bi-Sex and proud of it! ---\***
**/ email: robsku@fiveam.NO-SPAM.org, <*> Reg. Linux user #290577 \**
*| Me, Drugs, DooM, Photos, Writings... http://soul.fiveam.org/robsku |*
**\--- GSM/SMS: +358 44 927 3992 ---/**
"Jokainen linkki, jonka päätteenä on ".org", on kelvoton tiedonlähde."
- Nikolas Mäki
|
|
Posted by Sir Robin on May 16, 2008, 7:08 pm
Please log in for more thread options
>Sir Robin wrote:
>> if I one day install couple older versions of perl5 to examine if my
>> scripts/apps needs newer version than whatever I have I pretty much
>> know that theres not much point to test most of the scripts with
>> anythin before 5.6.0.
>
>Perl 5.6.0 is old enough that there's generally not much point in
>testing with anything older. Authors of CPAN modules might want to
>support older versions but for typical programmers it's a waste
>of effort.
Thanks for the info :)
>> I could propably spend quite some time to check through every version
>> of perl and test them all when I start to go a bit nutty :D
>
>Don't. You only need to support the environments you're developing for.
>If you can count on v5.x installed use it and take advantage of whatever
>features it has to offer. There's no point in pursuing backward
>compatibility for its own sake.
True and I knew that, but thanks anyway :) However some of my programs are for
end-users and some of my perl code are plugins for the irc client Irssi and
are meant for anyone who finds them usefull - as I would ofthen have no idea
on what environments people could be running them I would like to have them
rather more backward compatible than less backward compatible ;)
I would not go beyond certain point on this but I have seen, for example, Unix
shell environments for using Irssi where other software besides Irssi is
sometimes dead old - and the end users of the system can't change that. If
it's not too much trouble then I'd love to make my code so that for example
they could use it...
>-mjc
--
***/--- Sir Robin (aka Jani Saksa) Bi-Sex and proud of it! ---\***
**/ email: robsku@fiveam.NO-SPAM.org, <*> Reg. Linux user #290577 \**
*| Me, Drugs, DooM, Photos, Writings... http://soul.fiveam.org/robsku |*
**\--- GSM/SMS: +358 44 927 3992 ---/**
"Jokainen linkki, jonka päätteenä on ".org", on kelvoton tiedonlähde."
- Nikolas Mäki
|
|
Posted by Abigail on May 12, 2008, 2:37 pm
Please log in for more thread options _
dummy@phony.info (dummy@phony.info) wrote on VCCCLXVII September MCMXCIII
<> 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?
<>
<> But how about the reverse case?
The reverse case is pretty easy:
BEGIN {
die "Your Perl version is too new" if $] > 5.008008;
}
<> 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?
That's not the reverse case.
<> Is this sort of thing impossible?
Basically, yes. There are some new features that aren't available unless
turned on explicitely, but that isn't the case for features that will not
cause any backwards compatability issues. For instance, there are a ton of
new features when using regexpes, and you get them regardless whether you
use "use feature" or not. Furthermore, bug fixes will be there as well, and
so will any modules that are in 5.010, but not in an older install of Perl.
The best way to avoid accidentily using features that aren't available on
older Perl is to install the oldest Perl you want to develop for, and test
with that.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
|
|
Posted by szr on May 12, 2008, 8:43 pm
Please log in for more thread options Abigail wrote:
> _
> dummy@phony.info (dummy@phony.info) wrote on VCCCLXVII September
> <> 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?
> <>
> <> But how about the reverse case?
>
> The reverse case is pretty easy:
>
> BEGIN {
> die "Your Perl version is too new" if $] > 5.008008;
> }
Yes, that seems to work:
$ perl5.10.0 -e 'print $]'
5.010000
$ perl5.8.8 -e 'print $]'
5.008008
$ perl5.8.2 -e 'print $]'
5.008002
$ perl5.8.0 -e 'print $]'
5.008
$ perl5.6.1 -e 'print $]'
5.006001
Little question: Since this is a floating point number, are there any
rounding-error considerations when making comparisons and such?
Also, is there a reason why 5.10's output pads zeros on the right-hand
end of the number?
--
szr
|
| Similar Threads | Posted | | rsh daemon written in perl? | December 12, 2004, 11:14 pm |
| new commands written in perl | September 21, 2004, 11:57 am |
| Can services be written in Perl? | December 14, 2005, 9:31 pm |
| Can device drivers be written in Perl? | December 9, 2005, 9:55 pm |
| General way to run an exe with errors written to a file | September 19, 2007, 8:04 pm |
| is there a minimal LDAP server written in Perl? | April 13, 2005, 4:12 pm |
| How to port scripts written for UNIX on windows | June 1, 2005, 5:59 am |
| Can (nearly) any Perl program be written on a single line? | October 19, 2005, 5:30 pm |
| ID3 Tags written by Perl can not be modified by any other ID3 editor | December 19, 2005, 7:33 am |
| A simple photosharing application written in perl | April 21, 2007, 3:45 pm |
|