[open-ils-commits] r12620 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD (djfiander)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Mar 19 20:57:46 EDT 2009


Author: djfiander
Date: 2009-03-19 20:57:45 -0400 (Thu, 19 Mar 2009)
New Revision: 12620

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
Log:
minor error checking


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-03-19 20:29:31 UTC (rev 12619)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-03-20 00:57:45 UTC (rev 12620)
@@ -356,11 +356,13 @@
 		's' => \&match_season,
 		'y' => \&match_year,
 );
+
 sub regularity_match {
     my $self = shift;
     my $pubcode = shift;
     my @date = @_;
 
+    # we can't match something that doesn't exist.
     return 0 if !exists $self->{_mfhdc_PATTERN}->{y};
 
     foreach my $regularity (@{$self->{_mfhdc_PATTERN}->{y}}) {
@@ -369,6 +371,11 @@
 	my $chroncode= substr($regularity, 1, 1);
 	my @pats = split(/,/, substr($regularity, 2));
 
+	if (!exists $dispatch{$chroncode}) {
+	    carp "Unrecognized chroncode '$chroncode'";
+	    return 0;
+	}
+
 	# XXX WRITE ME
 	foreach my $pat (@pats) {
 	    $pat =~ s|/.+||;	# If it's a combined date, match the start



More information about the open-ils-commits mailing list