Sean Chittenden wrote:
> If I use $r->notes in a mod_perl handler, is it accessible via the
> core apache request object in other non-perl modules?
>
> $r->notes('foo','bar');
>
> Is the value of notes stored in the core apache process and if so,
> is it accessible by other modules by their similar r->notes methods (ie,
> mod_java or some custom C module)? If not, why not? I wouldn't expect to
> be able to store hashes, etc (use a global var, such as
> $sitename::globalvar for that), but strings?
>
> My question being stemmed from the possibility of having to use
> mod_java and mod_perl on the same server and getting the two to talk to
> each other in a friendly manner. Anyone have any experience w/ this or
> tips w/ regards to the best way of going about this kind of a setup?
I've got this working. I'm passing notes between mod_pop3 and mod_perl, and
it's really handy.
First, I've got a mod_perl fixup handler that tosses some info in the
environment which is later read by mod_pop3. (I could have done this with
notes, but I chose env.) Then, the PHP application sometimes calls the
mod_perl app, by marking up a bunch of notes in its own request and then
issuing a sub-request to a mod_perl page. The mod_perl request handler that
gets this internal sub-request reads those notes and writes its replies in
the same place.
I read setup this request with:
if (isset($user) && substr($user,0,1) == "+") {
apache_note("imp_euser", substr($user,1));
virtual("/internal/getquota");
$quota = apache_note("imp_quota");
$quota_pp = apache_note("imp_quota_pp");
$usage_pp = apache_note("imp_usage_pp");
$percent_pp = apache_note("imp_percent_pp");
if ($quota)
$message .= " | Using $percent_pp% of $quota_pp limit";
}
and then read and write the notes with $r->main->notes from mod_perl.
- David Harris
Principal Engineer, DRH Internet Services