/[Frey]/trunk/lib/Frey/Escape.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

Contents of /trunk/lib/Frey/Escape.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 327 - (show annotations)
Thu Nov 6 20:56:44 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 399 byte(s)
improvements to dumper, use html_dump to correctly dump html data
1 package Frey::Escape;
2 use Moose::Role;
3
4 use Data::Dump qw/dump/;
5
6 my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');
7 my $escape_re = join '|' => keys %escape;
8
9 sub html_escape {
10 my ( $self, $html ) = @_;
11 $html =~ s/($escape_re)/$escape{$1}/g;
12 return $html;
13 }
14
15 sub html_dump {
16 my $self = shift;
17 my $html = dump( @_ );
18 $html =~ s/($escape_re)/$escape{$1}/g;
19 return $html;
20 }

  ViewVC Help
Powered by ViewVC 1.1.26