--- trunk/lib/WebPAC/Normalize.pm 2009/05/30 15:26:25 1210 +++ trunk/lib/WebPAC/Normalize.pm 2011/12/15 21:40:37 1367 @@ -123,7 +123,7 @@ $load_row_coderef = $arg->{load_row_coderef}; no strict 'subs'; - no warnings 'redefine'; + no warnings 'all'; eval "$arg->{rules};"; die "error evaling $arg->{rules}: $@\n" if ($@); @@ -145,7 +145,7 @@ $WebPAC::Normalize::MARC::rec = $rec; } -=head2 +=head2 _get_rec my $rec = _get_rec(); @@ -153,11 +153,13 @@ sub _get_rec { $rec }; -sub rec_array { - my $d = $rec->{ $_[0] }; - return @$d if ref($d) eq 'ARRAY'; - die "field $_[0] not array: ",dump( $d ); -} +=head2 _set_rec + + _set_rec( $rec ); + +=cut + +sub _set_rec { $rec = $_[0] } =head2 _set_config @@ -956,5 +958,21 @@ return @_ . ''; } +=head2 rec_array + +Always return field as array + + foreach my $d ( rec_array('field') ) { + warn $d; + } + +=cut + +sub rec_array { + my $d = $rec->{ $_[0] }; + return @$d if ref($d) eq 'ARRAY'; + return ($d); +} + # END 1;