/[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 333 by dpavlin, Sat Dec 31 13:42:11 2005 UTC revision 344 by dpavlin, Sat Jan 7 02:05:55 2006 UTC
# Line 317  sub parse { Line 317  sub parse {
317    
318          my @out;          my @out;
319    
320          $log->debug("format: $format");          $log->debug("format: $format [$i]");
321    
322          my $eval_code;          my $eval_code;
323          # remove eval{...} from beginning          # remove eval{...} from beginning
# Line 328  sub parse { Line 328  sub parse {
328          $filter_name = $1 if ($format =~ s/^filter{([^}]+)}//s);          $filter_name = $1 if ($format =~ s/^filter{([^}]+)}//s);
329    
330          # did we found any (att all) field from format in row?          # did we found any (att all) field from format in row?
331          my $found_any = 0;          my $found_any;
332          # prefix before first field which we preserve it $found_any          # prefix before first field which we preserve it $found_any
333          my $prefix;          my $prefix;
334    
# Line 339  sub parse { Line 339  sub parse {
339                  my $del = $1 || '';                  my $del = $1 || '';
340                  $prefix = $del if ($f_step == 1);                  $prefix = $del if ($f_step == 1);
341    
342                    my $fld_type = lc($2);
343    
344                  # repeatable index                  # repeatable index
345                  my $r = $i;                  my $r = $i;
346                  $r = 0 if (lc("$2") eq 's');                  if ($fld_type eq 's') {
347                            if ($found_any->{'v'}) {
348                                    $r = 0;
349                            } else {
350                                    return;
351                            }
352                    }
353    
354                  my $found = 0;                  my $found = 0;
355                  my $tmp = $self->get_data(\$rec,$3,$4,$r,\$found);                  my $tmp = $self->get_data(\$rec,$3,$4,$r,\$found);
356    
357                  if ($found) {                  if ($found) {
358                          $found_any += $found;                          $found_any->{$fld_type} += $found;
359    
360                          # we will skip delimiter before first occurence of field!                          # we will skip delimiter before first occurence of field!
361                          push @out, $del unless($found_any == 1);                          push @out, $del unless($found_any->{$fld_type} == 1);
362                          push @out, $tmp;                          push @out, $tmp;
363                  }                  }
364                  $f_step++;                  $f_step++;
365          }          }
366    
367          return if (! $found_any);          # test if any fields found?
368            return if (! $found_any->{'v'} && ! $found_any->{'s'});
369    
370          my $out = join('',@out);          my $out = join('',@out);
371    

Legend:
Removed from v.333  
changed lines
  Added in v.344

  ViewVC Help
Powered by ViewVC 1.1.26