blib/lib/HTML/EscapeEvil/AllowAll.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 90.2% 37 / 41 CC 2 SCAR 2.6
CC
2
Cov
94%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package HTML::EscapeEvil::AllowAll;
2  
3 =pod
4  
5 =head1 NAME
6  
7 HTML::EscapeEvil::AllowAll - Escape tag.but all tag allow
8  
9 =head1 VERSION
10  
11 0.05
12  
13 =head1 SYNPSIS
14  
15 use HTML::EscapeEvil::AllowAll;
16 my $escapeallow = HTML::EscapeEvil::AllowAll->new;
17 print "script is " , ($escapeallow->allow_script) ? "allow" : "not allow";
18 print "style is " , ($escapeallow->allow_style) ? "allow" : "not allow";
19 $escapeallow->clear;
20  
21 =head1 DESCRIPTION
22  
23 Only tag where it wants to escape is specified with deny_tags method etc.
24  
25 and it uses it because it all enters the state of permission.
26  
27 =cut
28  
29 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 4 ▶use base qw(HTML::EscapeEvil);
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 4 our $VERSION = 0.05;
33  
34 =pod
35  
36 =head1 METHOD
37  
38 =head2 new
39  
40 Create HTML::EscapeEvil::AllowAll instance.
41  
42 =cut
43  
44 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod documented
45  
46 3 my $class = shift;
47 3 my $self = $class->SUPER::new;
48 3 ▶ bless $self, ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
49 3 $self->{_tag_map} = [];
50 3 $self->_init;
51 3 $self->allow_all;
52 3 $self;
53 }
54  
55 =pod
56  
57 =head2 allow_all
58  
59 All tags allow.
60  
61 Example :
62  
63 $escapeallow->allow_all;
64  
65 =cut
66  
67 3 ▶sub allow_all {
Subroutine allow_all: called CC=1 SCAR=0.0
Pod documented
68  
69 3 my $self = shift;
70 3 $self->allow_comment(1);
71 3 $self->allow_declaration(1);
72 3 $self->allow_process(1);
73 3 $self->allow_entity_reference(1);
74 3 $self->collection_process(1);
75  
76 3 $self->add_allow_tags( $self->_to_flat_array );
77 }
78  
79 =pod
80  
81 =head2 _to_flat_array
82  
83 Private method.
84  
85 =cut
86  
87 3 ▶sub _to_flat_array {
Subroutine _to_flat_array: called CC=1 SCAR=0.0
88  
89 3 map { @{$_} } @{shift->{_tag_map}};
90 }
91  
92 =pod
93  
94 =head2 _init
95  
96 Private method.
97  
98 =cut
99  
100 3 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
101  
102 3 my $self = shift;
103 $self->{_tag_map} = [
104 3 [ "a", "abbr", "acronym", "address", "area" ],
105 [ "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button" ],
106 [ "caption", "cite", "code", "col", "colgroup" ],
107 [ "dd", "del", "dfn", "div", "dl", "dt" ],
108 [ "em", "embed" ],
109 [ "fieldset", "frameset", "font", "form" ],
110 [ "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html" ],
111 [ "i", "iframe", "img", "input", "ins" ],
112 [ "kbd" ],
113 [ "label", "legend", "li", "link" ],
114 [ "map", "meta" ],
115 [ "nobr", "noscript" ],
116 [ "object", "ol", "optgroup", "option" ],
117 [ "p", "param", "pre" ],
118 [ "q" ],
119 [ "rb", "rbc", "rp", "rt", "rtc", "ruby" ],
120 [ "s", "samp", "script", "select", "small", "span", "strong", "strike", "style", "sub", "sup" ],
121 [ "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt" ],
122 [ "u", "ul" ],
123 [ "var" ]
124 ];
125 }
126  
127 4 1;
128  
129 __END__
↑ Summary