Exobrain/Agent/Depends.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 23 CC 1 SCAR 6.9
CC
1
Cov
0%
BUILD
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Exobrain::Agent::Depends;
2 use Moose::Role;
3 use Method::Signatures;
4  
5 # ABSTRACT: Allow agents to declare run-time dependencies
6 our $VERSION = '1.08'; # VERSION
7  
8  
9 requires 'depends';
10  
11 method check_dependencies() {
12 # Returns true if dependencies could be loaded, false otherwise
13 return eval { $self->load_dependencies; 1; }
14 }
15  
16 method load_dependencies() {
17 foreach my $dep ($self->depends) {
18 eval "use Exobrain::$dep; 1;" or die $@;
19 }
20 }
21  
22 no warnings 'redefine';
23  
24 sub BUILD {};
25  
26 after BUILD => method(...) {
27 $self->load_dependencies;
28 };
29  
30 1;
31  
32 __END__