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 13Bio::NEXUS::NotesBlock - Represents a NOTES block in a NEXUS file. 14 15=head1 SYNOPSIS 16 17=head1 DESCRIPTION 18 19Placeholding module for the Notes Block class. 20 21=head1 COMMENTS 22 23=head1 FEEDBACK 24 25All 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 35package Bio::NEXUS::NotesBlock; 36 37use strict; 38use Bio::NEXUS::Functions; 39use Bio::NEXUS::Block; 40use Bio::NEXUS::Util::Exceptions; 41use Bio::NEXUS::Util::Logger; 42use vars qw(@ISA $VERSION $AUTOLOAD); 43use Bio::NEXUS; $VERSION = $Bio::NEXUS::VERSION; 44 45@ISA = qw(Bio::NEXUS::Block); 46my $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 58sub new { 59 my ( $class, $type, $commands, $verbose ) = @_; 60 if ( not $type ) { 61 ( $type = lc $class ) =~ s/Bio::NEXUS::(.+)Block/$1/i; 62 } 63 my $self = { 64 'type' => $type, 65 }; 66 bless $self, $class; 67 if ( defined $commands and @$commands ) { 68 $self->_parse_block( $commands, $verbose ); 69 } 70 return $self; 71} 72 73sub AUTOLOAD { 74 return if $AUTOLOAD =~ /DESTROY$/; 75 my $package_name = __PACKAGE__ . '::'; 76 77 # The following methods are deprecated and are temporarily supported 78 # via a warning and a redirection 79 my %synonym_for = ( 80 81# "${package_name}parse" => "${package_name}_parse_tree", # example 82 ); 83 84 if ( defined $synonym_for{$AUTOLOAD} ) { 85 $logger->warn("$AUTOLOAD() is deprecated; use $synonym_for{$AUTOLOAD}() instead"); 86 goto &{ $synonym_for{$AUTOLOAD} }; 87 } 88 else { 89 Bio::NEXUS::Util::Exceptions::UnknownMethod->throw( 90 'UnknownMethod' => "ERROR: Unknown method $AUTOLOAD called" 91 ); 92 } 93 return; 94} 95 961; 97