H
Hal Vaughan
I have a module, TD::Log.pm (TD is the company name, so most modules are in
that directory). When I write a program, I use:
use TD::Log;
as expected. I also have other modules I use. I know a module can
reference the function "entry()" in the instance TD::Log in the main
program by using:
main::TD::Log::entry("status: adding today's data to file");
However, what I'd like to do, when I open a new module from main, say
"TD::IncomingData.pm" is to use main::TD::Log::entry more simply. Is there
some way, from the main program, I can pass a reference to the instance of
TD:Log the main program uses to TD::IncomingData so I can reference the
routines directly in TD::IncomingData? Something like:
use TD::Log;
use TD::IncomingData;
incomingdatainit({some reference to TD::Log});
And then, from then on, I can reference the routines in main::TD::Log as I
would "normally" reference routines in the IncomingData module? (Like with
"entry()" instead of "main::TD::Log::entry()"?)
AND (2nd part of question), once I've done that, is there a way to tell if I
have been passed main::Log and using that, instead of the routine not being
accessible?
Thanks!
Hal
that directory). When I write a program, I use:
use TD::Log;
as expected. I also have other modules I use. I know a module can
reference the function "entry()" in the instance TD::Log in the main
program by using:
main::TD::Log::entry("status: adding today's data to file");
However, what I'd like to do, when I open a new module from main, say
"TD::IncomingData.pm" is to use main::TD::Log::entry more simply. Is there
some way, from the main program, I can pass a reference to the instance of
TD:Log the main program uses to TD::IncomingData so I can reference the
routines directly in TD::IncomingData? Something like:
use TD::Log;
use TD::IncomingData;
incomingdatainit({some reference to TD::Log});
And then, from then on, I can reference the routines in main::TD::Log as I
would "normally" reference routines in the IncomingData module? (Like with
"entry()" instead of "main::TD::Log::entry()"?)
AND (2nd part of question), once I've done that, is there a way to tell if I
have been passed main::Log and using that, instead of the routine not being
accessible?
Thanks!
Hal