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.212650';
4 17     17   12147 use Moose::Role;
  17         47  
  17         161  
5              
6 17     17   97871 use autodie;
  17         50  
  17         123  
7 17     17   93106 use feature qw(say);
  17         47  
  17         1322  
8              
9 17     17   131 use Carp;
  17         54  
  17         1327  
10              
11 17     17   140 use Bio::MUST::Core::Types;
  17         57  
  17         552  
12 17     17   118 use aliased 'Bio::MUST::Core::Taxonomy';
  17         50  
  17         124  
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   6124 no Moose::Role;
  17         50  
  17         106  
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.212650
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