Widget/Filter/HTMLStrip.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 CC 1 SCAR 6.9
CC
1
Cov
0%
filter
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package HTML::Widget::Filter::HTMLStrip;
2  
3 use warnings;
4 use strict;
5 use base 'HTML::Widget::Filter';
6 use HTML::Scrubber;
7  
8 __PACKAGE__->mk_accessors(qw/allow/);
9  
10 =head1 NAME
11  
12 HTML::Widget::Filter::HTMLStrip - HTML Strip Filter
13  
14 =head1 SYNOPSIS
15  
16 my $f = $widget->filter( 'HTMLStrip', 'foo' )->allow( 'br', 'a' );
17  
18 =head1 DESCRIPTION
19  
20 HTML Strip Filter.
21  
22 =head1 METHODS
23  
24 =head2 allow
25  
26 Accepts a list of HTML tags which shouldn't be stripped
27  
28 =head2 filter
29  
30 =cut
31  
32 sub filter {
33 my ( $self, $value ) = @_;
34 my $allowed = $self->allow || [];
35 my $scrubber = HTML::Scrubber->new( allow => $allowed );
36 return $scrubber->scrub($value);
37 }
38  
39 =head1 AUTHOR
40  
41 Lyo Kato, C<lyo.kato@gmail.com>
42  
43 =head1 LICENSE
44  
45 This library is free software, you can redistribute it and/or modify it under
46 the same terms as Perl itself.
47  
48 =cut
49  
50 1;