/[webpac]/trunk2/lib/WebPAC.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 /trunk2/lib/WebPAC.pm

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

revision 358 by dpavlin, Wed Jun 16 14:31:33 2004 UTC revision 359 by dpavlin, Wed Jun 16 15:41:16 2004 UTC
# Line 268  sub fill_in { Line 268  sub fill_in {
268    
269          my $found = 0;          my $found = 0;
270    
271            my $eval_code;
272            # remove eval{...} from beginning
273            $eval_code = $1 if ($format =~ s/^eval{([^}]+)}//s);
274    
275          # do actual replacement of placeholders          # do actual replacement of placeholders
276          $format =~ s/v(\d+)(?:\^(\w))*/$self->get_data(\$rec,$1,$2,$i,\$found)/ges;          $format =~ s/v(\d+)(?:\^(\w))*/$self->get_data(\$rec,$1,$2,$i,\$found)/ges;
277    
278          if ($found) {          if ($found) {
279                    if ($eval_code) {
280                            my $eval = $self->fill_in($rec,$eval_code,$i);
281                            return if (! eval $eval);
282                    }
283                  # do we have lookups?                  # do we have lookups?
284                  if ($format =~ /\[[^\[\]]+\]/o) {                  if ($format =~ /\[[^\[\]]+\]/o) {
285                          return $self->lookup($format);                          return $self->lookup($format);
# Line 355  sub parse { Line 363  sub parse {
363          my $prefix;          my $prefix;
364          my $all_found=0;          my $all_found=0;
365    
366  print "## $format\n";  #print "## $format\n";
367          while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))*//s) {          while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))*//s) {
368  print "## [ $1 | $2 | $3 ] $format\n";  #print "## [ $1 | $2 | $3 ] $format\n";
369    
370                  my $del = $1 || '';                  my $del = $1 || '';
371                  $prefix ||= $del;                  $prefix ||= $del if ($all_found == 0);
372    
373                  my $found = 0;                  my $found = 0;
374                  my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found);                  my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found);
# Line 374  print "## [ $1 | $2 | $3 ] $format\n"; Line 382  print "## [ $1 | $2 | $3 ] $format\n";
382    
383          return if (! $all_found);          return if (! $all_found);
384    
         print Dumper($prefix, \@out);  
   
385          my $out = join('',@out) . $format;          my $out = join('',@out) . $format;
386    
387          # add prefix if not there          # add prefix if not there
388          $out = $prefix . $out if ($out !~ m/^\Q$prefix\E/);          $out = $prefix . $out if ($out !~ m/^\Q$prefix\E/);
389                    
390            if ($eval_code) {
391                    my $eval = $self->fill_in($rec,$eval_code,$i);
392                    return if (! eval $eval);
393            }
394    
395          return $out;          return $out;
396  }  }
397    

Legend:
Removed from v.358  
changed lines
  Added in v.359

  ViewVC Help
Powered by ViewVC 1.1.26