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

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

revision 405 by dpavlin, Sun Feb 19 22:40:40 2006 UTC revision 413 by dpavlin, Mon Feb 20 21:47:54 2006 UTC
# Line 552  It also has follwing template toolikit f Line 552  It also has follwing template toolikit f
552    
553  =cut  =cut
554    
555    # Escape <, >, & and ", and to produce valid XML
556    my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  
557    my $escape_re  = join '|' => keys %escape;
558    
559  sub apply {  sub apply {
560          my $self = shift;          my $self = shift;
561    
# Line 599  C<d('FieldName','delimiter')>, where C<d Line 603  C<d('FieldName','delimiter')>, where C<d
603                          if (ref($v) eq 'ARRAY') {                          if (ref($v) eq 'ARRAY') {
604                                  if ($#{$v} == 0) {                                  if ($#{$v} == 0) {
605                                          $v = $v->[0];                                          $v = $v->[0];
606                                            $v =~ s/($escape_re)/$escape{$1}/g;
607                                  } else {                                  } else {
608                                          $join = $default_delimiter->{$type} unless defined($join);                                          $join = $default_delimiter->{$type} unless defined($join);
609                                          $v = join($join, @{$v});                                          $v = join($join, map {
610                                                    s/($escape_re)/$escape{$1}/g;
611                                            } @{$v});
612                                  }                                  }
613                          } else {                          } else {
614                                  warn("TT filter $type(): field $name values aren't ARRAY, ignoring");                                  warn("TT filter $type(): field $name values aren't ARRAY, ignoring");

Legend:
Removed from v.405  
changed lines
  Added in v.413

  ViewVC Help
Powered by ViewVC 1.1.26