Another way would be to unshift into @INC (see perlvar) in a BEGIN block. The following code puts './lib' at the head of the line for module searches if $devel is true, and does nothing if it is false. This lets you tie other things to the same variable if needed, so you only change it in one place.
BEGIN { my $devel = 0; if ( $devel ) { unshift @INC, qw( ./lib ); } }
You could also conditionally require a module and then call its import method/sub. This can be done outside a BEGIN block, since require() happens later than does use().
Finally, there are advanced options that have to do with playing tricks with @INC (like putting coderefs in it and such), but those are probably best left alone until you have a solid grasp of other ways to conditionally require a module.
In reply to Re: Separating Development and Release Modules
by mr_mischief
in thread Separating Development and Release Modules
by Irinotecan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |