| 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 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 35 | ▶ | use Bio::NEXUS::Functions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | 35 | ▶ | use Bio::NEXUS::Block; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 35 | ▶ | use Bio::NEXUS::Util::Exceptions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | 35 | ▶ | use Bio::NEXUS::Util::Logger; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 42 | 35 | ▶ | use vars qw(@ISA $VERSION $AUTOLOAD); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 43 | 35 | ▶ | use Bio::NEXUS; $VERSION = $Bio::NEXUS::VERSION; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 35 | @ISA = qw(Bio::NEXUS::Block); | |||||||||||||||||||||||||||
| 46 | 35 | 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 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | 0 | my ( $class, $type, $commands, $verbose ) = @_; | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ( not $type ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | if ( defined $commands and @$commands ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $commands and @$commands
MC/DC0%0/2
defined $commands and @$commands
defined $commands
@$commands
Truth table0%0/3
A and B
A= defined $commandsB= @$commands
| |||||||||||||||||||||||||||||
| 68 | 0 | $self->_parse_block( $commands, $verbose ); | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 0 | return $self; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | return if $AUTOLOAD =~ /DESTROY$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | if ( defined $synonym_for{$AUTOLOAD} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 0 | $logger->warn("$AUTOLOAD() is deprecated; use $synonym_for{$AUTOLOAD}() instead"); | |||||||||||||||||||||||||||
| 86 | 0 | goto &{ $synonym_for{$AUTOLOAD} }; | |||||||||||||||||||||||||||
| 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 | 35 | 1; | |||||||||||||||||||||||||||