[Bioperl-l] Variable scope
mmacho at gmail.com
Mon Oct 2 13:43:13 EDT 2006
this may be a typical perl topic and then out of this list center
topic. My apologize for any inconvenience.
It is a annoying problem that is making me waste lot of time.
I have a package with its new object, etc... and constants in it like:
use constant False => 0;
use constant True => 1;
our %CLRFG = (
PLASMIDO => RED,
POLY_A => GREEN,
RESTR_SITES => BLUE,
CONECTORS => MAGENTA,
CONTAMINANTS => CYAN,
our %CLRBG = (
PLASMIDO => "",
POLY_A => "",
RESTR_SITES => "",
CONECTORS => "",
CONTAMINANTS => "",
this constants are include with require "h.pl" from the main package
I use this module from the mail command line driver to test it
"using" it. In the command line driver I can use with no gripe the
constants False and True directly, for example "return True", etc
without any reference to the origin of that constant.
But, with respect to the variables (I would like they also were
constants.. but how?), %CLRFG and %CLRBG I can't find the way of
refering those int the module. Finally I have desisted and _copy_
the definitions where I have needed it (in the sub were I print Ansi
terminal colouring seqs...). I don't find how to refer those
variables out of the module.
I have tried %modulename::CLRFG, for example, but Perl gives me errors.
Profesor del Depto. de Lenguajes y Ciencias de la Computación
Universidad de Málaga
More information about the Bioperl-l