somekindafreak has asked for the wisdom of the Perl Monks concerning the following question:
Is there any way to add a directory to the @INC path using a $variable and done after the BEGIN block? The only thing I can think of is a messy script-that-calls-a-script method that calls the menu routines first, then a second program with $lib and $module passed as args or some other fashion where they can be properly recognized in the BEGIN block.# a menu or two where the user makes a selections that lead up to defi +ning $lib and $module unshift(@INC, $lib); # done mid-execution, after the menu routines require "$module.pm"; # one clean import that loads a number of oth +ers all relative to $lib MODULE::main(@args); # execute a sub within the one of the newly i +mported modules within the selected lib
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dynamically expand @INC beyond BEGIN
by JavaFan (Canon) on Apr 16, 2012 at 22:41 UTC | |
by somekindafreak (Acolyte) on Apr 17, 2012 at 01:52 UTC | |
by ikegami (Patriarch) on Apr 17, 2012 at 04:22 UTC | |
by somekindafreak (Acolyte) on Apr 17, 2012 at 20:20 UTC | |
|
Re: dynamically expand @INC beyond BEGIN
by Anonymous Monk on Apr 17, 2012 at 13:27 UTC | |
by Anonymous Monk on Apr 17, 2012 at 20:14 UTC | |
by tobyink (Canon) on Apr 17, 2012 at 22:02 UTC |