The Basic of mod_perl Support
Dennis Melentyev
dennis.melentyev at infopulse.com.ua
Mon Jun 19 14:09:01 UTC 2006
В пн, 19/06/2006 в 06:26 -0700, Max Kanat-Alexander пишет:
> On Mon, 2006-06-19 at 15:44 +0300, Dennis Melentyev wrote:
> > Could you please also tell us, what other things we should know to make
> > code compatible with mod_perl? I mostly mean common mistakes and good
> > code patterns/practices.
>
> The rule I said below pretty much covers it. You just have to imagine
> that you're re-using the same compiled module over and over.
>
> For example, let's pretend that your module looks like this:
>
> package Foo;
>
> my $user = Bugzilla->user;
>
> First time you load the page, $user will be correct. Second time,
> somebody else loads the page, the $user variable won't even exist. Why?
> Because "my" puts something in the scope of the currently-running
> script.
>
> In general, it's just not a good idea to ever have code execute outside
> of a subroutine, in a .pm file. If you follow that rule, you'll be safe.
> There are some exceptions, but don't worry about it unless you *reall*
> have to. Just put everything in a subroutine.
Ok, got it.
Thank you a lot!
> > Or, just point me to some good docs on mod_perl.
>
> This is for mod_perl 1.x, and we're going to be using 2.x, but the
> ideas are basically the same:
>
> http://perl.apache.org/docs/1.0/guide/porting.html
And one more thank! The great page!
:)
More information about the developers
mailing list