blib/lib/App/SimpleScan/Plugin/Plaintext.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 8 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 10 / 10 Podpod 100% 4 / 4 totaltotal 96.7% 59 / 61 CC 6 SCAR 9.0
CC
6
Cov
98%
plaintext_pragma
5.0
filter
2.0
BEGIN
1.0
CRAP 2.5
↑ Summary
1 package App::SimpleScan::Plugin::Plaintext;
2  
3 6 our $VERSION = '1.02';
4  
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use base qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 __PACKAGE__->mk_accessors( qw(plaintext) );
11  
12 # Module implementation here
13 5 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
14 6 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 *{caller() . '::plaintext'} = \&plaintext;
16 }
17  
18 4 ▶sub pragmas {
Subroutine pragmas: called CC=1 SCAR=0.0
Pod documented
19 4 return (['plaintext' => \&plaintext_pragma],
20 );
21 }
22  
23 4 ▶sub plaintext_pragma {
Subroutine plaintext_pragma: called CC=5 SCAR=16.1
Pod documented
24 4 my($self, $args) = @_;
25 4 ▶ if( !defined $args or length($args) == 0) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $args or length $args == 0) { } 1 3 4
elsif ($args =~ /^(on|1)/i) { } 1 2 3
elsif ($args =~ /^(off|0)/i) { } 1 1 2
Condition66%2/3
not defined $args or length $args == 0
l!l&&r!l&&!r
103
MC/DC50%1/2
not defined $args or length $args == 0
not defined $args length $args == 0
Truth table66%2/3
not(A) or B
A= not defined $argsB= length $args == 0
ABresult
1X1
011
000
26 1 $self->stack_test( qq(fail "Missing argument for %%plaintext";\n) );
27 }
28 elsif ($args =~ /^(on|1)/i) {
29 1 $self->plaintext('1');
30 }
31 elsif ($args =~ /^(off|0)/i) {
32 1 $self->plaintext('0');
33 }
34 else {
35 1 $self->stack_test( qq(fail "Invalid argument for %%plaintext: $args";\n) );
36 }
37 }
38  
39 4 ▶sub filters {
Subroutine filters: called CC=1 SCAR=0.0
Pod documented
40 4 return \&filter;
41 }
42  
43 6 ▶sub filter {
Subroutine filter: called CC=2 SCAR=6.9
Pod documented
44 6 my ($self, @code) = @_;
45 6 ▶ if ($self->plaintext) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->plaintext) 1 5 6
46 1 @code = map { s/page_(.*?)like/text_${1}like/; $_ } @code;
47 }
48 6 return @code;
49 }
50  
51  
52 6 1; # Magic true value required at end of module
53 __END__
↑ Summary