in reply to Re^2: Using variables within use and package statement
in thread Using variables within use and package statement

Unless I am misunderstanding you, you shouldn't need to do that?

The 'normal' way of doing things is:

--- file \this\path\gui\skills_gui.pm -- package skills_gui; ... ---------------------------------------- --- file \this\path\db\skills_db.pm -- package skills_db; ... ---------------------------------------= --- file \that\path\gui\skills_gui.pm -- package skills_gui; ... ---------------------------------------- --- file \that\path\db\skills_db.pm -- package skills_db; ... ---------------------------------------=

And in the calling script have

---- File: \some\other\path\yourscript.pl --- use lib $ENV{LIB_PATH}; use gui::skills_gui; use db::skills_db; ....

For one run of the script set LIB_PATH=\this\path\ and it will use \this\path\gui\skills_gui.pm and \this\path\db\skills_db.pm
and for another run you'd set LIB_PATH=\that\path\ and it will use \that\path\gui\skills_gui.pm and \that\path\db\skills_db.pm.

So the one script unchanged will use either set of modules depending upon the setting of the environment variable.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.