1 package WebPAC::Output::JSON;
6 use base qw/WebPAC::Common WebPAC::Output Class::Accessor/;
7 __PACKAGE__->mk_accessors(qw(path));
9 use Data::Dump qw/dump/;
15 WebPAC::Output::JSON - Create JSON output
23 our $VERSION = '0.00';
27 Create JSON output for export into other sistems
33 my $out = new WebPAC::Output::JSON({
34 path => '/path/to/file.js',
55 my $log = $self->_get_logger;
67 Adds one entry to database.
78 my $log = $self->_get_logger;
79 $log->logdie("need id") unless defined $id;
80 $log->logdie("need ds") unless $ds;
82 $log->debug("id: $id ds = ",sub { dump($ds) });
84 push @{ $self->{_data} }, $self->ds_to_hash( $ds, 'display' );
98 my $log = $self->_get_logger();
100 $log->info("writing JSON output to ", $self->path);
101 write_file( $self->path, objToJson( { items => $self->{_data} } ) );
107 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
109 =head1 COPYRIGHT & LICENSE
111 Copyright 2007 Dobrica Pavlinusic, All Rights Reserved.
113 This program is free software; you can redistribute it and/or modify it
114 under the same terms as Perl itself.
118 1; # End of WebPAC::Output::JSON