File Coverage

blib/lib/Bio/MUST/Core/Roles/Taxable.pm
Criterion Covered Total %
statement 21 27 77.7
branch 0 2 0.0
condition n/a
subroutine 7 8 87.5
pod n/a
total 28 37 75.6


line stmt bran cond sub pod time code
1             package Bio::MUST::Core::Roles::Taxable;
2             # ABSTRACT: Taxable Moose role for objects that query a taxonomy
3             $Bio::MUST::Core::Roles::Taxable::VERSION = '0.212530';
4 17     17   12461 use Moose::Role;
  17         47  
  17         190  
5              
6 17     17   97254 use autodie;
  17         48  
  17         133  
7 17     17   93039 use feature qw(say);
  17         57  
  17         1427  
8              
9 17     17   151 use Carp;
  17         50  
  17         1307  
10              
11 17     17   132 use Bio::MUST::Core::Types;
  17         49  
  17         588  
12 17     17   143 use aliased 'Bio::MUST::Core::Taxonomy';
  17         49  
  17         127  
13              
14              
15             has 'tax_dir' => (
16             is => 'ro',
17             isa => 'Maybe[Str]',
18             );
19              
20              
21             has 'tax' => (
22             is => 'ro',
23             isa => 'Maybe[Bio::MUST::Core::Taxonomy]',
24             lazy => 1,
25             builder => '_build_tax', # if not provided in constructor
26             );
27              
28             ## no critic (ProhibitUnusedPrivateSubroutines)
29              
30             sub _build_tax {
31 0     0     my $self = shift;
32              
33 0           my $tax_dir = $self->tax_dir;
34 0 0         unless ($tax_dir) {
35 0           carp '[BMC] Warning: no valid tax_dir specified; disabling taxonomy!';
36 0           return;
37             }
38              
39 0           return Taxonomy->new_from_cache( tax_dir => $tax_dir );
40             }
41              
42             ## use critic
43              
44 17     17   6174 no Moose::Role;
  17         55  
  17         109  
45             1;
46              
47             __END__
48              
49             =pod
50              
51             =head1 NAME
52              
53             Bio::MUST::Core::Roles::Taxable - Taxable Moose role for objects that query a taxonomy
54              
55             =head1 VERSION
56              
57             version 0.212530
58              
59             =head1 SYNOPSIS
60              
61             # TODO
62              
63             =head1 DESCRIPTION
64              
65             # TODO
66              
67             =head1 AUTHOR
68              
69             Denis BAURAIN <denis.baurain@uliege.be>
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
74              
75             This is free software; you can redistribute it and/or modify it under
76             the same terms as the Perl 5 programming language system itself.
77              
78             =cut