Archive Ensembl HomeArchive Ensembl Home
Root.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003   Copyright (c) 1999-2012 The European Bioinformatics Institute and
00004   Genome Research Limited.  All rights reserved.
00005 
00006   This software is distributed under a modified Apache license.
00007   For license details, please see
00008 
00009     http://www.ensembl.org/info/about/code_licence.html
00010 
00011 =head1 CONTACT
00012 
00013   Please email comments or questions to the public Ensembl
00014   developers list at <dev@ensembl.org>.
00015 
00016   Questions may also be sent to the Ensembl help desk at
00017   <helpdesk@ensembl.org>.
00018 
00019 =head1 AUTHOR
00020 
00021   Originally from Steve Chervitz.  Refactored by Ewan Birney.
00022 
00023 =cut
00024 
00025 =head1 NAME
00026 
00027 Bio::EnsEMBL::Root
00028 
00029 =head1 DESCRIPTION
00030 
00031 Do not use Bio::EnsEMBL::Root anymore. It is included for backwards
00032 compatibility (every object in EnsEMBL used to inherit from this class)
00033 but will eventually be phased out. The replacement for the _rearrage
00034 method is the rearrange method which can be imported in the following
00035 way:
00036 
00037   use Bio::EnsEMBL::Utils::Argument qw(rearrange);
00038 
00039   # can now call rearrange as a class method (instead as object method)
00040   my ( $start, $end ) = rearrange( [ 'START', 'END' ], @args );
00041 
00042 If you want to use the throw or warn methods the replacement use the
00043 class methods throw and warning from the Bio::EnsEMBL::Utils::Exception
00044 class:
00045 
00046   use Bio::EnsEMBL::Utils::Exception qw(throw warning);
00047 
00048   # can now call throw or warning even without blessed reference
00049   warning('This is a warning');
00050   throw('This is an exception');
00051 
00052 This module was stolen from BioPerl to avoid problems with moving to
00053 BioPerl 1 from 0.7
00054 
00055 =head1 METHODS
00056 
00057 =cut
00058 
00059 package Bio::EnsEMBL::Root;
00060 
00061 use strict;
00062 use vars qw($VERBOSITY);
00063 use Bio::EnsEMBL::Utils::Exception qw( );
00064 use Bio::EnsEMBL::Utils::Argument qw( );
00065 
00066 
00067 $VERBOSITY = 0;
00068 
00069 sub new{
00070   my($caller,@args) = @_;
00071   
00072   my $class = ref($caller) || $caller;
00073   return bless({}, $class);
00074 }
00075 
00076 
00077 =head2 throw
00078 
00079   DEPRECATED
00080 
00081 =cut
00082 
00083 sub throw{
00084    my ($self,$string) = @_;
00085 
00086    Bio::EnsEMBL::Utils::Exception->warning("\n------------------ DEPRECATED ---------------------\n".
00087                                         "Bio::EnsEMBL::Root::throw has been deprecated\n".
00088                     "use Bio::EnsEMBL::Utils::Exception qw(throw); \n".
00089                         "throw('message'); #instead\n".
00090                     "\n---------------------------------------------------\n");
00091 
00092    Bio::EnsEMBL::Utils::Exception->throw($string);
00093 
00094 
00095 }
00096 
00097 =head2 warn
00098 
00099    DEPRECATED 
00100 
00101 =cut
00102 
00103 sub warn{
00104     my ($self,$string) = @_;
00105 
00106 
00107 
00108     Bio::EnsEMBL::Utils::Exception->warning("\n------------------ DEPRECATED ---------------------\n".
00109                                         "Bio::EnsEMBL::Root::warn has been deprecated\n".
00110                      "use Bio::EnsEMBL::Utils::Exception qw(warning); \n".
00111                      "warning('message'); #instead\n".
00112                      "\n---------------------------------------------------\n");
00113     
00114     Bio::EnsEMBL::Utils::Exception->warning($string);
00115 
00116 }
00117                        
00118 
00119 
00120              
00121 =head2 verbose
00122 
00123   DEPRECATED
00124 
00125 =cut
00126 
00127 sub verbose{
00128    my ($self,$value) = @_;
00129 
00130     Bio::EnsEMBL::Utils::Exception->warning("\n------------------ DEPRECATED ---------------------\n".
00131                                         "Bio::EnsEMBL::Root::verbose has been deprecated\n".
00132                      "use Bio::EnsEMBL::Utils::Exception qw(verbose); \n".
00133                      "verbose(value); #instead\n".
00134                      "\n---------------------------------------------------\n");
00135     
00136    Bio::EnsEMBL::Utils::Exception->verbose($value);
00137    
00138  }
00139 
00140 =head2 stack_trace_dump
00141 
00142   DEPRECATED
00143 
00144 =cut
00145 
00146 sub stack_trace_dump{
00147    my ($self) = @_;
00148 
00149     Bio::EnsEMBL::Utils::Exception->warning("\n------------------ DEPRECATED ---------------------\n".
00150                                         "Bio::EnsEMBL::Root::stack_trace_dump has been deprecated\n".
00151                      "use Bio::EnsEMBL::Utils::Exception qw(stack_trace_dump); \n".
00152                      "stack_trace_dump(); #instead\n".
00153                      "\n---------------------------------------------------\n");
00154 
00155    Bio::EnsEMBL::Utils::Exception->stack_trace_dump();
00156 
00157 }
00158 
00159 
00160 =head2 stack_trace
00161 
00162   DEPRECATED
00163 
00164 =cut
00165 
00166 sub stack_trace{
00167    my ($self) = @_;
00168 
00169     Bio::EnsEMBL::Utils::Exception->warning("\n------------------ DEPRECATED ---------------------\n".
00170                                         "Bio::EnsEMBL::Root::stack_trace has been deprecated\n".
00171                      "use Bio::EnsEMBL::Utils::Exception qw(stack_trace); \n".
00172                      "stack_trace(); #instead\n".
00173                      "\n---------------------------------------------------\n");
00174 
00175    Bio::EnsEMBL::Utils::Exception->stack_trace();
00176 
00177 }
00178 
00179 
00180 =head2 _rearrange
00181 
00182   DEPRECATED
00183 
00184 =cut
00185 
00186 #----------------'
00187 sub _rearrange {
00188 #----------------
00189     my($self,$order,@param) = @_;
00190 
00191     my $mess = "use Bio::EnsEMBL::Utils::Argument qw(rearrange); \n";
00192        $mess .= "rearrange(order, list); #instead\n";
00193 
00194     Bio::EnsEMBL::Utils::Exception->deprecate($mess);
00195 
00196    return Bio::EnsEMBL::Utils::Argument->rearrange($order,@param);
00197 
00198 }
00199 
00200 1;