File Coverage

lib/Algorithm/Evolutionary.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Algorithm::Evolutionary;
2              
3 21     21   394546 use Carp qw(croak);
  16         41  
  16         17903  
4              
5             our $VERSION = '0.79_2'; # Getting close to something
6              
7             # Preloaded methods go here.
8              
9             # A bit of importing magic taken from POE
10             sub import {
11 19     19   3789 my $self = shift;
12              
13 17         158 my @modules = grep(!/^(Op|Indi|Fitness)$/, @_);
14              
15 17         45 my $package = caller();
16 18         609 my @failed;
17              
18             # Load all the others.
19 17         47 foreach my $module (@modules) {
20 61         210 my $code = "package $package; use Algorithm::Evolutionary::$module;";
21             # warn $code;
22 21     21   10613 eval($code);
  6     19   85  
  6     12   143  
  19     1   20294  
  3         9  
  3         68  
  12         22328  
  1         3  
  1         66  
  61         4946  
23 61 100       303 if ($@) {
24 50         6901 warn $@;
25 50         276 push(@failed, $module);
26             }
27             }
28              
29 17 100       32275 @failed and croak "could not import qw(" . join(' ', @failed) . ")";
30             }
31              
32             1;
33             __END__