lib/Rapi/Blog/PreAuth/Actor.pm untested

filter: Statementstmt 0.0% 0 / 44 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 62 CC 1 SCAR 6.9
CC
1
Cov
0%
req_params
2.0
is_error
2.0
error_type
2.0
CRAP 2.0
1 package Rapi::Blog::PreAuth::Actor;
2 use strict;
3 use warnings;
4  
5 # ABSTRACT: Base class for preauth Actors
6  
7 use Moo;
8 use Types::Standard qw(:all);
9  
10 use RapidApp::Util ':all';
11 use Rapi::Blog::Util;
12  
13 # Catalyst context:
14 has 'ctx', is => 'ro', required => 1;
15  
16 has 'PreauthAction',
17 is => 'ro',
18 required => 1,
19 isa => InstanceOf['Rapi::Blog::DB::Result::PreauthAction'];
20  
21 has 'info', is => 'rw', default => sub { '' } , isa => Str;
22  
23 # If and what template the controller should render after execution
24 has 'render_template', is => 'rw', default => sub { undef } , isa => Maybe[Str];
25  
26 # Where the controller should redirect the user to after execution
27 # This takes priority over 'render_template' so child Actors should override
28 # the base setiing which is to just redirect the user to the site root
29 has 'redirect_url', is => 'rw', default => sub { '/' } , isa => Maybe[Str];
30  
31 sub req_params { (shift)->ctx->request->params }
32  
33 sub is_error { 0 }
34 sub error_type { '' }
35  
36 sub execute { ... }
37  
38  
39 sub call_execute {
40 my $self = shift;
41
42 my $ret = 0;
43 try {
44 $ret = $self->execute
45 }
46 catch {
47 my $err = shift;
48 $ret = 0;
49 $self->info( "$err" )
50 };
51
52 $self->post_execute;
53  
54 $ret
55 }
56  
57  
58 sub post_execute {
59 my $self = shift;
60 $self->PreauthAction->_record_executed( $self->info )
61 }
62  
63  
64  
65  
66 1;
67  
68  
69 __END__