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

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

revision 585 by dpavlin, Wed Jul 5 19:52:45 2006 UTC revision 593 by dpavlin, Sun Jul 9 15:22:39 2006 UTC
# Line 16  WebPAC::Input - read different file form Line 16  WebPAC::Input - read different file form
16    
17  =head1 VERSION  =head1 VERSION
18    
19  Version 0.07  Version 0.08
20    
21  =cut  =cut
22    
23  our $VERSION = '0.07';  our $VERSION = '0.08';
24    
25  =head1 SYNOPSIS  =head1 SYNOPSIS
26    
# Line 300  sub open { Line 300  sub open {
300    
301                  # update counters for statistics                  # update counters for statistics
302                  if ($self->{stats}) {                  if ($self->{stats}) {
303                          map {  
304                                  my $fld = $_;                          foreach my $fld (keys %{ $rec }) {
305                                  $self->{_stats}->{fld}->{ $fld }++;                                  $self->{_stats}->{fld}->{ $fld }++;
306                                  if (ref($rec->{ $fld }) eq 'ARRAY') {  
307                                          map {                                  $log->logdie("invalid record fild $fld, not ARRAY")
308                                                  if (ref($_) eq 'HASH') {                                          unless (ref($rec->{ $fld }) eq 'ARRAY');
309                                                          map {          
310                                                                  $self->{_stats}->{sf}->{ $fld }->{ $_ }++;                                  foreach my $row (@{ $rec->{$fld} }) {
311                                                          } keys %{ $_ };  
312                                                  } else {                                          if (ref($row) eq 'HASH') {
313                                                          $self->{_stats}->{repeatable}->{ $fld }++;  
314                                                    foreach my $sf (keys %{ $row }) {
315                                                            $self->{_stats}->{sf}->{ $fld }->{ $sf }->{count}++;
316                                                            $self->{_stats}->{sf}->{ $fld }->{ $sf }->{repeatable}++
317                                                                            if (ref($row->{$sf}) eq 'ARRAY');
318                                                  }                                                  }
319                                          } @{ $rec->{$fld} };  
320                                            } else {
321                                                    $self->{_stats}->{repeatable}->{ $fld }++;
322                                            }
323                                  }                                  }
324                          } keys %{ $rec };                          }
325                  }                  }
326    
327                  $self->progress_bar($pos,$to_rec) unless ($self->{no_progress_bar});                  $self->progress_bar($pos,$to_rec) unless ($self->{no_progress_bar});
# Line 469  sub stats { Line 476  sub stats {
476    
477                          if (defined($s->{sf}->{$f})) {                          if (defined($s->{sf}->{$f})) {
478                                  map {                                  map {
479                                          $o .= sprintf(" %s:%d", $_, $s->{sf}->{$f}->{$_});                                          $o .= sprintf(" %s:%d%s", $_,
480                                                    $s->{sf}->{$f}->{$_}->{count},
481                                                    $s->{sf}->{$f}->{$_}->{repeatable} ? '*' : '',
482                                            );
483                                  } sort keys %{ $s->{sf}->{$f} };                                  } sort keys %{ $s->{sf}->{$f} };
484                          }                          }
485    

Legend:
Removed from v.585  
changed lines
  Added in v.593

  ViewVC Help
Powered by ViewVC 1.1.26