You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jamie Krasnoo <kr...@socal.rr.com> on 2003/07/24 10:32:47 UTC

[MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Table use statements in startup.pl

Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
startup.pl to load them up for multiple handlers have any bad side
effects? I noticed that when I load them via startup.pl the handlers
that use them don't complain that they don't have the use statements
within the module code and still work as normal.

Jamie Krasnoo


Re: [MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Table use statements in startup.pl

Posted by Stas Bekman <st...@stason.org>.
Jamie Krasnoo wrote:
> 
> On Thu, 2003-07-24 at 02:15, Stas Bekman wrote:
> 
>>Jamie Krasnoo wrote:
>>
>>>Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
>>>startup.pl to load them up for multiple handlers have any bad side
>>>effects? I noticed that when I load them via startup.pl the handlers
>>>that use them don't complain that they don't have the use statements
>>>within the module code and still work as normal.
>>
>>While this works for you, it's a bad practice. Why? Because other people using 
>>your code may not have these modules loaded from startup.pl.
>>
> 
> 
> Won't loading them for every handler put an instance of it in
> memory over and over again though? Or will Perl realize that
> its already loaded and not load it again? How would this behave
> in MPM threadpool?

perldoc -f require

It gets loaded only once. Why should be any difference with threadpool. 
Application-wise it's all transparent.



__________________________________________________________________
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


Re: [MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Table use statements in startup.pl

Posted by Jamie Krasnoo <kr...@socal.rr.com>.

On Thu, 2003-07-24 at 02:15, Stas Bekman wrote:
> Jamie Krasnoo wrote:
> > Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
> > startup.pl to load them up for multiple handlers have any bad side
> > effects? I noticed that when I load them via startup.pl the handlers
> > that use them don't complain that they don't have the use statements
> > within the module code and still work as normal.
> 
> While this works for you, it's a bad practice. Why? Because other people using 
> your code may not have these modules loaded from startup.pl.
> 

Won't loading them for every handler put an instance of it in
memory over and over again though? Or will Perl realize that
its already loaded and not load it again? How would this behave
in MPM threadpool?

Jamie


Re: [MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Table use statements in startup.pl

Posted by Stas Bekman <st...@stason.org>.
Jamie Krasnoo wrote:
> Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
> startup.pl to load them up for multiple handlers have any bad side
> effects? I noticed that when I load them via startup.pl the handlers
> that use them don't complain that they don't have the use statements
> within the module code and still work as normal.

While this works for you, it's a bad practice. Why? Because other people using 
your code may not have these modules loaded from startup.pl.

__________________________________________________________________
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


Re: [MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Tableuse statements in startup.pl

Posted by Issac Goldstand <ma...@beamartyr.net>.
It will work.  Just be careful - if you distribute this module, the people
who use it may not include these modules in their startup.pl, and if you
discontinue usage of this module, you may end up with extra modules in
memory which aren't needed.

  Issac

----- Original Message ----- 
From: "Jamie Krasnoo" <kr...@socal.rr.com>
To: "Modperl list" <mo...@perl.apache.org>
Sent: Thursday, July 24, 2003 11:32 AM
Subject: [MP2] Placing Apache::RequestRec & Apache::RequestIO &
APR::Tableuse statements in startup.pl


> Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
> startup.pl to load them up for multiple handlers have any bad side
> effects? I noticed that when I load them via startup.pl the handlers
> that use them don't complain that they don't have the use statements
> within the module code and still work as normal.
>
> Jamie Krasnoo
>



Re: [MP2] Placing Apache::RequestRec & Apache::RequestIO & APR::Table use statements in startup.pl

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2003-07-24 at 04:32, Jamie Krasnoo wrote:
> Will placing Apache::RequestRec & Apache::RequestIO & APR::Table in
> startup.pl to load them up for multiple handlers have any bad side
> effects? I noticed that when I load them via startup.pl the handlers
> that use them don't complain that they don't have the use statements
> within the module code and still work as normal.

I like to put use() statements for all required modules in each module
that needs them.  It's good documentation.  When you tune your system
for performance, you will put all of these in startup.pl to improve
shared memory, but there's no need to take them out of the other
modules: use() staments for modules that have already been loaded simply
skip the require() part and run the import().

- Perrin