diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CGI/Carp.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/CGI/Carp.pm | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/Master/tlpkg/tlperl/lib/CGI/Carp.pm b/Master/tlpkg/tlperl/lib/CGI/Carp.pm index 9d644d9c94c..c2145cafa42 100644 --- a/Master/tlpkg/tlperl/lib/CGI/Carp.pm +++ b/Master/tlpkg/tlperl/lib/CGI/Carp.pm @@ -33,9 +33,9 @@ with use CGI::Carp -And the standard warn(), die (), croak(), confess() and carp() calls -will automagically be replaced with functions that write out nicely -time-stamped messages to the HTTP server error log. +The standard warn(), die (), croak(), confess() and carp() calls will +be replaced with functions that write time-stamped messages to the +HTTP server error log. For example: @@ -57,10 +57,10 @@ saying use CGI::Carp qw(carpout); -The carpout() function requires one argument, which should be a -reference to an open filehandle for writing errors. It should be -called in a C<BEGIN> block at the top of the CGI application so that -compiler errors will be caught. Example: +The carpout() function requires one argument, a reference to an open +filehandle for writing errors. It should be called in a C<BEGIN> +block at the top of the CGI application so that compiler errors will +be caught. Example: BEGIN { use CGI::Carp qw(carpout); @@ -69,14 +69,15 @@ compiler errors will be caught. Example: carpout(LOG); } -carpout() does not handle file locking on the log for you at this point. -Also, note that carpout() does not work with in-memory file handles, although -a patch would be welcome to address that. +carpout() does not handle file locking on the log for you at this +point. Also, note that carpout() does not work with in-memory file +handles, although a patch would be welcome to address that. -The real STDERR is not closed -- it is moved to CGI::Carp::SAVEERR. Some -servers, when dealing with CGI scripts, close their connection to the -browser when the script closes STDOUT and STDERR. CGI::Carp::SAVEERR is there to -prevent this from happening prematurely. +The real STDERR is not closed -- it is moved to CGI::Carp::SAVEERR. +Some servers, when dealing with CGI scripts, close their connection to +the browser when the script closes STDOUT and STDERR. +CGI::Carp::SAVEERR is there to prevent this from happening +prematurely. You can pass filehandles to carpout() in a variety of ways. The "correct" way according to Tom Christiansen is to pass a reference to a filehandle @@ -104,17 +105,17 @@ CGI::Carp methods is called to prevent the performance hit. =head1 MAKING PERL ERRORS APPEAR IN THE BROWSER WINDOW -If you want to send fatal (die, confess) errors to the browser, ask to -import the special "fatalsToBrowser" subroutine: +If you want to send fatal (die, confess) errors to the browser, import +the special "fatalsToBrowser" subroutine: use CGI::Carp qw(fatalsToBrowser); die "Bad error here"; -Fatal errors will now be echoed to the browser as well as to the log. CGI::Carp -arranges to send a minimal HTTP header to the browser so that even errors that -occur in the early compile phase will be seen. -Nonfatal errors will still be directed to the log file only (unless redirected -with carpout). +Fatal errors will now be echoed to the browser as well as to the log. +CGI::Carp arranges to send a minimal HTTP header to the browser so +that even errors that occur in the early compile phase will be seen. +Nonfatal errors will still be directed to the log file only (unless +redirected with carpout). Note that fatalsToBrowser may B<not> work well with mod_perl version 2.0 and higher. @@ -193,10 +194,10 @@ you still may get the error message printed to STDOUT. This may have some undesireable effects when the purpose of doing the eval is to determine which of several algorithms is to be used. -By setting C<$CGI::Carp::TO_BROWSER> to 0 you can suppress printing the C<die> messages -but without all of the complexity of using C<set_die_handler>. -You can localize this effect to inside C<eval> bodies if this is desireable: -For example: +By setting C<$CGI::Carp::TO_BROWSER> to 0 you can suppress printing +the C<die> messages but without all of the complexity of using +C<set_die_handler>. You can localize this effect to inside C<eval> +bodies if this is desireable: For example: eval { local $CGI::Carp::TO_BROWSER = 0; @@ -207,12 +208,12 @@ For example: =head1 MAKING WARNINGS APPEAR AS HTML COMMENTS -It is now also possible to make non-fatal errors appear as HTML -comments embedded in the output of your program. To enable this -feature, export the new "warningsToBrowser" subroutine. Since sending -warnings to the browser before the HTTP headers have been sent would -cause an error, any warnings are stored in an internal buffer until -you call the warningsToBrowser() subroutine with a true argument: +It is also possible to make non-fatal errors appear as HTML comments +embedded in the output of your program. To enable this feature, +export the new "warningsToBrowser" subroutine. Since sending warnings +to the browser before the HTTP headers have been sent would cause an +error, any warnings are stored in an internal buffer until you call +the warningsToBrowser() subroutine with a true argument: use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI qw(:standard); @@ -320,12 +321,10 @@ Copyright 1995-2002, Lincoln D. Stein. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -Address bug reports and comments to: lstein@cshl.org - =head1 SEE ALSO -Carp, CGI::Base, CGI::BasePlus, CGI::Request, CGI::MiniSvr, CGI::Form, -CGI::Response +L<Carp>, L<CGI::Base>, L<CGI::BasePlus>, L<CGI::Request>, +L<CGI::MiniSvr>, L<CGI::Form>, L<CGI::Response>. =cut |