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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 6 21:47:35 EDT 2009


Author: djfiander
Date: 2009-04-06 21:47:33 -0400 (Mon, 06 Apr 2009)
New Revision: 12807

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
Log:
Start getting ready to handle more complex publication patterns.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-04-07 00:53:52 UTC (rev 12806)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm	2009-04-07 01:47:33 UTC (rev 12807)
@@ -85,14 +85,25 @@
 	}
     }
 
+    my $pat = $self->{_mfhdc_PATTERN};
+
+    # Sanity check publication frequency vs publication pattern:
+    # if the frequency is a number, then the pattern better
+    # have that number of values associated with it.
+    if (exists($pat->{w}) && ($pat->{w} =~ /^\d+$/)
+	&& ($pat->{w} != scalar(@{$pat->{y}}))) {
+	carp("Caption::new: publication frequency '$pat->{w}' != publication pattern @{$pat->{y}}");
+    }
+
+
     # If there's a $x subfield and a $j, then it's compressible
-    if (exists $self->{_mfhdc_PATTERN}->{x} && exists $self->{_mfhdc_CHRONS}->{'j'}) {
+    if (exists $pat->{x} && exists $self->{_mfhdc_CHRONS}->{'j'}) {
 	$self->{_mfhdc_COMPRESSIBLE} = 1;
     }
 
     bless ($self, $class);
 
-    if (exists $self->{_mfhdc_PATTERN}->{y}) {
+    if (exists $pat->{y}) {
 	$self->decode_pattern;
     }
 



More information about the open-ils-commits mailing list