File Coverage

blib/lib/HTML/FormFu/Plugin/RequestToken.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package HTML::FormFu::Plugin::RequestToken;
2              
3 1     1   740 use strict;
  1         2  
  1         54  
4              
5             our $VERSION = '2.02'; # VERSION
6              
7 1     1   6 use Moose;
  1         2  
  1         8  
8 1     1   6767 use MooseX::Attribute::FormFuChained;
  1         2  
  1         244  
9             extends 'HTML::FormFu::Plugin';
10              
11             has context => ( is => 'rw', traits => ['FormFuChained'] );
12             has field_name => ( is => 'rw', traits => ['FormFuChained'] );
13             has session_key => ( is => 'rw', traits => ['FormFuChained'] );
14             has expiration_time => ( is => 'rw', traits => ['FormFuChained'] );
15              
16             sub process {
17 51     51 1 418198 my ($self) = @_;
18              
19 51 100       251 return if $self->form->get_all_element( { name => $self->field_name } );
20              
21 26         1729 my $c = $self->form->stash->{'context'};
22              
23 26         376 $self->form->elements( [ {
24             type => 'RequestToken',
25             name => $self->field_name,
26             expiration_time => $self->expiration_time,
27             context => $self->context,
28             session_key => $self->session_key
29             } ] );
30              
31 26         3127 return;
32             }
33              
34             1;