perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
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
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message