/[webpac]/trunk/xmlify.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

Annotation of /trunk/xmlify.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations)
Thu Jan 16 17:35:54 2003 UTC (16 years, 10 months ago) by dpavlin
File size: 389 byte(s)
bunch of changes: make design more modular, implement index (partial
implementation) and other small and big changes

1 dpavlin 10 #
2     # small function that creates one xml tag
3     #
4    
5     # Escape <, >, & and ", and to produce valid XML
6     my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');
7     my $escape_re = join '|' => keys %escape;
8    
9     sub xmlify {
10     my $tag = shift;
11     my $out;
12    
13     $out .= " <$tag>";
14     foreach my $v (@_) {
15     $v =~ s/($escape_re)/$escape{$1}/g;
16     $out .= $v;
17     }
18     $out .= "</$tag>\n";
19     return $out;
20     }

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26