File Coverage

blib/lib/HTML/Template/ESCAPE/JS.pm
Criterion Covered Total %
statement 17 17 100.0
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1             package HTML::Template::ESCAPE::JS;
2 5     5   1655 use strict;
  5         13  
  5         235  
3 5     5   28 use warnings FATAL => 'all';
  5         11  
  5         236  
4 5     5   27 use base qw(HTML::Template::ESCAPE);
  5         9  
  5         1887  
5             our $VERSION = '2.9';
6              
7             sub output {
8 23     23 0 34 my $self = shift;
9 23 50       72 $_ = shift if (@_ > 0);
10 23         275 s/\\/\\\\/g;
11 23         41 s/'/\\'/g;
12 23         37 s/"/\\"/g;
13 23         40 s/\n/\\n/g;
14 23         35 s/\r/\\r/g;
15 23         71 $_;
16             }
17              
18             1;