Thanks Shawn. But, in this case, how would we send a parameter to the module from the calling script. The module can see the name of the calling script, but I want to make my module available to other perl programmers, and let them have the flexibility of deciding which use statements they want from the module.
Vishal Quoting Shawn Corey <[EMAIL PROTECTED]>: > [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> > > ---------------------------------------- This mail sent through www.mywaterloo.ca -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>