On Mon, 2003-06-09 at 13:57, Shannon Eric Peevey wrote:
> Yeah, I've been messing with that, but it seems to me that I need
> something similar to a preprocessor directive, where I can load the
> appropriate "use MODULE" lines into the module bases upon which version
> of modperl they have installed. Is it possible to use the BEGIN {}
> subroutine as this?
You don't need a preprocessor. You can call require inside an if/else
conditional, unlike use() statements which run at compile time and skip
the conditional logic.
For example:
if ($mod_perl::VERSION >= 1.99) {
require Apache2::Module;
import Apache2::Module;
} else {
require Apache1::Module;
import Apache1::Module;
}
You can put that whole construct in a BEGIN block if you want to. That
will make it run before the rest of the code in the current package.
- Perrin