From 8c60e8260583e0b20384d29a2d45cd2a2b2ba686 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 3 Jan 2008 18:43:38 -0600 Subject: [PATCH] fixed variable masking warnings found by perl -w Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Labels.pm | 14 +-- C4/Reports.pm | 4 +- C4/Serials.pm | 4 +- catalogue/detail.pl | 1 - cataloguing/value_builder/barcode.pl | 1 - .../value_builder/unimarc_field_210c.pl | 3 - misc/batchRebuildBiblioTables.pl | 2 +- misc/benchmark.pl | 12 +-- misc/migration_tools/rebuild_nozebra.pl | 9 +- opac/sco/sco-main.pl | 3 +- reserve/modrequest.pl | 1 - tools/letter.pl | 88 +++++++------------ 12 files changed, 55 insertions(+), 87 deletions(-) diff --git a/C4/Labels.pm b/C4/Labels.pm index 9ff8e02dca..c7f8cb33d7 100644 --- a/C4/Labels.pm +++ b/C4/Labels.pm @@ -400,8 +400,8 @@ sub SetActiveTemplate { my $sth = $dbh->prepare($query); $sth->execute(); - my $query = "UPDATE labels_templates SET active = 1 WHERE tmpl_id = ?"; - my $sth = $dbh->prepare($query); + $query = "UPDATE labels_templates SET active = 1 WHERE tmpl_id = ?"; + $sth = $dbh->prepare($query); $sth->execute($tmpl_id); $sth->finish; } @@ -414,8 +414,8 @@ sub set_active_layout { my $sth = $dbh->prepare($query); $sth->execute(); - my $query = "UPDATE labels_conf SET active = 1 WHERE id = ?"; - my $sth = $dbh->prepare($query); + $query = "UPDATE labels_conf SET active = 1 WHERE id = ?"; + $sth = $dbh->prepare($query); $sth->execute($layout_id); $sth->finish; } @@ -511,12 +511,12 @@ sub add_layout { my $query2 = "update labels_conf set active = NULL"; my $sth2 = $dbh->prepare($query2); $sth2->execute(); - my $query2 = "INSERT INTO labels_conf + $query2 = "INSERT INTO labels_conf ( barcodetype, title, subtitle, isbn,issn, itemtype, barcode, dewey, class, subclass, itemcallnumber, author, printingtype, guidebox, startlabel, layoutname, active ) values ( ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?,?,?, 1 )"; - my $sth2 = $dbh->prepare($query2); + $sth2 = $dbh->prepare($query2); $sth2->execute( $barcodetype, $title, $subtitle, $isbn, $issn, @@ -1196,7 +1196,7 @@ sub draw_boundaries { ) = @_; my $y_pos_initial = ( ( 792 - 36 ) - 90 ); - my $y_pos = $y_pos_initial; + $y_pos = $y_pos_initial; # FIXME - why are we ignoring the y_pos parameter by redefining it? my $i = 1; for ( $i = 1 ; $i <= 8 ; $i++ ) { diff --git a/C4/Reports.pm b/C4/Reports.pm index f0efb6022b..7c46072949 100644 --- a/C4/Reports.pm +++ b/C4/Reports.pm @@ -83,8 +83,8 @@ my $htdocs = C4::Context->config('intrahtdocs'); my $section='intranet'; my ($theme, $lang) = themelanguage($htdocs, $columns_def_file, $section); -my $columns_def_file="$htdocs/$theme/$lang/$columns_def_file"; -open (COLUMNS,$columns_def_file); +my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file"; +open (COLUMNS,$full_path_to_columns_def_file); while (my $input = ){ my @row =split(/\t/,$input); $columns{$row[0]}=$row[1]; diff --git a/C4/Serials.pm b/C4/Serials.pm index 5673dea2f4..06fafaa2f0 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1432,12 +1432,12 @@ sub ReNewSubscription { ); # renew subscription - my $query = qq| + $query = qq| UPDATE subscription SET startdate=?,numberlength=?,weeklength=?,monthlength=? WHERE subscriptionid=? |; - my $sth = $dbh->prepare($query); + $sth = $dbh->prepare($query); $sth->execute( format_date_in_iso($startdate), $numberlength, $weeklength, $monthlength, $subscriptionid ); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index e2d4623008..3ecaf70785 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -141,7 +141,6 @@ foreach my $item (@items) { $template->param( norequests => $norequests ); ## get notes and subjects from MARC record - my $dbh = C4::Context->dbh; my $marcflavour = C4::Context->preference("marcflavour"); my $record = GetMarcBiblio($biblionumber); my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index 7ad5769c68..185c23edc1 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -71,7 +71,6 @@ sub plugin_javascript { $hour = "0".$sec; } - my $dbh = C4::Context->dbh; my $date = "$year"; my ($tag,$subfield) = GetMarcFromKohaField("items.barcode"); diff --git a/cataloguing/value_builder/unimarc_field_210c.pl b/cataloguing/value_builder/unimarc_field_210c.pl index 33cdbbead2..64c243fa50 100755 --- a/cataloguing/value_builder/unimarc_field_210c.pl +++ b/cataloguing/value_builder/unimarc_field_210c.pl @@ -131,9 +131,6 @@ plugin : the true value_builded. The screen that is open in the popup window. sub plugin { my ($input) = @_; - my $index = $input->param("index"); - my $result = $input->param("result"); - my $query=new CGI; my $op = $query->param('op'); my $authtypecode = $query->param('authtypecode'); diff --git a/misc/batchRebuildBiblioTables.pl b/misc/batchRebuildBiblioTables.pl index 16fbb68c85..5102bd5765 100755 --- a/misc/batchRebuildBiblioTables.pl +++ b/misc/batchRebuildBiblioTables.pl @@ -46,7 +46,7 @@ my $i=0; my $starttime = time(); $|=1; # flushes output -my $starttime = gettimeofday; +$starttime = gettimeofday; #1st of all, find item MARC tag. my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",''); diff --git a/misc/benchmark.pl b/misc/benchmark.pl index 44e116bea0..6ba2c38d4a 100755 --- a/misc/benchmark.pl +++ b/misc/benchmark.pl @@ -82,7 +82,7 @@ $b1->add_run($run1); $b->add_run($run1); # send HTTP request sequences to server and time responses -my $ro = $b1->execute; +$ro = $b1->execute; # calculate hits/sec print ("\t".$b1->total_time."ms\t".(1000*$b1->total_requests/$b1->total_time)." biblios/sec\n"); print "ALERT : ".$b1->total_responses_failed." failures\n" if $b1->total_responses_failed; @@ -107,7 +107,7 @@ $b2->add_run($run2); $b->add_run($run2); # send HTTP request sequences to server and time responses -my $ro = $b2->execute; +$ro = $b2->execute; # calculate hits/sec print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n"); @@ -123,7 +123,7 @@ $b4->concurrency( $concurrency ); my @issues; my @returns; print "Issues detail "; -my $sth = $dbh->prepare("SELECT barcode FROM items WHERE itemnumber=?"); +$sth = $dbh->prepare("SELECT barcode FROM items WHERE itemnumber=?"); my $sth2 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE borrowernumber=?"); for (my $i=1;$i<=$max_tries;$i++) { my $rand_borrowernumber; @@ -151,7 +151,7 @@ $b3->add_run($run3); $b->add_run($run3); # send HTTP request sequences to server and time responses -my $ro = $b3->execute; +$ro = $b3->execute; # calculate hits/sec print ("\t".$b3->total_time."ms\t".(1000*$b3->total_requests/$b3->total_time)." issues/sec\n"); @@ -163,10 +163,10 @@ $b4->add_run($run4); $b->add_run($run4); # send HTTP request sequences to server and time responses -my $ro = $b4->execute; +$ro = $b4->execute; # calculate hits/sec print ("\t".$b4->total_time."ms\t".(1000*$b4->total_requests/$b4->total_time)." returns/sec\n"); print "Benchmarking everything"; -my $ro = $b->execute; +$ro = $b->execute; print ("\t".$b->total_time."ms\t".(1000*$b->total_requests/$b->total_time)." operations/sec\n"); diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl index 9f5d10970c..cd55650512 100755 --- a/misc/migration_tools/rebuild_nozebra.pl +++ b/misc/migration_tools/rebuild_nozebra.pl @@ -164,7 +164,7 @@ while (my ($biblionumber) = $sth->fetchrow) { } print "\nInserting records...\n"; $i=0; -my $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('biblioserver',?,?,?)"); +$sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('biblioserver',?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { if (length($result{$key}->{$index}) > 1000000) { @@ -181,11 +181,10 @@ print "\n***********************************\n"; print "***** building AUTHORITIES indexes *****\n"; print "***********************************\n"; -my $sth; $sth=$dbh->prepare("select authid from auth_header order by authid $limit"); $sth->execute(); -my $i=0; -my %result; +$i=0; +%result = (); while (my ($authid) = $sth->fetchrow) { $i++; print "\r$i"; @@ -266,7 +265,7 @@ while (my ($authid) = $sth->fetchrow) { } print "\nInserting...\n"; $i=0; -my $sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('authorityserver',?,?,?)"); +$sth = $dbh->prepare("INSERT INTO nozebra (server,indexname,value,biblionumbers) VALUES ('authorityserver',?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { if (length($result{$key}->{$index}) > 1000000) { diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 1fcd091239..cace390aed 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -46,7 +46,8 @@ my $cnt = 0; #warn "issuerid: " . $issuerid; my ($issuer, $flags) = GetMemberDetails($issuerid); my $item = GetItem(undef,$barcode); -my ($borrower, $flags) = GetMemberDetails(undef,$userid); +my $borrower; +($borrower, $flags) = GetMemberDetails(undef,$userid); my $branch = $issuer->{branchcode}; my $confirm_required = 0; diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl index 61397d35ef..79d95dcec4 100755 --- a/reserve/modrequest.pl +++ b/reserve/modrequest.pl @@ -28,7 +28,6 @@ use C4::Output; use C4::Reserves; use C4::Auth; -my $query = new CGI; my $query = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { diff --git a/tools/letter.pl b/tools/letter.pl index abf85fb406..de55efa895 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -116,45 +116,36 @@ if ( $op eq 'add_form' ) { # build field list my @SQLfieldname; - my %line = ( 'value' => "LibrarianFirstname", 'text' => 'LibrarianFirstname' ); - push @SQLfieldname, \%line; - my %line = ( 'value' => "LibrarianSurname", 'text' => 'LibrarianSurname' ); - push @SQLfieldname, \%line; - my %line = ( 'value' => "LibrarianEmailaddress", 'text' => 'LibrarianEmailaddress' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "LibrarianFirstname", 'text' => 'LibrarianFirstname' }; + push @SQLfieldname, { 'value' => "LibrarianSurname", 'text' => 'LibrarianSurname' }; + push @SQLfieldname, { 'value' => "LibrarianEmailaddress", 'text' => 'LibrarianEmailaddress' }; my $sth2 = $dbh->prepare("SHOW COLUMNS from branches"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BRANCHES---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---BRANCHES---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( 'value' => "branches." . $field, 'text' => "branches." . $field ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "branches." . $field, 'text' => "branches." . $field }; } # add acquisition specific tables if ( index( $module, "acquisition" ) > 0 ) { $sth2 = $dbh->prepare("SHOW COLUMNS from aqbooksellers"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BOOKSELLERS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---BOOKSELLERS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "aqbooksellers." . $field, 'text' => "aqbooksellers." . $field - ); - push @SQLfieldname, \%line; + }; } $sth2 = $dbh->prepare("SHOW COLUMNS from aqorders"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---ORDERS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---ORDERS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "aqorders." . $field, 'text' => "aqorders." . $field - ); - push @SQLfieldname, \%line; + }; } # add issues specific tables @@ -162,79 +153,62 @@ if ( $op eq 'add_form' ) { elsif ( index( $module, "issues" ) > 0 ) { $sth2 = $dbh->prepare("SHOW COLUMNS from aqbooksellers"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BOOKSELLERS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---BOOKSELLERS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "aqbooksellers." . $field, 'text' => "aqbooksellers." . $field - ); - push @SQLfieldname, \%line; + }; } $sth2 = $dbh->prepare("SHOW COLUMNS from serial"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---SERIALS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---SERIALS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( 'value' => "serial." . $field, 'text' => "serial." . $field ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "serial." . $field, 'text' => "serial." . $field }; } $sth2 = $dbh->prepare("SHOW COLUMNS from subscription"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---SUBSCRIPTION---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---SUBSCRIPTION---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "subscription." . $field, 'text' => "subscription." . $field - ); - push @SQLfieldname, \%line; + }; } - my %line = ('value' => "", 'text' => '---Biblio---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---Biblio---' }; foreach(qw(title author serial)) { - my %line = ('value' => "biblio.$_", 'text' => ucfirst($_)); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "biblio.$_", 'text' => ucfirst($_) }; } } else { $sth2 = $dbh->prepare("SHOW COLUMNS from biblio"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BIBLIO---' ); + push @SQLfieldname, { 'value' => "", 'text' => '---BIBLIO---' }; - push @SQLfieldname, \%line; while ( ( my $field ) = $sth2->fetchrow_array ) { -# note : %line is redefined, otherwise \%line contains the same value for every entry of the list - my %line = ( 'value' => "biblio." . $field, 'text' => "biblio." . $field ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "biblio." . $field, 'text' => "biblio." . $field }; } $sth2 = $dbh->prepare("SHOW COLUMNS from biblioitems"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BIBLIOITEMS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---BIBLIOITEMS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "biblioitems." . $field, 'text' => "biblioitems." . $field - ); - push @SQLfieldname, \%line; + }; } - my %line = ( 'value' => "", 'text' => '---ITEMS---' ); - push @SQLfieldname, \%line; - my %line = ( 'value' => "items.content", 'text' => 'items.content' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---ITEMS---' }; + push @SQLfieldname, { 'value' => "items.content", 'text' => 'items.content' }; $sth2 = $dbh->prepare("SHOW COLUMNS from borrowers"); $sth2->execute; - my %line = ( 'value' => "", 'text' => '---BORROWERS---' ); - push @SQLfieldname, \%line; + push @SQLfieldname, { 'value' => "", 'text' => '---BORROWERS---' }; while ( ( my $field ) = $sth2->fetchrow_array ) { - my %line = ( + push @SQLfieldname, { 'value' => "borrowers." . $field, 'text' => "borrowers." . $field - ); - push @SQLfieldname, \%line; + }; } } if ($code) { -- 2.39.5