The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Helix::Debug - Helix Framework debugging facility.

SYNOPSIS

In CGI gateway of your application (index.cgi) write:

    use Helix::Debug;

DESCRIPTION

The Helix::Debug package provides an easy way to avoid a confusing Internal Server Error message. It sends HTTP header before displaying error, so you don't need to dig web-server's log to find the cause of the error anymore. Obviously, it will do nothing if error is in your web-server configuration, so if Internal Server Error message still remains, check your web-server's configuration. Also, this package displays a stack trace when application dies. It is very useful in application development, so Helix::Debug is used in CGI type applications by default.

This package doesn't depend on any other framework package, so you can use it outside Helix Framework applications too.

While used, Helix::Debug hooks global die and warn subroutines, so be careful using other packages, that modify or depend on $SIG{"__DIE__"} and $SIG{"__WARN__"} handlers.

METHODS

get_stack()

Get subroutine call stack. Returns reference to array of hashrefs, each hashref stands for one level of the call stack. This hashref contains the following data:

  • package

    Package name, where error has been occured.

  • file

    File name, where error has been occured.

  • line

    Line number, which caused program to die.

  • sub

    Subroutine name, where error has been occured.

Prints the call stack in nice preformatted table. $stack - reference to array of call stack hashrefs (result, returned by get_stack() subroutine).

warn($message)

Custom warning handler. $message - warning message to be displayed. Prints HTTP header before message, so warning message could be shown in web browser.

die($message)

Custom error handler. $message - error message to be displayed. Prints HTTP header before message, so error message could be shown in web browser.

SEE ALSO

Helix, Helix::Application

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Anton Belousov, <abel@cpan.org>

COPYRIGHT

Copyright (c) 2009, Atma 7, http://www.atma7.com