Ralf S. Engelschall


CGI::GuruMeditation -- Guru Meditation for CGIs


use CGI;
use CGI::GuruMeditation [options];


This is a small module accompanying the CGI module, providing the display of an error screen (somewhat resembling the classical red-on-black blinking Guru Meditation from the good-old AmigaOS before version 2.04) in case of abnormal termination of a CGI.

The module simply installs a $SIG{__DIE__} handler which sends a HTTP response showing a HTML/CSS based screen which optionally includes the Perl run-time error message, an excerpt from the CGI source code and the Perl run-time environment variables. This provides both optically more pleasant and functionally more elaborate error messages for CGIs.

This module supports both the regular CGI and the Apache/mod_perl CGI environment.


The following options can be passed either during module importing or with the configure function:

-name => name

Set an explicit name for the CGI application. Default is derived from CGI environment variable SCRIPT_FILENAME. This is disabled for identification reasons in the error screen signature text.

-debug => 0|1

Enables (1) or disables (0) debugging informations like the run-time error message, the source-code excerpt and the run-time environment variables.


This small module actually was a quick hack and proof of concept during the development of OSSP quos in 2004. It was later found useful and reusable enough for other CGIs and encapsulated into a stand-alone module. It was worked-off in July 2006 to support Apache/mod_perl, configuration options, debug information, etc. In September 2006 run-time stack backtrace information was added and the visual appearance further improved.


Ralf S. Engelschall <rse@engelschall.com>


Under the Apache/mod_perl CGI environment compile-time errors cannot be catched due to the design of mod_perl and its use of the Perl eval construct.


CGI, CGI::Carp.