Lp 1930747: Use Constant MARC_NAMESPACE in AppUtils user/dyrcona/lp1930747-constant-MARC_NAMESPACE
authorJason Stephenson <jason@sigio.com>
Thu, 3 Jun 2021 19:14:31 +0000 (15:14 -0400)
committerJason Stephenson <jason@sigio.com>
Thu, 3 Jun 2021 19:14:31 +0000 (15:14 -0400)
Use the Perl "constant" pragma for MARC_NAMESPACE in OpenILS::
Application::AppUtils to better convey the intention of the code and
to protect it from accidental change.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm

index dbf8f70..619c3c2 100644 (file)
@@ -25,7 +25,7 @@ use Digest::MD5 qw(md5_hex);
 # Pile of utilty methods used accross applications.
 # ---------------------------------------------------------------------------
 my $cache_client = "OpenSRF::Utils::Cache";
-my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim';
+use constant MARC_NAMESPACE => 'http://www.loc.gov/MARC21/slim';
 
 # ---------------------------------------------------------------------------
 # on sucess, returns the created session, on failure throws ERROR exception
@@ -2437,8 +2437,8 @@ sub verify_migrated_user_password {
 sub marc_xml_to_doc {
     my ($class, $xml) = @_;
     my $marc_doc = XML::LibXML->new->parse_string($xml);
-    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1);
-    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE);
+    $marc_doc->documentElement->setNamespace(MARC_NAMESPACE, 'marc', 1);
+    $marc_doc->documentElement->setNamespace(MARC_NAMESPACE);
     return $marc_doc;
 }