1 package WebPAC::Output::CouchDB;
6 use base qw/WebPAC::Common WebPAC::Output Class::Accessor/;
7 __PACKAGE__->mk_accessors(qw(
14 use Data::Dump qw/dump/;
19 WebPAC::Output::CouchDB - feed data into CouchDB
31 my $log = $self->_get_logger;
35 my $cdb = Net::CouchDb->new(
36 host => $self->host || "localhost",
37 port => $self->port || 5984,
40 $log->info("CouchDB server info ", dump( $cdb->server_info ) );
42 my $database = $self->database || 'webpac2';
44 $cdb->debug( $self->debug );
45 eval { $cdb->delete_db( $self->database ) };
46 $cdb->create_db( $self->database );
47 $self->{_cdb} = $cdb->db( $self->database );
55 Adds one entry to database.
66 my $log = $self->_get_logger;
68 my $doc = Net::CouchDb::Document->new( $id, $ds );
69 $self->{_cdb}->put( $doc );
83 my $log = $self->_get_logger();
92 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
94 =head1 COPYRIGHT & LICENSE
96 Copyright 2009 Dobrica Pavlinusic, All Rights Reserved.
98 This program is free software; you can redistribute it and/or modify it
99 under the same terms as Perl itself.
103 1; # End of WebPAC::Output::CouchDB