Bio::Root Global
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::Root::Global - Global variables and utility functions
Package variables
Globals (from "use vars" definitions)
$BASE_YEAR
@MONTHS
@DAYS
Included modules
Exporter ( )
Inherit
Exporter
Synopsis
    # no real synopsis - see Bio::Root::Object
Description
The Bio::Root::Global file contains all the global flags
about erro warning etc, and also utility functions, eg
to map numbers to roman numerals.
These functions are generally called by Bio::Root::Object
or somewhere similar, and not directly
Methods
BEGIN Code
debug
No description
Code
dont_warn
No description
Code
fatal_on_warn
No description
Code
monitor
No description
Code
record_err
No description
Code
roman2int
No description
Code
strictness
No description
Code
testing
No description
Code
verbosity
No description
Code
warn_on_fatal
No description
Code
Methods description
None available.
Methods code
BEGINTop
BEGIN {
    use vars qw($CGI $TIMEOUT_SECS);

    # $CGI is a boolean to indicate if the script is running as a CGI.
# Useful for conditionally producing HTML-formatted messages
# or suppressing messages appropriate only for interactive sessions.
$CGI = 1 if $ENV{REMOTE_ADDR} || $ENV{REMOTE_HOST};
}
debugdescriptionprevnextTop
sub debug {
    my $level = shift;
    if( defined $level) { $DEBUG = $level }
    else { $DEBUG = 0 }
#    $MONITOR and do{ print STDERR $DEBUG ? "Debug on ($DEBUG).\n\n" : "Debug off.\n\n"; };
$MONITOR and do{ print STDERR $DEBUG ? "Debug on ($DEBUG).\n\n" : ""; }; $DEBUG;
}
dont_warndescriptionprevnextTop
sub dont_warn {
    my $arg = shift;
    !$CGI and print STDERR "\n$0: Deprecated method dont_warn() called. Use verbosity(-1) instead\n";
    if( $arg) { verbosity(-1)}
    else { verbosity(0); }
}
fatal_on_warndescriptionprevnextTop
sub fatal_on_warn {
    my $arg = shift;
    !$CGI and print STDERR "\n$0: Deprecated method fatal_on_warn() called. Use strictness(2) instead\n";
    if( $arg) { strictness(2)}
    else { strictness(0); }
}

#####################################################################################
# END OF PACKAGE
#####################################################################################
1;
}
monitordescriptionprevnextTop
sub monitor {
    my $level = shift;
    if( defined $level) { $MONITOR = $level }
    else { $MONITOR = 0 }
    $DEBUG and (print STDERR "Monitor on ($MONITOR).\n\n");
    $MONITOR;
}
record_errdescriptionprevnextTop
sub record_err {
    if( defined shift) { $RECORD_ERR = 1}
    else { $RECORD_ERR = 0 }
    $RECORD_ERR ? ($DEBUG && print STDERR "\n*** RECORD_ERR on. ***\n\n") : ($DEBUG && print STDERR "RECORD_ERR off.\n\n");
    $RECORD_ERR;
}

##
## The following methods are deprecated and will eventually be removed.
##
}
roman2intdescriptionprevnextTop
sub roman2int {
    my $roman = uc(shift);
    foreach (keys %ROMAN_NUMS) {
	return $_ if $ROMAN_NUMS{$_} eq $roman;
    }
# Alternatively:
# my @int = grep $ROMAN_NUMS{$_} eq $roman, keys %ROMAN_NUMS;
# return $int[0];
undef;
}
strictnessdescriptionprevnextTop
sub strictness {
# Values can integers from -2 to 2
# See Bio::Root::Object::strict() for more explanation.
my $arg = shift; if( defined $arg) { $STRICTNESS = $arg} $DEBUG && print STDERR "\n*** STRICTNESS: $arg ***\n\n"; $STRICTNESS;
}
testingdescriptionprevnextTop
sub testing {
    my $level = shift;
    if( defined $level) { $TESTING = $level }
    else { $TESTING = 0 }
    $TESTING ? ($MONITOR && print STDERR "Testing on ($TESTING).\n\n") : ($MONITOR && print STDERR "Testing off.\n\n");
    $TESTING;
}
verbositydescriptionprevnextTop
sub verbosity {
# Values can integers from -1 to 1
# See Bio::Root::Object::verbose() for more explanation.
my $arg = shift; if( defined $arg) { $VERBOSITY = $arg} $DEBUG && print STDERR "\n*** VERBOSITY: $arg ***\n\n"; $VERBOSITY;
}
warn_on_fataldescriptionprevnextTop
sub warn_on_fatal {
    my $arg = shift;
    !$CGI and print STDERR "\n$0: Deprecated method warn_on_fatal() called. Use strictness(-2) instead\n";
    if( $arg) { strictness(-2)}
    else { strictness(0); }
}
General documentation
INSTALLATIONTop
This module is included with the central Bioperl distribution:
   http://bio.perl.org/Core/Latest
ftp://bio.perl.org/pub/DIST
Follow the installation instructions included in the README file.