[EMAIL PROTECTED] wrote:
In my script, I load the module by saying "use PerlMQ;". However, now I want to
load only certain use statements from the module depending on the parameter I
give it. For example, in my script, I want to say "use PerlMQ
qw(some_parameter)" in order to load the use statements specified by
some_parameter in the module. Is it possible to do that?
Yes, there are ways.
>
----------------------------------------------------------------------------------
> #PerlMQ.pm
>
> use strict;
> use warnings;
>
> use statement1;
> use statement2;
> use statement3;
>
# Change to:
use File::Basename;
use if ( basename( $0 ) eq 'script1' ), module1 => undef;
use if ( basename( $0 ) eq 'script1'
&& basename( $0 ) eq 'script2' ),
module2 => undef;
use if ( basename( $0 ) eq 'script3' ), module3 => undef;
> #and so on...
>
> 1;
>
> _END_
>
See `perldoc if` for details.
--
Just my 0.00000002 million dollars worth,
--- Shawn
"Probability is now one. Any problems that are left are your own."
SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>