fixed bug with documented, but unimplemented new( join_subfields_with => 'foo' )
[Biblio-Isis] / lib / Biblio / Isis.pm
index f310501..d897400 100644 (file)
@@ -139,8 +139,8 @@ sub new {
 
        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}) {
+               $self->{$v} = {@_}->{$v} if defined({@_}->{$v});
        }
 
        my @isis_files = grep(/\.(FDT|MST|XRF|CNT)$/i,glob($self->{isisdb}."*"));
@@ -576,7 +576,7 @@ sub to_hash {
 
        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 +599,7 @@ sub to_hash {
                                        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') {
@@ -762,6 +762,9 @@ older versions if you really have to):
 
 Added C<hash_filter> to L</to_hash>
 
+Fixed bug with documented C<join_subfields_with> in L</new> which wasn't
+implemented
+
 =item 0.22
 
 Added field number when calling C<hash_filter>