The current code assumes that if you try to compress a range of
MFHD holdings, you actually have the necessary pattern information.
This commit introduces a very basic check to avoid the most common
failure case.
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
my $opts = shift;
my $skip_sort = $opts->{'skip_sort'};
+ # basic check for necessary pattern information
+ if (!scalar keys %{$caption->pattern}) {
+ carp "Cannot compress without pattern data, returning original holdings";
+ return $self->holdings_by_caption($caption);
+ }
+
# make sure none are compressed (except for open-ended)
my @decomp_holdings;
if ($skip_sort) {
# XXX WRITE ME (?)
}
+sub pattern {
+ my $self = shift;
+
+ return $self->{_mfhdc_PATTERN};
+}
+
sub compressible {
my $self = shift;