--- trunk/lib/Biblio/Isis.pm 2006/08/25 10:20:58 66 +++ trunk/lib/Biblio/Isis.pm 2007/05/18 21:16:52 72 @@ -7,7 +7,7 @@ BEGIN { use Exporter (); use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - $VERSION = 0.23; + $VERSION = 0.24; @ISA = qw (Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw (); @@ -128,6 +128,10 @@ option is included to support lagacy application written against version older than 0.21 of this module. By default, it disabled. See L. +=item ignore_empty_subfields + +Remove all empty subfields while reading from ISIS file. + =back =cut @@ -139,8 +143,8 @@ croak "new needs database name (isisdb) as argument!" unless ({@_}->{isisdb}); - foreach my $v (qw{isisdb debug include_deleted hash_filter}) { - $self->{$v} = {@_}->{$v}; + foreach my $v (qw{isisdb debug include_deleted hash_filter join_subfields_with ignore_empty_subfields}) { + $self->{$v} = {@_}->{$v} if defined({@_}->{$v}); } my @isis_files = grep(/\.(FDT|MST|XRF|CNT)$/i,glob($self->{isisdb}."*")); @@ -384,7 +388,15 @@ # skip zero-sized fields next if ($FieldLEN[$i] == 0); - push @{$self->{record}->{$FieldTAG[$i]}}, substr($buff,$FieldPOS[$i],$FieldLEN[$i]); + my $v = substr($buff,$FieldPOS[$i],$FieldLEN[$i]); + + if ( $self->{ignore_empty_subfields} ) { + $v =~ s/(\^\w)+(\^\w)/$2/g; + $v =~ s/\^\w$//; # last on line? + next if ($v eq ''); + } + + push @{$self->{record}->{$FieldTAG[$i]}}, $v; } $self->{'current_mfn'} = $mfn; @@ -576,7 +588,7 @@ my $row = $self->fetch($mfn) || return; - my $j_rs = $arg->{join_subfields_with}; + my $j_rs = $arg->{join_subfields_with} || $self->{join_subfields_with}; $j_rs = $self->{join_subfields_with} unless(defined($j_rs)); my $i_sf = $arg->{include_subfields}; @@ -599,7 +611,7 @@ next if (! $t); my ($sf,$v) = (substr($t,0,1), substr($t,1)); # XXX this might be option, but why? - next unless ($v); + next unless (defined($v) && $v ne ''); # warn "### $f_nr^$sf:$v",$/ if ($self->{debug} > 1); if (ref( $val->{$sf} ) eq 'ARRAY') { @@ -758,10 +770,17 @@ =over 8 +=item 0.24 + +Added C + =item 0.23 Added C to L +Fixed bug with documented C in L which wasn't +implemented + =item 0.22 Added field number when calling C