Programming :  Student Freelance Forum For Work Experience Builders' (CertificationPoint) The fastest message board... ever.
 
PERL-Passing Environment Variables Between Handlers
Posted by: adcertpoint (Moderator)
Date: April 29, 2020 04:38PM

This is a simple example of passing environment variables between handlers:

Having a configuration:
PerlAccessHandler My::Access
PerlLogHandler My::Log

and in startup.pl:
sub My::Access::handler {
my $r = shift;
$r->subprocess_env(TICKET => $$);
$r->notes(TICKET => $$);
}

sub My::Log::handler {
my $r = shift;
my $env = $r->subprocess_env('TICKET');
my $note = $r->notes('TICKET');
warn "env=$env, note=$note\n";
}

Adding %{TICKET}e and %{TICKET}n to the LogFormat for access_log works fine too.

Options: ReplyQuote


Sorry, only registered users may post in this forum.
This forum powered by Phorum.