[Koha-patches] [PATCH 78/78] removing use strict problem

Joe Atzberger joe.atzberger at liblime.com
Fri May 29 21:06:35 CEST 2009


Paul --

Your new line does not do the same thing.

For example, try this using the same logic:

perl -we 'use strict; my $x=250; my $y = $x ? $x : 0 / 100; print "$y\n";'

You get "250".  You don't get division by 100 anymore except when it doesn't
matter (undef or 0).  You want the operator precedence of:
$y = ($x ? $x : 0) / 100

But perl does:
$y = $x ? $x : (0 / 100)

So that line should be like:

$sth->execute(($bookseller->{gstrate} || 0) / 100, $bookseller->{id});

-- 
Joe Atzberger
LibLime - Open Source Library Solutions

On Thu, May 28, 2009 at 12:33 PM, <paul.poulain at biblibre.com> wrote:

> From: Paul Poulain <paul.poulain at biblibre.com>
>
> ---
>  installer/data/mysql/updatedatabase.pl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/installer/data/mysql/updatedatabase.pl
> b/installer/data/mysql/updatedatabase.pl
> index dd141f3..0b2fff4 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -2724,7 +2724,7 @@ if (C4::Context->preference("Version") <
> TransformToNum($DBversion)) {
>     $dbh->do("ALTER TABLE `aqbooksellers` ADD COLUMN `gstrate` decimal(6,4)
> default NULL");
>     for my $bookseller (@$booksellers) {
>         my $sth = $dbh->prepare("UPDATE aqbooksellers SET gstrate=? WHERE
> id=?");
> -        $sth->execute($bookseller->{gstrate} / 100, $bookseller->{id});
> +        $sth->execute($bookseller->{gstrate}?$bookseller->{gstrate}:0 /
> 100, $bookseller->{id});
>         $sth->finish;
>     }
>     print "Upgrade to $DBversion done (modify gstrate to be consistent with
> syspref)\n";
> --
> 1.6.0.4
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20090529/b1d4e4d8/attachment-0002.htm>


More information about the Koha-patches mailing list