[Koha-patches] [PATCH] kohabug 2392 Changing array dereferencing syntax
Chris Nighswonger
chris.nighswonger at liblime.com
Thu Jul 24 04:23:35 CEST 2008
It appears that Perl 5.10 does not like ${@$foo}[0] but rather wants $foo->[0]
The latter is also much more readable. This patch makes the change.
---
C4/Auth.pm | 12 ++++++------
C4/VirtualShelves.pm | 8 ++++----
C4/VirtualShelves/Page.pm | 12 ++++++------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 3f39504..0d018f2 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -715,12 +715,12 @@ sub checkauth {
$total->{'bartotal'} = $totshelves;
($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
$total->{'pubtotal'} = $totshelves;
- $session->param('barshelves', ${@$barshelves}[0]);
- $session->param('pubshelves', ${@$pubshelves}[0]);
+ $session->param('barshelves', $barshelves->[0]);
+ $session->param('pubshelves', $pubshelves->[0]);
$session->param('totshelves', $total);
- C4::Context::set_shelves_userenv('bar',${@$barshelves}[0]);
- C4::Context::set_shelves_userenv('pub',${@$pubshelves}[0]);
+ C4::Context::set_shelves_userenv('bar',$barshelves->[0]);
+ C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
C4::Context::set_shelves_userenv('tot',$total);
}
else {
@@ -740,9 +740,9 @@ sub checkauth {
my ($total, $totshelves, $pubshelves);
($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
$total->{'pubtotal'} = $totshelves;
- $session->param('pubshelves', ${@$pubshelves}[0]);
+ $session->param('pubshelves', $pubshelves->[0]);
$session->param('totshelves', $total);
- C4::Context::set_shelves_userenv('pub',${@$pubshelves}[0]);
+ C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
C4::Context::set_shelves_userenv('tot',$total);
# setting a couple of other session vars...
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index ec55a65..6238f79 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -555,13 +555,13 @@ sub RefreshShelvesSummary ($$$) {
$total->{'pubtotal'} = $totshelves;
# Update the current session with the latest shelves...
- $session->param('barshelves', ${@$barshelves}[0]);
- $session->param('pubshelves', ${@$pubshelves}[0]);
+ $session->param('barshelves', $barshelves->[0]);
+ $session->param('pubshelves', $pubshelves->[0]);
$session->param('totshelves', $total);
# likewise the userenv...
- C4::Context->set_shelves_userenv('bar',${@$barshelves}[0]);
- C4::Context->set_shelves_userenv('pub',${@$pubshelves}[0]);
+ C4::Context->set_shelves_userenv('bar',$barshelves->[0]);
+ C4::Context->set_shelves_userenv('pub',$pubshelves->[0]);
C4::Context::set_shelves_userenv('tot',$total);
return ($total, $pubshelves, $barshelves);
diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 7c28918..4589aba 100755
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -307,17 +307,17 @@ if ($template->param( 'shelves' ) or
my ($total, $pubshelves, $barshelves) = RefreshShelvesSummary($query->cookie("CGISESSID"),$loggedinuser,($loggedinuser == -1 ? 20 : 10));
if (defined $barshelves) {
- $template->param( barshelves => scalar (@{${@$barshelves}[0]}),
- barshelvesloop => ${@$barshelves}[0],
+ $template->param( barshelves => scalar (@{$barshelves->[0]}),
+ barshelvesloop => $barshelves->[0],
);
- $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@{${@$barshelves}[0]}));
+ $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@{$barshelves->[0]}));
}
if (defined $pubshelves) {
- $template->param( pubshelves => scalar (@{${@$pubshelves}[0]}),
- pubshelvesloop => ${@$pubshelves}[0],
+ $template->param( pubshelves => scalar (@{$pubshelves->[0]}),
+ pubshelvesloop => $pubshelves->[0],
);
- $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@{${@$pubshelves}[0]}));
+ $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@{$pubshelves->[0]}));
}
output_html_with_http_headers $query, $cookie, $template->output;
--
1.5.5.GIT
More information about the Koha-patches
mailing list