/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 225 - (hide annotations)
Sat Nov 1 00:59:02 2008 UTC (15 years, 6 months ago) by dpavlin
File size: 257 byte(s)
role for html_escape
1 dpavlin 225 package Frey::Escape;
2     use Moose::Role;
3    
4     my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');
5     my $escape_re = join '|' => keys %escape;
6    
7     sub html_escape {
8     my ( $self, $html ) = @_;
9     $html =~ s/($escape_re)/$escape{$1}/g;
10     return $html;
11     }
12    

  ViewVC Help
Powered by ViewVC 1.1.26