File Coverage

blib/lib/Bio/Phylo/Util/OptionalInterface.pm
Criterion Covered Total %
statement 20 22 90.9
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 26 29 89.6


line stmt bran cond sub pod time code
1             package Bio::Phylo::Util::OptionalInterface;
2 46     46   266 use strict;
  46         89  
  46         1131  
3 46     46   208 use warnings;
  46         81  
  46         1137  
4 46     46   212 use Bio::Phylo::Util::CONSTANT 'looks_like_class';
  46         84  
  46         1850  
5 46     46   233 use Bio::Phylo::Util::Logger;
  46         81  
  46         6587  
6             my $logger = Bio::Phylo::Util::Logger->new;
7              
8             sub import {
9 94     94   207 my $class = shift;
10 94         282 my ($caller) = caller;
11 94         257 for my $iface (@_) {
12 94         161 eval { looks_like_class $iface };
  94         413  
13 94 50       3291 if ($@) {
14 94         536 $logger->info("Couldn't load optional interface $iface");
15 94         1112 undef($@);
16             }
17             else {
18 0           eval "push \@${caller}::ISA, '$iface'";
19 0           $logger->info("Added interface $iface to $caller");
20             }
21             }
22             }
23             1;
24             __END__
25              
26             =head1 NAME
27              
28             Bio::Phylo::Util::OptionalInterface - Utility class for managing optional
29             superclasses. No serviceable parts inside.
30              
31             =head1 DESCRIPTION
32              
33             This package is for optionally importing superclasses or interfaces and placing
34             them above the importing class in the inheritance tree. This is principally
35             used for managing the relationship with L<BioPerl>.
36              
37             =head1 SEE ALSO
38              
39             There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo>
40             for any user or developer questions and discussions.
41              
42             =over
43              
44             =item L<Bio::Phylo::Manual>
45              
46             Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>.
47              
48             =back
49              
50             =head1 CITATION
51              
52             If you use Bio::Phylo in published research, please cite it:
53              
54             B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen>
55             and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl.
56             I<BMC Bioinformatics> B<12>:63.
57             L<http://dx.doi.org/10.1186/1471-2105-12-63>
58              
59              
60              
61             =cut