blib/lib/Template/Plugin/HTMLToJS.pm

filter: Statementstmt 64.7% 11 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 68.1% 15 / 22 CC 1 SCAR 2.2
CC
1
Cov
65%
filter
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 #
2 # This file is part of Template-Plugin-HTMLToJS
3 #
4 # This software is copyright (c) 2014 by celogeek <me@celogeek.com>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 package Template::Plugin::HTMLToJS;
10  
11 # ABSTRACT: Convert HTML To JS
12  
13 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 our $VERSION = '0.5'; # VERSION
17  
18 1 ▶use parent 'Template::Plugin::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 0 ▶sub filter {
Subroutine filter: not called CC=1 SCAR=6.9
Pod documented
21 0 my ( $self, $text ) = @_;
22 0 $text =~ s/\n/ /gx;
23 0 $text =~ s/'/'+"'"+'/gx;
24 0 $text =~ s/\//'+"\/"+'/gx;
25 0 $text =~ s/<(\/|)\bscript\b/<$1scr'+'ipt/gx;
26 0 return 'document.write(\'' . $text . '\');';
27 }
28  
29 1 1;
30  
31 __END__
↑ Summary