----- Original Message -----
From: merlyn@stonehenge.com (Randal L. Schwartz)
Date: Thursday, April 21, 2005 11:39 am
Subject: Re: Require / Use

> >>>>> "Paul" == Paul Kraus <[EMAIL PROTECTED]> writes:
> 
> >> Because you want the action at run-time (require) vs. compile time
> >> (use), is the usual reason, I would guess.
> Paul> Not to sound daft but why would you want to do that? What 
> would be
> Paul> gained or lossed. What would be an advantage of using require?
> 
> 
> if ($certain_condition) {
>        require Expensive::Module;
>        my $object = Expensive::Module->new(blah);
>        ...
> }
> 
> No point in loading Expensive::Module if $certain_condition isn't
> true.  That's hard to do with "use" instead of require.
Hmm, I find your comment interesting. Can you explain "Under the cover" 
difference between or give a small insight: 

if ($certain_condition) {
        require Expensive::Module;
        my $object = Expensive::Module->new(blah);
        ...
 }
 and 

 if ($certain_condition) {
        use Expensive::Module;
        my $object = Expensive::Module->new(blah);
        ...
 }

??
> 
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 
> 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment 
> Perl training!
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 


-- 
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