/[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 597 by dpavlin, Thu Jul 13 11:54:33 2006 UTC revision 613 by dpavlin, Wed Aug 23 11:04:32 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.08  Version 0.10
20    
21  =cut  =cut
22    
23  our $VERSION = '0.08';  our $VERSION = '0.10';
24    
25  =head1 SYNOPSIS  =head1 SYNOPSIS
26    
# Line 252  sub open { Line 252  sub open {
252                    
253                                  $l =~ s/($recode_regex)/$recode_map->{$1}/g if ($recode_regex && $recode_map);                                  $l =~ s/($recode_regex)/$recode_map->{$1}/g if ($recode_regex && $recode_map);
254    
255                                  return $l unless ($rec_regex);                                  ## FIXME remove this warning when we are sure that none of API is calling
256                                    ## this wrongly
257                                    #warn "filter called without field number" unless ($f_nr);
258    
259                                    return $l unless ($rec_regex && $f_nr);
260    
261    #                               my $max_regex = 100;
262    
263                                  # apply regexps                                  # apply regexps
264                                  if ($rec_regex && defined($rec_regex->{$f_nr})) {                                  if ($rec_regex && defined($rec_regex->{$f_nr})) {
265                                          $log->logconfess("regexps->{$f_nr} must be ARRAY") if (ref($rec_regex->{$f_nr}) ne 'ARRAY');                                          $log->logconfess("regexps->{$f_nr} must be ARRAY") if (ref($rec_regex->{$f_nr}) ne 'ARRAY');
266                                          my $c = 0;                                          my $c = 0;
267                                          foreach my $r (@{ $rec_regex->{$f_nr} }) {                                          foreach my $r (@{ $rec_regex->{$f_nr} }) {
268                                                  while ( eval '$l =~ ' . $r ) { $c++ };                                                  #$log->debug("\$l = $l\neval \$l =~ $r");
269                                                    eval '$l =~ ' . $r;
270                                                    $log->error("error applying regex: $r") if ($@);
271    
272    #                                               while ( $c < $max_regex && eval '$l =~ ' . $r ) { $c++ };
273    #                                               $log->error("field $f_nr has more than $max_regex regex iterations\n\$l = $l\neval \$l =~ $r") if ($c == $max_regex);
274    
275                                          }                                          }
                                         warn "## field $f_nr triggered $c regexpes\n" if ($c && $self->{debug});  
276                                  }                                  }
277    
278                                  return $l;                                  return $l;
# Line 522  sub stats { Line 533  sub stats {
533          return $out;          return $out;
534  }  }
535    
536  =head1 modify_record_regexps  =head2 modify_record_regexps
537    
538  Generate hash with regexpes to be applied using L<filter>.  Generate hash with regexpes to be applied using L<filter>.
539    
# Line 604  Dobrica Pavlinusic, C<< <dpavlin@rot13.o Line 615  Dobrica Pavlinusic, C<< <dpavlin@rot13.o
615    
616  =head1 COPYRIGHT & LICENSE  =head1 COPYRIGHT & LICENSE
617    
618  Copyright 2005 Dobrica Pavlinusic, All Rights Reserved.  Copyright 2005-2006 Dobrica Pavlinusic, All Rights Reserved.
619    
620  This program is free software; you can redistribute it and/or modify it  This program is free software; you can redistribute it and/or modify it
621  under the same terms as Perl itself.  under the same terms as Perl itself.

Legend:
Removed from v.597  
changed lines
  Added in v.613

  ViewVC Help
Powered by ViewVC 1.1.26