Correcting array element reference syntax which caused unnecessary warns

Also adding conditional to check ENV VAR definition to avoid unnecssary warns.
This commit is contained in:
Chris Nighswonger 2010-01-07 09:41:12 -05:00 committed by Henri-Damien LAURENT
parent 2f274f01a1
commit 8a63dd55a0

View file

@ -67,14 +67,16 @@ my $news_lang;
if($input->cookie('KohaOpacLanguage')){
$news_lang = $input->cookie('KohaOpacLanguage');
}else{
while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
if( my @lang = grep { /^$1$/i } @languages ) {
$news_lang = $lang[0];
if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
if( my @lang = grep { /^$1$/i } @languages ) {
$news_lang = $lang[0];
}
}
}
if (not $news_lang) {
my @languages = split ",", C4::Context->preference("opaclanguages");
$news_lang = @languages[0];
$news_lang = $languages[0];
}
}