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   284 use strict;
  46         102  
  46         1240  
3 46     46   252 use Bio::Phylo::Util::CONSTANT 'looks_like_class';
  46         80  
  46         1791  
4 46     46   229 use Bio::Phylo::Util::Logger;
  46         84  
  46         6504  
5             my $logger = Bio::Phylo::Util::Logger->new;
6              
7             sub import {
8 94     94   195 my $class = shift;
9 94         286 my ($caller) = caller;
10 94         248 for my $iface (@_) {
11 94         208 eval { looks_like_class $iface };
  94         298  
12 94 50       3270 if ($@) {
13 94         529 $logger->info("Couldn't load optional interface $iface");
14 94         1089 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__
24              
25             =head1 NAME
26              
27             Bio::Phylo::Util::OptionalInterface - Utility class for managing optional
28             superclasses. No serviceable parts inside.
29              
30             =head1 DESCRIPTION
31              
32             This package is for optionally importing superclasses or interfaces and placing
33             them above the importing class in the inheritance tree. This is principally
34             used for managing the relationship with L<BioPerl>.
35              
36             =head1 SEE ALSO
37              
38             There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo>
39             for any user or developer questions and discussions.
40              
41             =over
42              
43             =item L<Bio::Phylo::Manual>
44              
45             Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>.
46              
47             =back
48              
49             =head1 CITATION
50              
51             If you use Bio::Phylo in published research, please cite it:
52              
53             B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen>
54             and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl.
55             I<BMC Bioinformatics> B<12>:63.
56             L<http://dx.doi.org/10.1186/1471-2105-12-63>
57              
58              
59              
60             =cut