/[webpac2]/trunk/lib/WebPAC/Normalize.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Normalize.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 889 by dpavlin, Thu Sep 6 19:12:15 2007 UTC revision 912 by dpavlin, Tue Oct 30 17:40:13 2007 UTC
# Line 7  use Exporter 'import'; Line 7  use Exporter 'import';
7          _debug          _debug
8          _pack_subfields_hash          _pack_subfields_hash
9    
10          tag search display          search_display search display
11    
12          marc marc_indicators marc_repeatable_subfield          marc marc_indicators marc_repeatable_subfield
13          marc_compose marc_leader marc_fixed          marc_compose marc_leader marc_fixed
14          marc_duplicate marc_remove marc_count          marc_duplicate marc_remove marc_count
# Line 42  WebPAC::Normalize - describe normalisato Line 43  WebPAC::Normalize - describe normalisato
43    
44  =head1 VERSION  =head1 VERSION
45    
46  Version 0.29  Version 0.30
47    
48  =cut  =cut
49    
50  our $VERSION = '0.29';  our $VERSION = '0.30';
51    
52  =head1 SYNOPSIS  =head1 SYNOPSIS
53    
# Line 59  means that you check it's validity befor Line 60  means that you check it's validity befor
60  C<perl -c normalize.pl>.  C<perl -c normalize.pl>.
61    
62  Normalisation can generate multiple output normalized data. For now, supported output  Normalisation can generate multiple output normalized data. For now, supported output
63  types (on the left side of definition) are: C<tag>, C<display>, C<search> and  types (on the left side of definition) are: C<search_display>, C<display>, C<search> and
64  C<marc>.  C<marc>.
65    
66  =head1 FUNCTIONS  =head1 FUNCTIONS
# Line 442  sub _debug { Line 443  sub _debug {
443    
444  Those functions generally have to first in your normalization file.  Those functions generally have to first in your normalization file.
445    
446  =head2 tag  =head2 search_display
447    
448  Define new tag for I<search> and I<display>.  Define output for L<search> and L<display> at the same time
449    
450    tag('Title', rec('200','a') );    search_display('Title', rec('200','a') );
451    
452    
453  =cut  =cut
454    
455  sub tag {  sub search_display {
456          my $name = shift or die "tag needs name as first argument";          my $name = shift or die "search_display needs name as first argument";
457          my @o = grep { defined($_) && $_ ne '' } @_;          my @o = grep { defined($_) && $_ ne '' } @_;
458          return unless (@o);          return unless (@o);
         $out->{$name}->{tag} = $name;  
459          $out->{$name}->{search} = \@o;          $out->{$name}->{search} = \@o;
460          $out->{$name}->{display} = \@o;          $out->{$name}->{display} = \@o;
461  }  }
462    
463  =head2 display  =head2 display
464    
465  Define tag just for I<display>  Define output just for I<display>
466    
467    @v = display('Title', rec('200','a') );    @v = display('Title', rec('200','a') );
468    
# Line 472  sub display { Line 472  sub display {
472          my $name = shift or die "display needs name as first argument";          my $name = shift or die "display needs name as first argument";
473          my @o = grep { defined($_) && $_ ne '' } @_;          my @o = grep { defined($_) && $_ ne '' } @_;
474          return unless (@o);          return unless (@o);
         $out->{$name}->{tag} = $name;  
475          $out->{$name}->{display} = \@o;          $out->{$name}->{display} = \@o;
476  }  }
477    
# Line 488  sub search { Line 487  sub search {
487          my $name = shift or die "search needs name as first argument";          my $name = shift or die "search needs name as first argument";
488          my @o = grep { defined($_) && $_ ne '' } @_;          my @o = grep { defined($_) && $_ ne '' } @_;
489          return unless (@o);          return unless (@o);
         $out->{$name}->{tag} = $name;  
490          $out->{$name}->{search} = \@o;          $out->{$name}->{search} = \@o;
491  }  }
492    
# Line 1232  Consult config values stored in C<config Line 1230  Consult config values stored in C<config
1230    $database_code = config();    # use _ from hash    $database_code = config();    # use _ from hash
1231    $database_name = config('name');    $database_name = config('name');
1232    $database_input_name = config('input name');    $database_input_name = config('input name');
   $tag = config('input normalize tag');  
1233    
1234  Up to three levels are supported.  Up to three levels are supported.
1235    

Legend:
Removed from v.889  
changed lines
  Added in v.912

  ViewVC Help
Powered by ViewVC 1.1.26