HTMLFilters/Filters.pm

filter: Statementstmt 77.4% 48 / 62 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.9% 17 / 21 Podpod n/a totaltotal 76.4% 65 / 85 CC 2 SCAR 4.7
CC
2
Cov
75%
__ANON__
6.0
__ANON__
2.0
__ANON__
1.8
CRAP 1.6
↑ Summary HTMLFilters/t/Basic.pm »
1 package Mason::Plugin::HTMLFilters::Filters;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Mason::Plugin::HTMLFilters::Filters::VERSION = '0.03';
4 }
5 1 ▶use Mason::PluginRole;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 my %html_escape = ( '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;' );
8 1 my $html_escape = qr/([&<>"])/;
9  
10 1 ▶method HTML () {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine HTML: called CC=1 SCAR=0.0
11 1 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
12 1 my $text = $_[0];
13 1 $text =~ s/$html_escape/$html_escape{$1}/mg;
14 1 return $text;
15 1 };
16 1 }
17 1 *H = *HTML;
18  
19 0 ▶method HTMLEntities (@args) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine HTMLEntities: not called CC=1 SCAR=4.9
20 0 require HTML::Entities;
21 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 HTML::Entities::encode_entities( $_[0], @args );
23 0 };
24 1 }
25  
26 1 ▶method URI () {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
27 1 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
29 1 my $text = $_[0];
30 1 $text =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
31 1 return $text;
32 1 };
33 1 }
34 1 *U = *URI;
35  
36 1 ▶method HTMLPara () {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine HTMLPara: called CC=1 SCAR=0.0
37 2 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
38 2 my $text = $_[0];
39 2 return "<p>\n" . join( "\n</p>\n\n<p>\n", split( /(?:\r?\n){2,}/, $text ) ) . "</p>\n";
40 2 };
41 1 }
42  
43 1 ▶method HTMLParaBreak () {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
44 1 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
45 1 my $text = $_[0];
46 1 $text =~ s|(\r?\n){2,}|$1<br />$1<br />$1|g;
47 1 return $text;
48 1 };
49 1 }
50  
51 0 ▶method FillInForm ($form_data, %options) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine __ANON__: not called CC=1 SCAR=5.6
52 0 require HTML::FillInForm;
53 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
54 0 my $html = $_[0];
55 0 ▶ return $html if !defined($form_data);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $form_data 0 0 0
56 0 return HTML::FillInForm->fill( \$html, $form_data, %options );
57 0 };
58 1 }
59  
60 1 1;
↑ Summary HTMLFilters/t/Basic.pm »