blib/lib/Amon2/Plugin/Web/FillInForm.pm

filter: Statementstmt 47.0% 16 / 34 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 0.0% 0 / 1 totaltotal 41.1% 21 / 51 CC 3 SCAR 9.6
CC
3
Cov
41%
_fillin_form
6.0
init
3.8
_fillin_form2
2.0
CRAP 2.6
↑ Summary
1 package Amon2::Plugin::Web::FillInForm;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = '0.02';
6  
7 1 ▶use HTML::FillInForm;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub init {
Subroutine init: not called CC=2 SCAR=13.4
Pod undocumented
10 0 my ($class, $c, $conf) = @_;
11  
12 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶ my $klass = ref $c || $c;
Condition0%0/3
ref $c || $c
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $c || $c
ref $c $c
Truth table0%0/3
A || B
A= ref $cB= $c
ABresult
1X1
011
000
15 0 *{"$klass\::fillin_form"} = \&_fillin_form2;
16  
17 0 my $response_class = ref $c->create_response();
18 0 *{"$response_class\::fillin_form"} = \&_fillin_form;
19 }
20  
21 0 ▶sub _fillin_form2 {
Subroutine _fillin_form2: not called CC=1 SCAR=6.9
22 0 my ($self, @stuff) = @_;
23 $self->add_trigger(
24 0 ▶ 'HTML_FILTER' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 my ($c, $html) = @_;
26 0 return HTML::FillInForm->fill(\$html, @stuff);
27 },
28 0 );
29 }
30  
31 # DEPRECATED interface
32 0 ▶sub _fillin_form {
Subroutine _fillin_form: not called CC=2 SCAR=17.9
33 0 my ($self, @stuff) = @_;
34  
35 0 Carp::cluck("\$res->fillin_form() was deprecated. Use \$c->fillin_form(\$stuff) instead.");
36  
37 0 my $html = $self->body();
38 0 my $output = HTML::FillInForm->fill(\$html, @stuff);
39 0 $self->body($output);
40 0 ▶ $self->header('Content-Length' => length($output)) if $self->header('Content-Length');
Branch: 1 branch
BranchTrueFalseTotal
if $self->header("Content-Length") 0 0 0
41 0 return $self;
42 }
43  
44  
45  
46 1 1;
47 __END__
↑ Summary