_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
WebPAC::Normalize - describe normalisaton rules using sets
-=head1 VERSION
-
-Version 0.30
-
=cut
-our $VERSION = '0.30';
+our $VERSION = '0.31';
=head1 SYNOPSIS
=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<search>
=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
use strict;
-use Test::More tests => 341;
+use Test::More tests => 347;
use Test::Exception;
use Cwd qw/abs_path/;
use blib;
test_check_ds('search');
test_check_ds('display');
+ _clean_ds();
+ test_s(qq{ sorted('something', '42'); });
+ test_s(qq{ sorted('empty', ''); });
+ test_check_ds('sorted');
+
_clean_ds();
my $n = read_file( "$abs_path/data/normalize.pl" );
$n .= "\n1;\n";