From a1d4da3f18a282ee6e1ce1bd723b3d8ed0fccfec Mon Sep 17 00:00:00 2001
From: Dan Scott <dscott@laurentian.ca>
Date: Sat, 4 Aug 2012 10:43:31 -0400
Subject: [PATCH] TPAC: Silence two uninit variable warnings

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 | 3 ++-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm       | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
index 8d577dae7c..f7220b10fb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
@@ -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;
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
index 1baf0abeeb..25285b1256 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
@@ -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 {
-- 
2.11.0