Thanks I'll do that.
> 
> From: "Dan Muey" <[EMAIL PROTECTED]>
> > Here's something I've been wondering....
> > 
> > What kind of performance issues are there if you do a 'use' on the 
> > same module in the same script twice or more?
> 
> Depends.
> This can be verry different for different modules.
> 
>       use Module;
> does two things:
>       1. it loads, parses and compiles a module
>       2. it calls it's import() function
> 
> While the first action is only been done the very first time the 
> module is use()d anywhere in your script, the import() will be called 
> each time you use the module.
> 
> Try this:
> 
>       #file Foo.pm
>       package Foo;
>       sub import {
>               print "Import called\n";
>       }
>       1;
> 
>       #file foo.pl
>       use Foo;
>       use Foo;
>       use Foo;
>       print "ENDE\n";
> 
> 
> The import() function usualy just import some functions or variables 
> into the calling package in which you use()d the module, but there 
> are some modules that do a lot more. They usualy do take care they do 
> not do that twice though.
> 
> > Before you go ' Well that's stupid, why would you do that? ' let me 
> > explain :
> > 
> > Script one has
> > 
> > use CGI;
> > ...
> > If it does cause perfance issues is there a way to check and see if
> > the module's already been 'use'd and then if it hasn't then do use ?
> > 
> > EG if(??????) { use CGI; }
> 
>       if (!exists $INC{'CGI.pm'}) {
>               eval "use CGI";
>       }
>  
> > What if you already did
> > 
> > Use CGI params; and in the sub routine you only need say use CGI 
> > self_url; ? Or if you did use CGI param earlier and the sin 
> does use 
> > CGI;
> 
> I'm afraid you'll have to try this and see.
> 
> Jenda
> ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>       -- Terry Pratchett in Sourcery
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to