1 package WebPAC::Output::JSON;
6 use base qw/WebPAC::Common WebPAC::Output Class::Accessor/;
7 __PACKAGE__->mk_accessors(qw(path));
9 #use Encode qw/from_to/;
10 use Data::Dump qw/dump/;
16 WebPAC::Output::JSON - Create JSON output
24 our $VERSION = '0.00';
28 Create JSON output for export into other sistems
34 my $output = new WebPAC::Output::JSON({
35 path => '/path/to/file.js',
56 my $log = $self->_get_logger;
68 Adds one entry to database.
79 my $log = $self->_get_logger;
80 $log->logdie("need id") unless defined $id;
81 $log->logdie("need ds") unless $ds;
83 $log->debug("id: $id ds = ",dump($ds));
85 push @{ $self->{_data} }, $self->ds_to_hash( $ds, 'display' );
99 my $log = $self->_get_logger();
101 $log->info("writing JSON output to ", $self->path);
102 write_file( $self->path, objToJson( { items => $self->{_data} } ) );
108 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
110 =head1 COPYRIGHT & LICENSE
112 Copyright 2007 Dobrica Pavlinusic, All Rights Reserved.
114 This program is free software; you can redistribute it and/or modify it
115 under the same terms as Perl itself.
119 1; # End of WebPAC::Output::JSON