perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: "use" etiquette in mod_perl
Date Sun, 14 Nov 2004 03:52:20 GMT
Mark S Lowe wrote:
> Quick performance question: Will it kill performance to make sub routines in
> mod_perl call all their own use statements? For instance, I have several sub
> routines that need to query $q->param(foo), and I¹m curious if I should
> create a single instance of $q and pass it into all the respective sub
> routines, or if it¹s okay to have each method create their own $q = new CGI;
> instance. 

You certainly want to create it once per request and pass it around. Or if 
you are careful use a global instance (or singleton)

Though I don't understand what do you mean by 'use'

sub foo {
   use Bar;

is the same as:

use Bar;
sub foo {}

if that's what you mean. Since use a compile time directive. You want to 
use require() to do that at run-time.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

Report problems:
Mail list info:
List etiquette:

View raw message