/[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 396 - (show annotations)
Tue Nov 18 01:44:10 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 355 byte(s)
simplify
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 $self->html_escape( dump( @_ ) );
18 }

  ViewVC Help
Powered by ViewVC 1.1.26