Chris Allen wrote:

> If site::products calls functions from site::customers, do I need
> a 'use site::customers' in site::products, when I have already
> done a 'use' in my startup.pl?


No, but I always do.  It's good documentation, to remind you that if you 
ever ran this code outside of mod_perl it would be necessary to have 
that 'use' in place.


> site::products contains the line:
> 
> @ISA=('site::base'); 
> 
> so that methods from site::base can be overridden in site::products.
> 
> Do I need a 'use site::base' in site::products for this to work 
> correctly?


Only if site::base has not been loaded already, but I always do it 
anyway, for the same reason as above.


> Is $ENV{foo}='bar'; in startup.pl equivalent to PerlSetEnv foo bar
> in httpd.conf?


Yes.


> Experience has shown that I *don't* need the 'use' statements anywhere
> other than startup.pl - but I am not sure why, and would find some pointers
> to a discussion of this very useful.


You don't need them because the modules they would load are already loaded.

> I would also be interested to know that
> if the 'use' statements *are* unnecessary, does including them add any extra
> overhead of processing/memory??


There is a very fast check that happens once when the module containing 
the 'use' is called.  It checks to see if the used module is already 
loaded (i.e. if it is in %INC).  It also calls the used module's export 
function, unless you pass an empty list:

use Foo ();

You should avoid importing symbols all over the place, as explained in 
the Guide, but otherwise there is no significant overhead from having 
use statements all over the place.

- Perrin


Reply via email to