Plugin/SimpleCAS.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 47 CC 1 SCAR 6.9
CC
1
Cov
0%
_simplecas_controller_namespace
2.0
inject_simplecas_controller
2.0
CAS
2.0
CRAP 2.0
1 package Catalyst::Plugin::SimpleCAS;
2 use strict;
3 use warnings;
4  
5 our $VERSION = '1.002';
6  
7 use Moose::Role;
8 use namespace::autoclean;
9  
10 use CatalystX::InjectComponent;
11 use Catalyst::Controller::SimpleCAS;
12  
13 after 'setup_components' => sub { (shift)->inject_simplecas_controller(@_) };
14  
15 sub _simplecas_controller_namespace {
16 my $c = shift;
17 my $cfg = $c->config->{'Plugin::SimpleCAS'} || {};
18 $cfg->{controller_namespace} || 'SimpleCAS'
19 }
20  
21 sub inject_simplecas_controller {
22 my $c = shift;
23  
24 # Now inject the new Controllers:
25 CatalystX::InjectComponent->inject(
26 into => $c,
27 component => 'Catalyst::Controller::SimpleCAS',
28 as => join('::','Controller',$c->_simplecas_controller_namespace)
29 );
30 }
31  
32 # Convenience method to be able to get the controller via $c->CAS
33 sub CAS {
34 my $c = shift;
35 $c->controller( $c->_simplecas_controller_namespace )
36 }
37  
38  
39 1;
40  
41 __END__