<?xml version="1.0" encoding="windows-1252"?>
<node id="1001408" title="Re^2: subroutine good practise" created="2012-10-29 15:22:05" updated="2012-10-29 15:22:05">
<type id="11">
note</type>
<author id="965102">
Kenosis</author>
<data>
<field name="doctext">
&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;c&gt;
# 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 $@;
	}
}
&lt;/c&gt;
&lt;p&gt;If conditionally loaded if acceptable, would &lt;c&gt;require&lt;/c&gt; be better than &lt;c&gt;use&lt;/c&gt; in the above case?&lt;/p&gt;</field>
<field name="root_node">
1001398</field>
<field name="parent_node">
1001404</field>
</data>
</node>
