From 542c54e067e75d6c0f9fa470241541db35c34e02 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Wed, 23 Jul 2008 21:23:35 -0500 Subject: [PATCH] kohabug 2392 Changing array dereferencing syntax 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. Signed-off-by: Joshua Ferraro --- 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 3f395044ad..0d018f2913 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 ec55a6534b..6238f791c1 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 7c28918aa1..4589aba78b 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; -- 2.39.5