fixed variable masking warnings found by perl -w
authorGalen Charlton <galen.charlton@liblime.com>
Fri, 4 Jan 2008 00:43:38 +0000 (18:43 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 4 Jan 2008 02:23:59 +0000 (20:23 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>

12 files changed:
C4/Labels.pm
C4/Reports.pm
C4/Serials.pm
catalogue/detail.pl
cataloguing/value_builder/barcode.pl
cataloguing/value_builder/unimarc_field_210c.pl
misc/batchRebuildBiblioTables.pl
misc/benchmark.pl
misc/migration_tools/rebuild_nozebra.pl
opac/sco/sco-main.pl
reserve/modrequest.pl
tools/letter.pl

index 9ff8e02..c7f8cb3 100644 (file)
@@ -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++ ) {
index f0efb60..7c46072 100644 (file)
@@ -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 = <COLUMNS>){
        my @row =split(/\t/,$input);
        $columns{$row[0]}=$row[1];
index 5673dea..06fafaa 100644 (file)
@@ -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 );
         
index e2d4623..3ecaf70 100755 (executable)
@@ -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 );
index 7ad5769..185c23e 100755 (executable)
@@ -71,7 +71,6 @@ sub plugin_javascript {
         $hour = "0".$sec;
        }
 
-       my $dbh = C4::Context->dbh;
        my $date = "$year";
 
        my ($tag,$subfield) =  GetMarcFromKohaField("items.barcode");
index 33cdbbe..64c243f 100755 (executable)
@@ -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');
index 16fbb68..5102bd5 100755 (executable)
@@ -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",'');
index 44e116b..6ba2c38 100755 (executable)
@@ -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");
index 9f5d109..cd55650 100755 (executable)
@@ -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) {
index 1fcd091..cace390 100755 (executable)
@@ -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;
index 61397d3..79d95dc 100755 (executable)
@@ -29,7 +29,6 @@ use C4::Reserves;
 use C4::Auth;
 
 my $query = new CGI;
-my $query = new CGI;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   
         template_name   => "about.tmpl",
index abf85fb..de55efa 100755 (executable)
@@ -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) {