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.
|
|---|