- h
-
Trace Perl handler callbacks during the processing of incoming
requests and during startup (PerlChildInitHandler)
- g
-
Trace global variable handling, interpreter construction,
END blocks, etc.
Alternatively, setting the environment variable to
all will include all the options listed above.
One way of setting this variable is by adding this directive to
httpd.conf:
PerlSetEnv MOD_PERL_TRACE all
For example, if you want to see a trace of the
PerlRequire and PerlModule
directives as they are executed, use:
PerlSetEnv MOD_PERL_TRACE d
You can also use the command-line environment, setting:
panic% setenv MOD_PERL_TRACE all
panic% ./httpd -X
If running under a Bourne-style shell, you can set the environment
variable for only the duration of a single command:
panic% MOD_PERL_TRACE=all ./httpd -X
If using a different shell, you should try using the
env utility, which has a similar effect:
panic% env MOD_PERL_TRACE=all ./httpd -X
For example, if you want to trace the processing of the
Apache::Reloadsetting during startup and you want
to see what happens when the following directives are processed:
PerlModule Apache::Reload
PerlInitHandler Apache::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "Apache::* Book::*"
do:
panic% setenv MOD_PERL_TRACE d
panic% ./httpd -X
PerlModule: arg='Apache::Reload'
loading perl module 'Apache::Reload'...ok
loading perl module 'Apache'...ok
loading perl module 'Tie::IxHash'...not ok
init `PerlInitHandler' stack
perl_cmd_push_handlers: @PerlInitHandler, 'Apache::Reload'
pushing `Apache::Reload' into `PerlInitHandler' handlers
perl_cmd_var: 'ReloadAll' = 'Off'
perl_cmd_var: 'ReloadModules' = 'Apache::* Book::*'
We have removed the rest of the trace and separated the output trace
into four groups, each equivalent to the appropriate setting from our
configuration example. So we can see that:
PerlModule Apache::Reload
loads the Apache::Reload and
Apache modules but fails to load
Tie::IxHash, since we don't have
it installed (which is not a fatal error in the case of
Apache::Reload).
The following initializes the PerlInitHandler
stack, as it wasn't yet used, and pushes
Apache::Reload there:
PerlInitHandler Apache::Reload
Now let's look at the trace of the handlers called
during the execution of this code:
You can see what handlers were registered to be executed during the
processing of this simple script. In our configuration we had these
relevant directives:
So if you debug your handlers, you can see what handlers were called,
whether they have registered some new handlers on the fly, and what
the return status from the executed handler was.