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

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

revision 1068 by dpavlin, Tue Nov 27 23:45:28 2007 UTC revision 1069 by dpavlin, Tue Nov 27 23:54:43 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4  use strict;  use strict;
5    
6  use Carp qw/confess/;  use Carp qw/confess/;
7    use Data::Dump qw/dump/;
8    
9  =head1 NAME  =head1 NAME
10    
11  WebPAC::Output - The great new WebPAC::Output!  WebPAC::Output - The great new WebPAC::Output!
12    
 =head1 VERSION  
   
 Version 0.01  
   
13  =cut  =cut
14    
 our $VERSION = '0.01';  
   
15  =head1 SYNOPSIS  =head1 SYNOPSIS
16    
17  Common routines for output formats  Common routines for output formats
# Line 26  Common routines for output formats Line 21  Common routines for output formats
21  =head2 ds_to_hash  =head2 ds_to_hash
22    
23    my $hash = $self->ds_to_hash( $ds, 'display'    my $hash = $self->ds_to_hash( $ds, 'display'
24          disable_key_mungle => 1,          disable_key_mungle => 0,
25            singe_values = 0,
26    );    );
27    
28  =cut  =cut
# Line 48  sub ds_to_hash { Line 44  sub ds_to_hash {
44                          $name =~ s/\W+/_/g;                          $name =~ s/\W+/_/g;
45                  }                  }
46    
47                    my $v = $ds->{$t} || die "bug";
48    
49                  # FIXME get rid of non hash values in data_structure for consistency?                  # FIXME get rid of non hash values in data_structure for consistency?
50                  next unless ref($ds->{$t}) eq 'HASH';                  next unless ref($v) eq 'HASH';
51    
52                  if ( defined( $ds->{$t}->{$type} ) ) {                  if ( defined( $v->{$type} ) ) {
53                          $hash->{$name} = $ds->{$t}->{$type};                          if ( $opt->{single_values} && ref($v->{$type}) eq 'ARRAY' ) {
54                                    $hash->{$name} = join(' ', map {
55                                            if(ref($_)) {
56                                                    dump($_);
57                                            } else {
58                                                    $_;
59                                            }
60                                    } @{ $v->{$type} });
61                            } else {
62                                    $hash->{$name} = $v->{$type};
63                            }
64                  }                  }
65          }          }
66    

Legend:
Removed from v.1068  
changed lines
  Added in v.1069

  ViewVC Help
Powered by ViewVC 1.1.26