File Coverage

blib/lib/Bio/PhyloXS/Forest/Node.pm
Criterion Covered Total %
statement 3 4 75.0
branch n/a
condition n/a
subroutine 1 2 50.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1             ## This file generated by InlineX::C2XS (version 0.25) using Inline::C (version 0.78)
2             package Bio::PhyloXS::Forest::Node;
3              
4             require Exporter;
5             *import = \&Exporter::import;
6             require DynaLoader;
7              
8             our $VERSION = 'v0.1.0';
9             $VERSION = eval $VERSION;
10             DynaLoader::bootstrap Bio::PhyloXS::Forest::Node $VERSION;
11              
12             @Bio::PhyloXS::Forest::Node::EXPORT = ();
13             @Bio::PhyloXS::Forest::Node::EXPORT_OK = ();
14              
15 0     0     sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaking
16 1     1   510 use base qw'Bio::PhyloXS::Listable Bio::Phylo::Forest::Node';
  1         2  
  1         301  
17             use Scalar::Util 'looks_like_number';
18             use Bio::Phylo::Util::Exceptions 'throw';
19              
20             our $AUTOLOAD;
21             sub AUTOLOAD {
22             my $self = shift;
23             my $method = $AUTOLOAD;
24             $method =~ s/.+:/Bio::Phylo::Forest::Node::/;
25             $self->$method(@_);
26             }
27              
28             sub set_branch_length {
29             my ( $self, $bl ) = @_;
30             my $id = $self->get_id;
31             if ( defined $bl && looks_like_number $bl && !ref $bl ) {
32             $self->set_raw_branch_length($bl);
33             }
34             elsif ( defined $bl && ( !looks_like_number $bl || ref $bl ) ) {
35             throw 'BadNumber' => "Branch length \"$bl\" is a bad number";
36             }
37             elsif ( !defined $bl ) {
38             $self->set_raw_branch_length();
39             }
40             return $self;
41             }
42              
43              
44             __PACKAGE__;