Re: How to 'conditionally' use a specified module
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Thu, 16 Nov 2006 00:06:06 -0500
"u" == usenet <usenet@xxxxxxxxxxxxxxx> writes:
u> danny wrote:
>> I need to check if one of my variables is true, then use a specific module:
u> Use the 'if' pragma (which is different than the "usual" if operator):
u> use if ($use_cache eq 'yes'), Cache::SizeAwareFileCache;
that will still fail if the boolean value is set at runtime since use
executes at compile time. this is where require is better as it only
executes at runtime. (of course string eval breaks all those rules).
so to the OP, you need to call require and not use there.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.
- Follow-Ups:
- Re: How to 'conditionally' use a specified module
- From: DJ Stunks
- Re: How to 'conditionally' use a specified module
- From: danny
- Re: How to 'conditionally' use a specified module
- References:
- How to 'conditionally' use a specified module
- From: danny
- Re: How to 'conditionally' use a specified module
- From: usenet
- How to 'conditionally' use a specified module
- Prev by Date: Database entries into a hash or array
- Next by Date: Need help in installing perl modules
- Previous by thread: Re: How to 'conditionally' use a specified module
- Next by thread: Re: How to 'conditionally' use a specified module
- Index(es):
Relevant Pages
|