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   453116 use Carp qw(croak);
  16         44  
  16         6157  
4              
5             our $VERSION = '0.78'; # Another year in paradise
6              
7             # Preloaded methods go here.
8              
9             # A bit of importing magic taken from POE
10             sub import {
11 19     19   3747 my $self = shift;
12              
13 17         258 my @modules = grep(!/^(Op|Indi|Fitness)$/, @_);
14              
15 17         59 my $package = caller();
16 18         619 my @failed;
17              
18             # Load all the others.
19 17         47 foreach my $module (@modules) {
20 61         242 my $code = "package $package; use Algorithm::Evolutionary::$module;";
21             # warn $code;
22 21     21   11503 eval($code);
  6     19   21  
  6     12   712  
  19     1   13375  
  3         11  
  3         77  
  12         13732  
  1         4  
  1         21  
  61         4535  
23 61 100       463 if ($@) {
24 50         15264 warn $@;
25 50         278 push(@failed, $module);
26             }
27             }
28              
29 17 100       33096 @failed and croak "could not import qw(" . join(' ', @failed) . ")";
30             }
31              
32             1;
33             __END__