Hi, I came across the new Perl 5.10 // defined-or operator in Koha code. (See below) The INSTALL doc says that we still run under Perl 5.8.8. Should we still refrain from using it? Regards, Marcel For instance in commit 8e5ee007db451f62fe17c456215013e422f25bec Author: Robin Sheat robin@catalyst.net.nz<mailto:robin@catalyst.net.nz> Bug 5186 - allow tax rates to be set to zero (master) Two examples: --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl - my $gst = $bookseller->{gstrate} || C4::Context->preference(" + # '//' is like '||' but tests for defined, rather than true + my $gst = $bookseller->{gstrate} // C4::Context->preference(" --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -137,8 +137,8 @@ sub BasketTotal { my @orders = GetOrders($basketno); for my $order (@orders){ $total = $total + ( $order->{ecost} * $order->{quantity} ); - if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $b - my $gst = $bookseller->{gstrate} || C4::Context->preference("gist") + if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $b + my $gst = $bookseller->{gstrate} // C4::Context->preference("gist")
Le 17/01/2011 10:00, Marcel de Rooy a écrit :
Hi,
I came across the new Perl 5.10 // defined-or operator in Koha code. (See below)
The INSTALL doc says that we still run under Perl 5.8.8.
Should we still refrain from using it?
I vote no (to refrain, so yes to use // ;-) )=> I think we should use 5.10 pragmas, as 5.10 is everywhere except on very old distros. -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
On Mon, Jan 17, 2011 at 10:50:43AM +0100, Paul Poulain wrote:
I vote no (to refrain, so yes to use // ;-) )=> I think we should use 5.10 pragmas, as 5.10 is everywhere except on very old distros.
well, actually every koha perl files should begin with something like: use 5.10.0; use strict; use warnings; # ... moar ... which can be replaced by: use Modern::Perl; read the code of this module (only few lines) and see how easy to set a default discipline. Koha could have his own one! marc -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com
hello, On Mon, Jan 17, 2011 at 09:00:05AM +0000, Marcel de Rooy wrote:
Hi,
I came across the new Perl 5.10 // defined-or operator in Koha code. (See below)
The INSTALL doc says that we still run under Perl 5.8.8.
I guess there is more and more koha code that isn't 5.8 compliant anymore. Plus: - most of recent distributions are still 5.1[02] by default - there was so many additions in 5.10, i just see it as a MAJOR release! More and more modules from CPAN use them! - performance improvements and bugfixes are numerous since 5.8
Should we still refrain from using it?
//, given, named captures, re verbs ... and so on ... Koha has to step forward with some KISS and predictable policy. My proposal have a simple rule: "The default koha perl interpreter version is the one of current debian stable". Benefits - timeline trolls outsourced to a wise group (no one can blame debian for hasty rushes) - predictable easily (just check the version of testing distribution) - fits the usecase of most of us regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com
Marcel de Rooy wrote:
I came across the new Perl 5.10 // defined-or operator in Koha code. (See below) The INSTALL doc says that we still run under Perl 5.8.8. Should we still refrain from using it?
It's not very clear, but http://www.cpan.org/src/README.html seems to say that 5.8 is still supported. So I'd say we remain compatible with that for 3.4, but I feel this is the Release Manager's decision. Current stable releases (3.0 and 3.2) should definitely keep working on 5.8.8. It would be very nasty for a library to do a small version upgrade and discover they need to upgrade perl! Hope that helps, -- MJ Ray (slef), member of www.software.coop, a for-more-than-profit co-op. Webmaster, Debian Developer, Past Koha RM, statistician, former lecturer. In My Opinion Only: see http://mjr.towers.org.uk/email.html Available for hire for various work http://www.software.coop/products/
On Mon, Jan 17, 2011 at 04:51:23PM +0000, MJ Ray wrote:
It's not very clear, but http://www.cpan.org/src/README.html seems to say that 5.8 is still supported.
perl stable version is 5.12, not even 5.10 (released on December 18, 2007). 5.8 (last maintenance release: December 14, 2008) is "maintained". it doesn't mean "you should use it" but "if you have perl legacy scripts to run on a old system, we carre about it". plus! most of us still use a 5.10 interpreter so we can't provide a any serious waranty to be 5.8 compliant as long as we haven't a test suite with large coverage running on a perlbrewed 5.8. is there a *real* reason to take us away from all new perl features ? regards -- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com
Marc Chantreux wrote:
On Mon, Jan 17, 2011 at 04:51:23PM +0000, MJ Ray wrote:
It's not very clear, but http://www.cpan.org/src/README.html seems to say that 5.8 is still supported.
perl stable version is 5.12, not even 5.10 (released on December 18, 2007).
5.8 (last maintenance release: December 14, 2008) is "maintained". it doesn't mean "you should use it" but "if you have perl legacy scripts to run on a old system, we carre about it".
Yes, I know all that, but 5.8 has not been end-of-lifed like 5.6 yet, has it? It's in the same "maintained" status as 5.10, it appears.
plus! most of us still use a 5.10 interpreter so we can't provide a any serious waranty to be 5.8 compliant as long as we haven't a test suite with large coverage running on a perlbrewed 5.8.
So "use 5.008_006;" wouldn't warn you when you exceed it? Ouch.
is there a *real* reason to take us away from all new perl features ?
World domination! 5.8 is still a bigger potential user base. The most conspicuous laggard is MacOS X 10.6 which I think has perl 5.10.0 but built in a way that MARC::Charset doesn't like. Happily, it also has some version of 5.8. I wouldn't recommend running Koha on MacOS X, but some people do and I don't understand why we should drop them for the sake of replacing a few defined-s and things like that with less readable alternatives. As I wrote before, I'm fine with whatever Chris decides on 3.4, but 5.8 support should remain in 3.2 and 3.0. Hope that explains, -- MJ Ray (slef), member of www.software.coop, a for-more-than-profit co-op. Past Koha Release Manager (2.0), LMS programmer, statistician, webmaster. In My Opinion Only: see http://mjr.towers.org.uk/email.html Available for hire for Koha work http://www.software.coop/products/koha
* MJ Ray (mjr@phonecoop.coop) wrote:
As I wrote before, I'm fine with whatever Chris decides on 3.4, but 5.8 support should remain in 3.2 and 3.0.
Hi All I think making 3.4 use 5.10 is fine, I do agree that we should leave it for 3.2 and 3.0. I will update the dependencies for perl and also MARC::Record dependency to catch the bug fixes galen pushed. Chris -- Chris Cormack Catalyst IT Ltd. +64 4 803 2238 PO Box 11-053, Manners St, Wellington 6142, New Zealand
2011/1/17 Chris Cormack <chrisc@catalyst.net.nz>:
* MJ Ray (mjr@phonecoop.coop) wrote:
As I wrote before, I'm fine with whatever Chris decides on 3.4, but 5.8 support should remain in 3.2 and 3.0.
Hi All
I think making 3.4 use 5.10 is fine, I do agree that we should leave it for 3.2 and 3.0.
Incidentally, the patch in question has not been pushed to 3.2.x. Kind Regards, Chris
participants (6)
-
Chris Cormack -
Chris Nighswonger -
Marc Chantreux -
Marcel de Rooy -
MJ Ray -
Paul Poulain