--- trunk/lib/WebPAC/Normalize.pm 2007/10/30 17:40:13 912 +++ trunk/lib/WebPAC/Normalize.pm 2007/11/02 14:59:12 973 @@ -7,7 +7,7 @@ _debug _pack_subfields_hash - search_display search display + search_display search display sorted marc marc_indicators marc_repeatable_subfield marc_compose marc_leader marc_fixed @@ -41,13 +41,9 @@ WebPAC::Normalize - describe normalisaton rules using sets -=head1 VERSION - -Version 0.30 - =cut -our $VERSION = '0.30'; +our $VERSION = '0.31'; =head1 SYNOPSIS @@ -112,6 +108,9 @@ _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 ($@); @@ -460,6 +459,16 @@ $out->{$name}->{display} = \@o; } +=head2 tag + +Old name for L, but supported + +=cut + +sub tag { + search_display( @_ ); +} + =head2 display Define output just for I @@ -468,13 +477,16 @@ =cut -sub display { - my $name = shift or die "display needs name as first argument"; +sub _field { + my $type = shift or confess "need type -- BUG?"; + my $name = shift or confess "needs name as first argument"; my @o = grep { defined($_) && $_ ne '' } @_; return unless (@o); - $out->{$name}->{display} = \@o; + $out->{$name}->{$type} = \@o; } +sub display { _field( 'display', @_ ) } + =head2 search Prepare values just for I @@ -483,12 +495,18 @@ =cut -sub search { - my $name = shift or die "search needs name as first argument"; - my @o = grep { defined($_) && $_ ne '' } @_; - return unless (@o); - $out->{$name}->{search} = \@o; -} +sub search { _field( 'search', @_ ) } + +=head2 sorted + +Insert into lists which will be automatically sorted + + sorted('Title', rec('200','a') ); + +=cut + +sub sorted { _field( 'sorted', @_ ) } + =head2 marc_leader