From ccee815f4a1d255ab55958d797d896b2fef9dad6 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 10 Mar 2009 16:41:00 -0500 Subject: [PATCH] Bug 2617: Add strict (and warnings), partial fix. These are some of the simpler scripts to add strict to. Corrected perldoc for Bookfund. Signed-off-by: Galen Charlton --- C4/Bookfund.pm | 8 ++++---- acqui/currency.pl | 25 +++++++++++++------------ admin/env_tz_test.pl | 2 ++ changelanguage.pl | 5 ++++- misc/sax_parser_print.pl | 6 +++++- opac/opac-changelanguage.pl | 6 ++++-- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/C4/Bookfund.pm b/C4/Bookfund.pm index 7c00067501..b794aae154 100644 --- a/C4/Bookfund.pm +++ b/C4/Bookfund.pm @@ -315,11 +315,13 @@ sub NewBookFund{ =head3 ModBookFund -&ModBookFund($bookfundname,$bookfundid,$current_branch, $branchcode) = -this function update the bookfundname and the branchcode on aqbookfund table on database. +&ModBookFund($bookfundname,$bookfundid,$current_branch, $branchcode) + +This function updates the bookfundname and the branchcode in the aqbookfund table. =cut +# FIXME: use placeholders, ->prepare(), ->execute() sub ModBookFund { my ($bookfundname,$bookfundid,$current_branch, $branchcode) = @_; @@ -349,8 +351,6 @@ sub ModBookFund { } } - - #-------------------------------------------------------------# =head3 SearchBookFund diff --git a/acqui/currency.pl b/acqui/currency.pl index f2fb44f3c6..10b7dad86b 100755 --- a/acqui/currency.pl +++ b/acqui/currency.pl @@ -1,11 +1,9 @@ #!/usr/bin/perl - #written by chris@katipo.co.nz #9/10/2000 #script to display and update currency rates - # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -23,18 +21,21 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +use strict; +use warnings; use CGI; -use C4::Acquisition; -use C4::Biblio; -use C4::Bookfund; +use C4::Bookfund qw(ModCurrencies); -my $input=new CGI; +# FIXME: CHECK AUTH +# FIXME: This should be part of another script, not a throwaway standalone. +# FIXME: params should have better checks before passed to ModCurrencies +# FIXME: need error handling if ModCurrencies FAILS. -my @params=$input->param; -foreach my $param (@params){ - if ($param ne 'type' && $param !~ /submit/){ - my $data=$input->param($param); - ModCurrencies($param,$data); -} +my $input = new CGI; + +foreach my $param ($input->param) { + if ($param ne 'type' && $param !~ /submit/) { + ModCurrencies($param, $input->param($param)); + } } print $input->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); diff --git a/admin/env_tz_test.pl b/admin/env_tz_test.pl index ae70a1a9f1..5bd5cd778c 100755 --- a/admin/env_tz_test.pl +++ b/admin/env_tz_test.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +use strict; +use warnings; use CGI; # use Data::Dumper; diff --git a/changelanguage.pl b/changelanguage.pl index 536d0aa8fd..f906c236c3 100755 --- a/changelanguage.pl +++ b/changelanguage.pl @@ -15,7 +15,10 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA -use C4::Output; +use strict; +use warnings; + +use C4::Output qw(setlanguagecookie); use CGI; my $query = new CGI; diff --git a/misc/sax_parser_print.pl b/misc/sax_parser_print.pl index 97c0ab5658..d206a5ecde 100755 --- a/misc/sax_parser_print.pl +++ b/misc/sax_parser_print.pl @@ -1,7 +1,11 @@ #!/usr/bin/perl # check the current SAX Parser + +use strict; +use warnings; use XML::SAX::ParserFactory; -$parser = XML::SAX::ParserFactory->parser(); + +my $parser = XML::SAX::ParserFactory->parser(); print "Koha wants something like: XML::LibXML::SAX::Parser=HASH(0x81fe220) You have: diff --git a/opac/opac-changelanguage.pl b/opac/opac-changelanguage.pl index 9a470aef64..0cfbca4e01 100755 --- a/opac/opac-changelanguage.pl +++ b/opac/opac-changelanguage.pl @@ -15,12 +15,14 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA -use C4::Output; +use strict; +use warnings; +use C4::Output qw(setlanguagecookie); use CGI; my $query = new CGI; my $language = $query->param('language'); my $url = $query->referer(); -warn "Language : $query // $language // $url"; +# warn "Language : $query // $language // $url"; setlanguagecookie( $query, $language, $url ); -- 2.39.5