7 |
_debug |
_debug |
8 |
_pack_subfields_hash |
_pack_subfields_hash |
9 |
|
|
10 |
|
to |
11 |
search_display search display sorted |
search_display search display sorted |
12 |
|
|
13 |
rec1 rec2 rec |
rec1 rec2 rec |
53 |
|
|
54 |
=cut |
=cut |
55 |
|
|
56 |
our $VERSION = '0.35'; |
our $VERSION = '0.36'; |
57 |
|
|
58 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
59 |
|
|
270 |
|
|
271 |
Those functions generally have to first in your normalization file. |
Those functions generally have to first in your normalization file. |
272 |
|
|
273 |
|
=head2 to |
274 |
|
|
275 |
|
Generic way to set values for some name |
276 |
|
|
277 |
|
to('field-name', 'name-value' => rec('200','a') ); |
278 |
|
|
279 |
|
There are many helpers defined below which might be easier to use. |
280 |
|
|
281 |
|
=cut |
282 |
|
|
283 |
|
sub to { |
284 |
|
my $type = shift or confess "need type -- BUG?"; |
285 |
|
my $name = shift or confess "needs name as first argument"; |
286 |
|
my @o = grep { defined($_) && $_ ne '' } @_; |
287 |
|
return unless (@o); |
288 |
|
$out->{$name}->{$type} = \@o; |
289 |
|
} |
290 |
|
|
291 |
=head2 search_display |
=head2 search_display |
292 |
|
|
293 |
Define output for L<search> and L<display> at the same time |
Define output for L<search> and L<display> at the same time |
294 |
|
|
295 |
search_display('Title', rec('200','a') ); |
search_display('Title', rec('200','a') ); |
296 |
|
|
|
|
|
297 |
=cut |
=cut |
298 |
|
|
299 |
sub search_display { |
sub search_display { |
306 |
|
|
307 |
=head2 tag |
=head2 tag |
308 |
|
|
309 |
Old name for L<search_display>, but supported |
Old name for L<search_display>, it will probably be removed at one point. |
310 |
|
|
311 |
=cut |
=cut |
312 |
|
|
322 |
|
|
323 |
=cut |
=cut |
324 |
|
|
325 |
sub _field { |
sub display { to( 'display', @_ ) } |
|
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}->{$type} = \@o; |
|
|
} |
|
|
|
|
|
sub display { _field( 'display', @_ ) } |
|
326 |
|
|
327 |
=head2 search |
=head2 search |
328 |
|
|
332 |
|
|
333 |
=cut |
=cut |
334 |
|
|
335 |
sub search { _field( 'search', @_ ) } |
sub search { to( 'search', @_ ) } |
336 |
|
|
337 |
=head2 sorted |
=head2 sorted |
338 |
|
|
342 |
|
|
343 |
=cut |
=cut |
344 |
|
|
345 |
sub sorted { _field( 'sorted', @_ ) } |
sub sorted { to( 'sorted', @_ ) } |
|
|
|
346 |
|
|
347 |
|
|
348 |
=head1 Functions to extract data from input |
=head1 Functions to extract data from input |