I
ivowel
what is the perl-ish way to define a global variable that is used by
many modules (e.g., the location of all databases, or of a particular
server)? Clearly, I want to define it only once, and have it be
accessible everywhere.
my first inclination was to put it into base.pm and use the Exporter to
just export it. its a bit of a pain, especially if the program itself
calls other modules, all of which have to import the base module
themselves, too. But it is doable.
now, looking at Damien's perl6's suggested replacement for Exporter, I
did not find a way to export scalars. it just seems to export subs.
so maybe the export mechanism ain't it.
so, what is the perlish way to do this?
related question---if I want to break a program into a couple of
different files, what is the recommended way of doing this? is it
stuffing different routines into different modules? I am thinking of
something like the numerical recipees version, where I have hundreds of
subroutines. there, they put every sub into its own equal-named file.
of course, I may need 'em all in my program.
sincerely,
/iaw
many modules (e.g., the location of all databases, or of a particular
server)? Clearly, I want to define it only once, and have it be
accessible everywhere.
my first inclination was to put it into base.pm and use the Exporter to
just export it. its a bit of a pain, especially if the program itself
calls other modules, all of which have to import the base module
themselves, too. But it is doable.
now, looking at Damien's perl6's suggested replacement for Exporter, I
did not find a way to export scalars. it just seems to export subs.
so maybe the export mechanism ain't it.
so, what is the perlish way to do this?
related question---if I want to break a program into a couple of
different files, what is the recommended way of doing this? is it
stuffing different routines into different modules? I am thinking of
something like the numerical recipees version, where I have hundreds of
subroutines. there, they put every sub into its own equal-named file.
of course, I may need 'em all in my program.
sincerely,
/iaw