What do you suggest in cases where a module's conditionally needed? For example, a program only needs either Text::Table or HTML::Table, depending upon how that program's called. Should both modules be loaded or conditionally loaded?
For example:
# Conditionally use Modules based on outFormat
for ( $config{outFormat} ) {
when (TEXT) {
eval 'use Text::Table';
die $@ if $@;
}
when (HTML) {
eval 'use HTML::Table';
die $@ if $@;
}
}
If conditionally loaded if acceptable, would require be better than use in the above case? |