Dave Adams <mailto:[EMAIL PROTECTED]> wrote:

: Does perl allow you to conditionally include a module?

    In general, you can load a module at runtime by using
'require' and manually running its import() sub routine.

require Module;
Module::import( 'Import list' );

: For example:
: 
: #!/usr/bin/perl -w
: use strict;
: my $DEBUG = 0;
: if (DEBUG) {
:     use diagnostics;
: }

use constant DEBUG => 0;

if ( DEBUG ) {
    require diagnostics;
    diagnostics::import();
}

    OR:

my $DEBUG = 0;

if ( $DEBUG ) {
    require diagnostics;
    diagnostics::import();
}


    Though I think I like John Krahn's solution better.

use diagnostics;

my $DEBUG = 0;

diagnostics->disable() unless $DEBUG;


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to