/[webpac2]/trunk/lib/WebPAC/Output/JSON.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/Output/JSON.pm

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

revision 912 by dpavlin, Thu Aug 23 20:56:59 2007 UTC revision 913 by dpavlin, Tue Oct 30 20:11:02 2007 UTC
# Line 3  package WebPAC::Output::JSON; Line 3  package WebPAC::Output::JSON;
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use base qw/WebPAC::Common Class::Accessor/;  use base qw/WebPAC::Common WebPAC::Output Class::Accessor/;
7  __PACKAGE__->mk_accessors(qw(path));  __PACKAGE__->mk_accessors(qw(path));
8    
9  #use Encode qw/from_to/;  #use Encode qw/from_to/;
# Line 82  sub add { Line 82  sub add {
82    
83          $log->debug("id: $id ds = ",dump($ds));          $log->debug("id: $id ds = ",dump($ds));
84    
85          my $item;          push @{ $self->{_data} }, $self->ds_to_hash( $ds, 'display' );
   
         foreach my $t ( keys %$ds ) {  
                 my $name = lc($t);  
                 $name =~ s/\W+/_/g;  
   
                 # FIXME get rid of non hash values in data_structure for consistency?  
                 next unless ref($ds->{$t}) eq 'HASH';  
   
                 if ( defined( $ds->{$t}->{display} ) ) {  
                         $item->{$name} = $ds->{$t}->{display};  
                 }  
         }  
   
         push @{ $self->{_data} }, $item;  
86    
87          return 1;          return 1;
88  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26