perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: Semi-newbie question.
Date Wed, 14 Apr 2004 00:03:30 GMT

> Perl*Handlers are probably it somehow, except the documentation at
> http://perl.apache.org/docs/1.0/guide/config.html#Perl_Handlers doesn't
> actually seem to bother saying WHAT all those Perl*Handlers are for (and if
> someone out there thinks that the names make them self-explanatory -- 
> well -- that may be true to a C coder who deals with writing Apache modules
> all the time, but not for me.)

try taking a look at this

  http://www.modperlcookbook.org/chapters/part3.pdf

the request cycle and what you can do with it is more complex than that, but
it may help put things into perspective for you.

> 
> <Perl> blocks aren't it either from what I can tell. I tried something as
> simple as setting $ENV{TEST_THINGY} = `date`; in a <Perl> block and it works
> fine when the server starts up, but it doesn't do it afterwards. It's always
> got that same date which shows me that <Perl> blocks aren't interpreted
> except that first time.

<Perl> sections are executed at configure time, not at request time.

> 
> -------------
> 
> Another thing I've found odd --
> 
> when I set environment variables from a <Perl> block with $ENV{WHATEVER} =
> 'some value' -- it works fine as long as I PassEnv it after.

yes, that's the proper behavior.

> When I set them
> with SetEnv, it works fine. 

yup.

> But when I set them with PerlSetEnv it's
> weird... it works fine in mod_perl,

as it should, provided you haven't set PerlSetupEnv Off.

> doesn't work under mod_cgi, 

hmm, are you sure?  that's not right.

> and works
> under mod_php ONLY after a .mp script has been hit. I don't really get why
> this is.

I wouldn't expect mod_php to see arbitrary perl variables, so I'm quite
surprised it can see them at all.  hmm...

> 
> -------------
> 
> Anyway -- so yeah -- I wanted to do something that should be really
> simple -- check the database based on a cookie, if present, and delete the
> cookie if it's invalid, otherwise set several environment variables so that
> PHP and Perl knew the same things from the session, and then run whatever
> script was requested -- but it's turning out to be a headache and I'm having
> a LOT of trouble figuring out what order the documentation is supposed to be
> read in (not to mention continually annoyed that everyone who writes such
> documents doesn't seem to understand that some people -- like me -- HATE the
> concept of ScriptAliases, and so seeing everything written as if this is the
> way it's normally done is a bit irritating).

besides the mod_perl cookbook, which (IMHO) is aimed at someone right where
you are, there are a few other books out there that should help clarify
things a bit for you:

  http://perl.apache.org/docs/offsite/books.html

in general, the only way I (as a non-php person) know of to share data
between mod_perl and mod_php is to use the notes table - $r->notes in
mod_perl and apache_notes in php (IIRC).

HTH

--Geoff



-- 
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