you need something like C

#ifdef
#define whatever
        ...
#endif

        or

#ifndef
#define whatever
        ...
#endif

is this correct?


Regards, mxb

-----Original Message-----
From: JulianL Brown [mailto:[EMAIL PROTECTED]
Sent: Jueves, 13 de Noviembre de 2003 12:51
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Perl/iPlanet/use loading


Bill

I am not sure how what you are proposing would help me reduce resources.  It

seems your code would load all my modules regardless, and I am already doing

that now.

But your code did give me an idea:

Something along the lines of ...

if (I need Module1)
{
   eval qq~
use Module1;

call Module1 stuff.

~;
}

Here what is in the eval script would NOT get compiled or executed until it 
is needed, am I correct in this assumption?

What do you people thing?

Julian

>From: "$Bill Luebkert" <[EMAIL PROTECTED]>
>To: JulianL Brown <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: Perl/iPlanet/use loading
>Date: Wed, 12 Nov 2003 18:23:24 -0800
>
>JulianL Brown wrote:
> > I am investigating ways to reduce the load and memory resource usage of 
>our
> > Perl scripts.  Our application is huge now, but we broke it up into 
>modules.
> >
> > Here is the issue.
> >
> > Instead of doing this:
> >
> > use Module1;
> > use Module2;
> > use Module3;
> >
> > We do the following:
> >
> > if (I need Module1)
> > {
> >     use Module1;
> >
> >     call Module1 stuff;
> > }
> >
> > If (I need Module2)
> > {
> >    use Module2;
> >
> >    call Module2 stuff;
> > }
> >
> > ...
> >
> > We thought this would reduce our load times and memory consumption we 
>hoped
> > it would demand load the different modules, but our performance tests
> > indicate that they are identical in resource usage.
> >
> > Is there a way to make the modules demand load as I want them to?
>
>You can do as previously posted (require/import) instead of 'use'.
>
>You can use something like this (modify to suit with your if's) :
>
>BEGIN {                # check for the presence of modules
>       my $err = '';
>       my @mods = ('Net::SMTP', 'DB_File');
>       foreach my $mod (@mods) {
>               eval "use $mod";
>               if ($@) {
>                       $err .= "This script requires module '$mod'\n";
>                       $err .= "[EMAIL PROTECTED]";
>               }
>       }
>       die "$err\nExiting\n" if $err ne '';
>}
>
>
>--
>   ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
>  (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
>   / ) /--<  o // //      Castle of Medieval Myth & Magic 
>http://www.todbe.com/
>-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
>
>_______________________________________________
>Perl-Win32-Web mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_________________________________________________________________
Frustrated with dial-up? Get high-speed for as low as $26.95.  
https://broadband.msn.com (Prices may vary by service area.)

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to