Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.41 Devel::SelfStubberChapter 8
Standard Modules
Next: 8.43 DirHandle
 

8.42 diagnostics

Provides more descriptive diagnostics than those generated by the Perl compiler and interpreter. Uses the longer, more explanatory error messages found in the perldiag manpage. Can be used as a pragma or as a standalone program, splain. When used as a pragma, diagnostics affects the compilation phase of your program as well as the execution phase. As a standalone module, it is used to post-process errors after execution has completed.

The splain program links to diagnostics.pm to act on the standard error output of a Perl program. The program's output can be sent to a file, which is then used as input to splain, or it can be piped directly to splain. Output from splain is directed to STDOUT.

8.42.1 Options

-p

Sets the variable $diagnostics::PRETTY to true.

-v

Prints the perldiag manpage introduction, then any diagnostic messages.

As a pragma:

use diagnostics [-verbose]
enables the use of diagnostics in your program (and enables Perl's -w flag). Compilation is then subject to the enhanced diagnostics, which are issued to STDERR. Set the diagnostics::PRETTY variable in a BEGIN block to provide nicer escape sequences for pagers, so your output looks better. The -verbose option prints the perldiag manpage introduction, then any diagnostic messages. Functions are:

enable

Turns diagnostics on at runtime.

disable

Turns diagnostics off at runtime.


Previous: 8.41 Devel::SelfStubberPerl in a NutshellNext: 8.43 DirHandle
8.41 Devel::SelfStubberBook Index8.43 DirHandle