TPAC: Silence two uninit variable warnings
authorDan Scott <dscott@laurentian.ca>
Sat, 4 Aug 2012 14:43:31 +0000 (10:43 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 15 Aug 2012 17:14:10 +0000 (13:14 -0400)
These warnings were being thrown on every TPAC page request, slowly
filling the logs:

Use of uninitialized value $set_locale in string eq at
/usr/local/share/perl/5.10.1/OpenILS/WWW/EGWeb.pm line 159.

Use of uninitialized value in pattern match (m//) at
/usr/local/share/perl/5.10.1/OpenILS/WWW/EGCatLoader.pm line 250.

Banish them.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm

index 8d577da..f7220b1 100644 (file)
@@ -247,7 +247,8 @@ sub load_common {
     $ctx->{full_path} = $ctx->{base_path} . $self->cgi->path_info;
     $ctx->{unparsed_uri} = $self->apache->unparsed_uri;
     $ctx->{opac_root} = $ctx->{base_path} . "/opac"; # absolute base url
-    $ctx->{is_staff} = ($self->apache->headers_in->get('OILS-Wrapper') =~ /true/);
+    my $oils_wrapper = $self->apache->headers_in->get('OILS-Wrapper') || '';
+    $ctx->{is_staff} = ($oils_wrapper =~ /true/);
     $ctx->{proto} = 'oils' if $ctx->{is_staff};
     $ctx->{physical_loc} = $self->get_physical_loc;
 
index 1baf0ab..25285b1 100644 (file)
@@ -154,7 +154,7 @@ sub load_context {
     $ctx->{locales} = \%registered_locales;
 
     # Set a locale cookie if the requested locale is valid
-    my $set_locale = $cgi->param('set_eg_locale');
+    my $set_locale = $cgi->param('set_eg_locale') || '';
     if (!(grep {$_ eq $set_locale} keys %registered_locales)) {
         $set_locale = '';
     } else {