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

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

revision 1206 by dpavlin, Fri May 29 20:55:54 2009 UTC revision 1364 by dpavlin, Thu Apr 21 17:10:04 2011 UTC
# Line 123  sub data_structure { Line 123  sub data_structure {
123          $load_row_coderef = $arg->{load_row_coderef};          $load_row_coderef = $arg->{load_row_coderef};
124    
125          no strict 'subs';          no strict 'subs';
126          no warnings 'redefine';          no warnings 'all';
127          eval "$arg->{rules};";          eval "$arg->{rules};";
128          die "error evaling $arg->{rules}: $@\n" if ($@);          die "error evaling $arg->{rules}: $@\n" if ($@);
129    
# Line 153  sub _set_ds { Line 153  sub _set_ds {
153    
154  sub _get_rec { $rec };  sub _get_rec { $rec };
155    
 sub rec_array {  
         my $d = $rec->{ $_[0] };  
         return @$d if ref($d) eq 'ARRAY';  
         die "field $_[0] not array: ",dump( $d );  
 }  
   
156  =head2 _set_config  =head2 _set_config
157    
158  Set current config hash  Set current config hash
# Line 366  Insert new row of data into output modul Line 360  Insert new row of data into output modul
360  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
361    
362  sub row {  sub row {
363          die "array doesn't have even number of elements but $#_: ",dump( @_ ) if $#_ % 2 != 1;          die "array doesn't have odd number of elements but $#_: ",dump( @_ ) if $#_ % 2 == 1;
364            my $table = shift @_;
365          push @{ $out->{'_rows'} }, {@_};          push @{ $out->{'_rows'}->{$table} }, {@_};
366  }  }
367    
368    
# Line 956  sub count { Line 950  sub count {
950          return @_ . '';          return @_ . '';
951  }  }
952    
953    =head2 rec_array
954    
955    Always return field as array
956    
957      foreach my $d ( rec_array('field') ) {
958            warn $d;
959      }
960    
961    =cut
962    
963    sub rec_array {
964            my $d = $rec->{ $_[0] };
965            return @$d if ref($d) eq 'ARRAY';
966            return ($d);
967    }
968    
969  # END  # END
970  1;  1;

Legend:
Removed from v.1206  
changed lines
  Added in v.1364

  ViewVC Help
Powered by ViewVC 1.1.26