Is there anything wrong with not putting the conditional module loading in a BEGIN
block?
Without the BEGIN
block changing the environment variable after precompilation would still affect which module is loaded.
my $table;
#BEGIN {
if %*ENV<TABLE_A> {
require MY_TABLE_A <&get_table>;
$table = get_table();
}
else {
require MY_TABLE_B <&get_table>;
$table = get_width();
}
#}