--- trunk/lib/WebPAC/Normalize.pm 2007/11/02 14:59:12 973 +++ trunk/lib/WebPAC/Normalize.pm 2007/11/03 12:37:43 979 @@ -15,6 +15,7 @@ marc_original_order rec1 rec2 rec + frec regex prefix suffix surround first lookup join_with save_into_lookup @@ -75,7 +76,7 @@ marc_encoding => 'utf-8', config => $config, load_row_coderef => sub { - my ($database,$input,$mfn) = shift; + my ($database,$input,$mfn) = @_; $store->load_row( database => $database, input => $input, id => $mfn ); }, ); @@ -101,6 +102,9 @@ die "need row argument" unless ($arg->{row}); die "need normalisation argument" unless ($arg->{rules}); + # FIXME load this conditionally +# use WebPAC::Normalize::ISBN; + no strict 'subs'; _set_lookup( $arg->{lookup} ) if defined($arg->{lookup}); _set_rec( $arg->{row} ); @@ -108,9 +112,6 @@ _clean_ds( %{ $arg } ); $load_row_coderef = $arg->{load_row_coderef}; - # FIXME load this conditionally - use WebPAC::Normalize::ISBN; - eval "$arg->{rules}"; die "error evaling $arg->{rules}: $@\n" if ($@); @@ -171,6 +172,9 @@ my ($marc_record_offset, $marc_fetch_offset) = (0, 0); sub _get_ds { + +warn "## out = ",dump($out); + return $out; } @@ -997,6 +1001,12 @@ =cut +sub frec { + my @out = rec(@_); + warn "rec(",dump(@_),") has more than one return value, ignoring\n" if $#out > 0; + return shift @out; +} + sub rec { my @out; if ($#_ == 0) {