File Coverage

blib/lib/Bio/NEXUS/NotesBlock.pm
Criterion Covered Total %
statement 21 38 55.2
branch 0 8 0.0
condition 0 3 0.0
subroutine 7 9 77.7
pod 1 1 100.0
total 29 59 49.1


line stmt bran cond sub pod time code
1             #################################################################
2             # NotesBlock.pm
3             #################################################################
4             #
5             # thanks to Tom Hladish for the original version
6             #
7             # $Id: NotesBlock.pm,v 1.13 2012/02/07 21:38:09 astoltzfus Exp $
8              
9             #################### START POD DOCUMENTATION ##################
10              
11             =head1 NAME
12              
13             Bio::NEXUS::NotesBlock - Represents a NOTES block in a NEXUS file.
14              
15             =head1 SYNOPSIS
16              
17             =head1 DESCRIPTION
18              
19             Placeholding module for the Notes Block class.
20              
21             =head1 COMMENTS
22              
23             =head1 FEEDBACK
24              
25             All feedback (bugs, feature enhancements, etc.) are greatly appreciated.
26              
27             =head1 VERSION
28              
29             $Revision: 1.13 $
30              
31             =head1 METHODS
32              
33             =cut
34              
35             package Bio::NEXUS::NotesBlock;
36              
37 34     34   418 use strict;
  34         77  
  34         2141  
38 34     34   211 use Bio::NEXUS::Functions;
  34         75  
  34         6894  
39 34     34   209 use Bio::NEXUS::Block;
  34         96  
  34         765  
40 34     34   198 use Bio::NEXUS::Util::Exceptions;
  34         109  
  34         1359  
41 34     34   194 use Bio::NEXUS::Util::Logger;
  34         77  
  34         926  
42 34     34   188 use vars qw(@ISA $VERSION $AUTOLOAD);
  34         72  
  34         2206  
43 34     34   215 use Bio::NEXUS; $VERSION = $Bio::NEXUS::VERSION;
  34         68  
  34         13951  
44              
45             @ISA = qw(Bio::NEXUS::Block);
46             my $logger = Bio::NEXUS::Util::Logger->new();
47              
48             =head2 new
49              
50             Title : new
51             Usage : block_object = new Bio::NEXUS::NotesBlock($block_type, $commands, $verbose);
52             Function: Creates a new Bio::NEXUS::NotesBlock object
53             Returns : Bio::NEXUS::NotesBlock object
54             Args : type (string), the commands/comments to parse (array ref), and a verbose flag (0 or 1; optional)
55              
56             =cut
57              
58             sub new {
59 0     0 1   my ( $class, $type, $commands, $verbose ) = @_;
60 0 0         if ( not $type ) {
61 0           ( $type = lc $class ) =~ s/Bio::NEXUS::(.+)Block/$1/i;
62             }
63 0           my $self = {
64             'type' => $type,
65             };
66 0           bless $self, $class;
67 0 0 0       if ( defined $commands and @$commands ) {
68 0           $self->_parse_block( $commands, $verbose );
69             }
70 0           return $self;
71             }
72              
73             sub AUTOLOAD {
74 0 0   0     return if $AUTOLOAD =~ /DESTROY$/;
75 0           my $package_name = __PACKAGE__ . '::';
76              
77             # The following methods are deprecated and are temporarily supported
78             # via a warning and a redirection
79 0           my %synonym_for = (
80              
81             # "${package_name}parse" => "${package_name}_parse_tree", # example
82             );
83              
84 0 0         if ( defined $synonym_for{$AUTOLOAD} ) {
85 0           $logger->warn("$AUTOLOAD() is deprecated; use $synonym_for{$AUTOLOAD}() instead");
86 0           goto &{ $synonym_for{$AUTOLOAD} };
  0            
87             }
88             else {
89 0           Bio::NEXUS::Util::Exceptions::UnknownMethod->throw(
90             'UnknownMethod' => "ERROR: Unknown method $AUTOLOAD called"
91             );
92             }
93 0           return;
94             }
95              
96             1;