Bug 12482: (QA followup) coding guidelines for hashrefs
authorTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 3 Jul 2014 17:36:25 +0000 (14:36 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 3 Jul 2014 17:45:59 +0000 (14:45 -0300)
As of the public coding guidelines, $$variable{key} usage is discouraged. $variable->{key} should be used instead.

Btw, honour the "FIXME - Bug 2505" line :-D

Regards
To+

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
admin/aqbudgetperiods.pl

index 6cf7833..d565746 100755 (executable)
@@ -44,9 +44,8 @@ script to administer the budget periods table
 
 =cut
 
-## modules
-use strict;
-#use warnings; FIXME - Bug 2505
+use Modern::Perl;
+
 use Number::Format qw(format_price);
 use CGI;
 use List::Util qw/min/;
@@ -64,7 +63,7 @@ my $dbh = C4::Context->dbh;
 
 my $input       = new CGI;
 
-my $searchfield          = $input->param('searchfield');
+my $searchfield          = $input->param('searchfield') // '';
 my $budget_period_id     = $input->param('budget_period_id');
 my $op                   = $input->param('op')||"else";
 #my $sort1_authcat = $input->param('sort1_authcat');
@@ -140,7 +139,7 @@ if ( $op eq 'add_form' ) {
 }
 
 elsif ( $op eq 'add_validate' ) {
-## add or modify a budget period (confirimation)
+## add or modify a budget period (confirmation)
 
     ## update budget period data
        if ( $budget_period_id ne '' ) {
@@ -222,7 +221,7 @@ elsif ( $op eq 'duplicate_budget' ){
 
         # get only the columns of aqbudgets
         my @columns = Koha::Database->new()->schema->source('Aqbudget')->columns;
-        my $new_entry = { map { join(' ',@columns) =~ /$_/ ? ( $_ => $$entry{$_} )  : () } keys(%$entry) };
+        my $new_entry = { map { join(' ',@columns) =~ /$_/ ? ( $_ => $entry->{$_} )  : () } keys(%$entry) };
         # write it to db
         my $new_id = AddBudget($new_entry);
         $old_new{$old_id} = $new_id;