5

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();
}
#}
Elizabeth Mattijsen
  • 25,654
  • 3
  • 75
  • 105
sid_com
  • 24,137
  • 26
  • 96
  • 187

0 Answers0