CGI::Carp::WarningsToBrowser - A version of CGI::Carp's warningsToBrowser() that displays the warnings loudly and boldly
The author feels that it's important to expose warnings as early as possible in the software development lifecycle, preferably by the same developer who created them, as part of the "shift left" effort. "Shift left" basically means that the earlier in the SDLC that a problem can be found, the cheaper it is to fix it.
Put this at the top of your CGI script (the earlier the better, otherwise some warnings might not get captured):
use CGI::Carp::WarningsToBrowser;
Warnings will now be displayed at the very top of the web page, rather than hidden in HTML comments like CGI::Carp's version. This is intended mainly for dev and test environments, not for prod, so it's a good idea to use if:
use if $is_dev, 'CGI::Carp::WarningsToBrowser';
This module does not handle fatal errors, because CGI::Carp does an adequate job at that task.
Javascript must be enabled on the browser side, otherwise the warnings will appear at the very bottom of the document. (the warnings are actually output in an END { } block, and three lines of Javascript are used to move them to the top of the HTML page)
END { }
Dee Newcum <deenewcum@cpan.org>
Please use Github's issue tracker to file both bugs and feature requests. Contributions to the project in form of Github's pull requests are welcome.
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
To install CGI::Carp::WarningsToBrowser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Carp::WarningsToBrowser
CPAN shell
perl -MCPAN -e shell install CGI::Carp::WarningsToBrowser
For more information on module installation, please visit the detailed CPAN module installation guide.