Dave Adams wrote: > Does perl allow you to conditionally include a module? > > For example: > > #!/usr/bin/perl -w > use strict; > my $DEBUG = 0; > if (DEBUG) { > use diagnostics; > } > my $filename = "test$$.txt"; > open (FH , ">$filename") || die "error: $!"; > print (FH "hi"); > close (FH); > > Although this is a simple and silly example, it would be nice to be > able to include the diagnostic module by setting my debug to true.
perldoc diagnostics [snip] Due to the interaction between runtime and compiletime issues, and because it’s probably not a very good idea anyway, you may not use "no diagnostics" to turn them off at compiletime. However, you may control their behaviour at runtime using the disable() and enable() methods to turn them off and on ^^^^^^^ ^^^^^^ respectively. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>