/[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 357 by dpavlin, Wed Jun 16 13:39:17 2004 UTC revision 358 by dpavlin, Wed Jun 16 14:31:33 2004 UTC
# Line 4  use Carp; Line 4  use Carp;
4  use Text::Iconv;  use Text::Iconv;
5  use Config::IniFiles;  use Config::IniFiles;
6    
7    use Data::Dumper;
8    
9  =head1 NAME  =head1 NAME
10    
11  WebPAC - base class for WebPAC  WebPAC - base class for WebPAC
# Line 340  sub parse { Line 342  sub parse {
342    
343          my ($rec, $format, $i) = @_;          my ($rec, $format, $i) = @_;
344    
345            confess("need HASH as first argument!") if ($rec !~ /HASH/o);
346    
347            $i = 0 if (! $i);
348    
349          my @out;          my @out;
350    
351          my $eval_code;          my $eval_code;
352          # remove eval{...} from beginning          # remove eval{...} from beginning
353          $eval_code = $1 if ($format =~ s/^eval{([^}]+)}//s);          $eval_code = $1 if ($format =~ s/^eval{([^}]+)}//s);
354    
355          my $prefix = '';          my $prefix;
356          $prefix = $1 if ($format =~ s/^(.+)(v\d+(?:\^\w)*)/$2/s);          my $all_found=0;
357    
358          sub f_sf_del {  print "## $format\n";
359                  my ($self,$rec,$out,$f,$sf,$del,$i) = @_;          while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))*//s) {
360    print "## [ $1 | $2 | $3 ] $format\n";
361    
362                    my $del = $1 || '';
363                    $prefix ||= $del;
364    
365                    my $found = 0;
366                    my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found);
367    
                 my $found=0;  
                 my $tmp = $self->get_data($rec,$f,$sf,$i,\$found);  
368                  if ($found) {                  if ($found) {
369                          push @{$$out}, $tmp;                          push @out, $del;
370                          push @{$$out}, $del;                          push @out, $tmp;
371                            $all_found += $found;
372                  }                  }
                 return '';  
373          }          }
374    
375          #$format =~ s/(.*)v(\d+)(?:\^(\w))*/f_sf_del($self,\$rec,\@out,$2,$3,$1,$i/ges;          return if (! $all_found);
376    
377            print Dumper($prefix, \@out);
378    
379          print Dumper(@out);          my $out = join('',@out) . $format;
380    
381            # add prefix if not there
382            $out = $prefix . $out if ($out !~ m/^\Q$prefix\E/);
383            
384            return $out;
385  }  }
386    
387  1;  1;

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

  ViewVC Help
Powered by ViewVC 1.1.26