File Coverage

blib/lib/Bio/Phylo/Util/OptionalInterface.pm
Criterion Covered Total %
statement 17 19 89.4
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 22 25 88.0


line stmt bran cond sub pod time code
1             package Bio::Phylo::Util::OptionalInterface;
2 46     46   269 use strict;
  46         97  
  46         1288  
3 46     46   224 use Bio::Phylo::Util::CONSTANT 'looks_like_class';
  46         95  
  46         2022  
4 46     46   1182 use Bio::Phylo::Util::Logger;
  46         99  
  46         6718  
5             my $logger = Bio::Phylo::Util::Logger->new;
6              
7             sub import {
8 94     94   217 my $class = shift;
9 94         296 my ($caller) = caller;
10 94         282 for my $iface (@_) {
11 94         210 eval { looks_like_class $iface };
  94         350  
12 94 50       3368 if ($@) {
13 94         653 $logger->info("Couldn't load optional interface $iface");
14 94         1185 undef($@);
15             }
16             else {
17 0           eval "push \@${caller}::ISA, '$iface'";
18 0           $logger->info("Added interface $iface to $caller");
19             }
20             }
21             }
22             1;
23             __END__