Declare/Context/AppSetup.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 21 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use MooseX::Declare;
2  
3 role CatalystX::Declare::Context::AppSetup {
4  
5 use MooseX::Types::Moose qw( Bool );
6 use Carp qw( croak );
7  
8  
9 has setup_was_called => (
10 is => 'rw',
11 isa => Bool,
12 );
13  
14 method add_setup_code_parts (Str $package, ArrayRef $plugins = []) {
15  
16 if ($self->setup_was_called) {
17 croak 'call to setup already pushed to cleanup code parts';
18 }
19  
20 $self->add_cleanup_code_parts(
21 sprintf(
22 '%s->setup(qw( %s ))',
23 $package,
24 join(' ', @$plugins),
25 ),
26 '1;',
27 );
28 $self->setup_was_called(1);
29 }
30 }
31