output modules can now define add_row as opposed to add to get input row before norma...
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 28 May 2009 10:15:20 +0000 (10:15 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 28 May 2009 10:15:20 +0000 (10:15 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1198 07558da8-63fa-0310-ba24-9fe276d99e06

TODO
lib/WebPAC/Output/CouchDB.pm
run.pl
t/5-output-couchdb.t

diff --git a/TODO b/TODO
index 48b2516..601ad12 100644 (file)
--- a/TODO
+++ b/TODO
@@ -55,6 +55,7 @@
 + use UTF-8 as internal encoding
 + dump stats into var/stats.yml
 + WebPAC::Output::SWISH for indexing with swish-e [2.35]
++ output modules can now define add_row as opposed to add to get input row before normalization
 - implement attribute labels in webpac2.cgi
 - fix encoding for swish-e and/or webpac2.cgi
 - marc_clone to copy records/fields/indicators from input marc
index 0c1c69b..7ca5411 100644 (file)
@@ -60,7 +60,7 @@ Adds one entry to database.
 
 =cut
 
-sub add {
+sub add_row {
        my $self = shift;
 
        my ( $id, $ds ) = @_;
diff --git a/run.pl b/run.pl
index e933728..5f7b247 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -603,6 +603,9 @@ foreach my $database ( sort keys %{ $config->databases } ) {
                                push @{ $row->{'000'} }, $pos;
                        }
 
+                       foreach my $out ( @output_modules ) {
+                               $out->add_row( $mfn, $row ) if $out->can('add_row');
+                       }
 
                        if ($validate) {
                                if ( my $errors = $validate->validate_rec( $row, $input_db->dump_ascii ) ) {
index fe94498..196c9a4 100755 (executable)
@@ -38,13 +38,13 @@ my $ds = {
        },
 };
 
-ok( $out->add( 42, $ds ), 'add 42' );
+ok( $out->add_row( 42, $ds ), 'add 42' );
 
 my @strange = ( qw/èajðinica odma¹æivanje ¾abokreèina ¹uma/ );
 
-ok( $out->add( 99, { foo => { search => [ @strange ] } } ), 'add 99' );
+ok( $out->add_row( 99, { foo => { search => [ @strange ] } } ), 'add 99' );
 
-ok( $out->add( 100, { foo => { search => [ qw/foo bar baz/ ] } } ), 'add 100' );
+ok( $out->add_row( 100, { foo => { search => [ qw/foo bar baz/ ] } } ), 'add 100' );
 
 ok( $out->finish, 'finish' );