in reply to Re: subroutine good practise
in thread subroutine good practise
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: subroutine good practise
by chromatic (Archbishop) on Oct 29, 2012 at 20:02 UTC | |
Re^3: subroutine good practise
by thargas (Deacon) on Oct 30, 2012 at 12:42 UTC | |
Re^3: subroutine good practise
by tospo (Hermit) on Oct 30, 2012 at 12:04 UTC | |
Re^3: subroutine good practise
by scarytall (Initiate) on Nov 01, 2012 at 15:06 UTC |
In Section
Seekers of Perl Wisdom