[Koha-devel] Perl // operator

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Mon Jan 17 10:00:05 CET 2011


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 at catalyst.net.nz<mailto:robin at 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")




-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20110117/bc670329/attachment.htm>


More information about the Koha-devel mailing list