Widget/Field/reCAPTCHA.pm

filter: Statementstmt 88.2% 15 / 17 Branchbran 50.0% 1 / 2 Conditioncond 22.2% 2 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 56.4% 22 / 39 CC 5 SCAR 17.5
CC
5
Cov
64%
render
8.6
BEGIN
1.0
prepare_public_recaptcha_args
1.0
CRAP 5.8
« Field/reCAPTCHA.pm ↑ Summary
1 package HTML::FormHandlerX::Widget::Field::reCAPTCHA;
2  
3 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶sub render {
Subroutine render: called CC=5 SCAR=21.6
Pod undocumented
6 3 my ( $self, $result ) = @_;
7 3 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
030
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
8
9 3 ▶ if( !$self->value || ($self->value && $self->has_errors)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->value or $self->value and $self->has_errors) { } 3 0 3
Condition16%1/6
not $self->value or $self->value and $self->has_errors
l!l&&r!l&&!r
300
$self->value and $self->has_errors
!ll&&!rl&&r
000
MC/DC0%0/3
not $self->value or $self->value and $self->has_errors
not $self->value $self->value $self->has_errors
Truth table25%1/4
not(A) or B and C
A= not $self->valueB= $self->valueC= $self->has_errors
ABCresult
1XX1
0111
00X0
0100
10 3 my @args = $self->prepare_public_recaptcha_args;
11 3 my $output = $self->recaptcha_instance->get_html(@args);
12 3 return $self->wrap_field($result, $output);
13 } else {
14 0 my $security_code = $self->encrypt_hex($self->public_key);
15 0 return <<"END";
16 <input type='hidden' name='recaptcha_response_field' value='$security_code' />
17 <input type='hidden' name='recaptcha_already_validated' value='1' />
18 END
19 }
20 }
21  
22 3 ▶sub prepare_public_recaptcha_args {
Subroutine prepare_public_recaptcha_args: called CC=1 SCAR=0.0
Pod undocumented
23 3 my $self = shift @_;
24 return (
25 $self->public_key,
26 $self->{recaptcha_error},
27 3 $self->use_ssl,
28 $self->recaptcha_options,
29 );
30 }
31  
32 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 3 1;
« Field/reCAPTCHA.pm ↑ Summary