| 1 | ################################################################# | ||||||||||
| 2 | # DataBlock.pm | ||||||||||
| 3 | ################################################################# | ||||||||||
| 4 | # Author: Thomas Hladish | ||||||||||
| 5 | # $Id: DataBlock.pm,v 1.13 2007/09/21 23:09:09 rvos Exp $ | ||||||||||
| 6 | |||||||||||
| 7 | #################### START POD DOCUMENTATION ################## | ||||||||||
| 8 | |||||||||||
| 9 | =head1 NAME | ||||||||||
| 10 | |||||||||||
| 11 | Bio::NEXUS::DataBlock - Represents the deprecated DATA Block in NEXUS file. | ||||||||||
| 12 | |||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||
| 14 | |||||||||||
| 15 | $block_object = new Bio::NEXUS::DataBlock($type, $block, $verbose, $taxlabels_ref); | ||||||||||
| 16 | |||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||
| 18 | |||||||||||
| 19 | The DataBlock class represents the deprecated Data Block in a NEXUS file. Data Blocks are still used by some prominent programs, unfortunately, although they are essentially the same as a Characters Block and a Taxa Block combined. Data Blocks may be used as input, but are not output by the NEXPL library. For more information on Data Blocks, see the Characters Block documentation. | ||||||||||
| 20 | |||||||||||
| 21 | =head1 COMMENTS | ||||||||||
| 22 | |||||||||||
| 23 | Don't use this block type if you can help it. | ||||||||||
| 24 | |||||||||||
| 25 | =head1 FEEDBACK | ||||||||||
| 26 | |||||||||||
| 27 | All feedback (bugs, feature enhancements, etc.) are greatly appreciated. | ||||||||||
| 28 | |||||||||||
| 29 | =head1 AUTHORS | ||||||||||
| 30 | |||||||||||
| 31 | Thomas Hladish (tjhladish at yahoo) | ||||||||||
| 32 | |||||||||||
| 33 | =head1 VERSION | ||||||||||
| 34 | |||||||||||
| 35 | $Revision: 1.13 $ | ||||||||||
| 36 | |||||||||||
| 37 | =head1 METHODS | ||||||||||
| 38 | |||||||||||
| 39 | =cut | ||||||||||
| 40 | |||||||||||
| 41 | package Bio::NEXUS::DataBlock; | ||||||||||
| 42 | |||||||||||
| 43 | 35 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | #use Data::Dumper; # XXX this is not used, might as well not import it! | ||||||||||
| 45 | #use Carp; # XXX this is not used, might as well not import it! | ||||||||||
| 46 | 35 | ▶ | use Bio::NEXUS::Functions; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | 35 | ▶ | use Bio::NEXUS::CharactersBlock; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 48 | 35 | ▶ | use Bio::NEXUS::Util::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 35 | ▶ | use Bio::NEXUS::Util::Exceptions; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | 35 | ▶ | use vars qw(@ISA $VERSION $AUTOLOAD); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 51 | 35 | ▶ | use Bio::NEXUS; $VERSION = $Bio::NEXUS::VERSION; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 52 | |||||||||||
| 53 | 35 | @ISA = qw(Bio::NEXUS::CharactersBlock); | |||||||||
| 54 | 35 | my $logger = Bio::NEXUS::Util::Logger->new(); | |||||||||
| 55 | |||||||||||
| 56 | =head2 new | ||||||||||
| 57 | |||||||||||
| 58 | Title : new | ||||||||||
| 59 | Usage : block_object = new Bio::NEXUS::CharactersBlock($block_type, $block, $verbose, $taxa); | ||||||||||
| 60 | Function: Creates a new Bio::NEXUS::CharactersBlock object | ||||||||||
| 61 | Returns : Bio::NEXUS::CharactersBlock object | ||||||||||
| 62 | Args : verbose flag (0 or 1), type (string) and the block to parse (string) | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | 7 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 67 | 7 | my $deprecated_class = shift; | |||||||||
| 68 | 7 | my $deprecated_type = shift; | |||||||||
| 69 | 7 | $logger->info("Read in Data Block (deprecated), creating Characters Block instead"); | |||||||||
| 70 | 7 | my $self = new Bio::NEXUS::CharactersBlock( 'characters', @_ ); | |||||||||
| 71 | 6 | return $self; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=3 SCAR=24.8
| |||||||||||
| 75 | 0 | ▶ | return if $AUTOLOAD =~ /DESTROY$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 0 | my $package_name = __PACKAGE__ . '::'; | |||||||||
| 77 | |||||||||||
| 78 | # The following methods are deprecated and are temporarily supported | ||||||||||
| 79 | # via a warning and a redirection | ||||||||||
| 80 | 0 | my %synonym_for = ( | |||||||||
| 81 | |||||||||||
| 82 | # "${package_name}parse" => "${package_name}_parse_tree", # example | ||||||||||
| 83 | ); | ||||||||||
| 84 | |||||||||||
| 85 | 0 | ▶ | if ( defined $synonym_for{$AUTOLOAD} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | 0 | $logger->warn("$AUTOLOAD() is deprecated; use $synonym_for{$AUTOLOAD}() instead"); | |||||||||
| 87 | 0 | goto &{ $synonym_for{$AUTOLOAD} }; | |||||||||
| 88 | } | ||||||||||
| 89 | else { | ||||||||||
| 90 | 0 | Bio::NEXUS::Util::Exceptions::UnknownMethod->throw( | |||||||||
| 91 | 'error' => "ERROR: Unknown method $AUTOLOAD called" | ||||||||||
| 92 | ); | ||||||||||
| 93 | } | ||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 35 | 1; | |||||||||