| 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
Condition66%2/3
not defined $args or length $args == 0
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
| |||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||