FormHandler/TraitFor/Captcha.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 39 CC 3 SCAR 13.3
CC
3
Cov
0%
get_captcha
6.0
set_captcha
6.0
captcha_image_url
2.0
CRAP 3.8
1 package HTML::FormHandler::TraitFor::Captcha;
2 # ABSTRACT: generate and validate captchas
3 $HTML::FormHandler::TraitFor::Captcha::VERSION = '0.410002';
4 use HTML::FormHandler::Moose::Role;
5 use GD::SecurityImage;
6 use HTTP::Date;
7  
8 requires('ctx');
9  
10 has_field 'captcha' => ( type => 'Captcha', label => 'Verification' );
11  
12  
13 sub get_captcha {
14 my $self = shift;
15 return unless $self->ctx;
16 my $captcha;
17 $captcha = $self->ctx->session->{captcha};
18 return $captcha;
19 }
20  
21  
22 sub set_captcha {
23 my ( $self, $captcha ) = @_;
24 return unless $self->ctx;
25 $self->ctx->session( captcha => $captcha );
26 }
27  
28  
29 sub captcha_image_url {
30 return '/captcha/image';
31 }
32  
33 use namespace::autoclean;
34 1;
35  
36 __END__