Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
SPLAIN(1) | Perl Programmers Reference Guide | SPLAIN(1) |
NAME
diagnostics, splain - produce verbose warning diagnosticsSYNOPSIS
Using the "diagnostics" pragma:use diagnostics;
use diagnostics -verbose;
enable diagnostics;
disable diagnostics;
perl program 2>diag.out
splain [-v] [-p] diag.out
perl -Mdiagnostics=-traceonly my_script.pl
DESCRIPTION
The "diagnostics" Pragma
This module extends the terse diagnostics normally emitted by both the perl compiler and the perl interpreter (from running perl with a -w switch or "use warnings"), augmenting them with the more explicative and endearing descriptions found in perldiag. Like the other pragmata, it affects the compilation phase of your program rather than merely the execution phase.use diagnostics;
perl -Mdiagnostics=-traceonly my_bad_script
The splain Program
While apparently a whole nuther program, splain is actually nothing more than a link to the (executable) diagnostics.pm module, as well as a link to the diagnostics.pod documentation. The -v flag is like the "use diagnostics -verbose" directive. The -p flag is like the $diagnostics::PRETTY variable. Since you're post-processing with splain, there's no sense in being able to enable() or disable() processing.EXAMPLES
The following file is certain to trigger a few errors at both runtime and compiletime:use diagnostics;
print NOWHERE "nothing\n";
print STDERR "\n\tThis message should be unadorned.\n";
warn "\tThis is a user warning";
print "\nDIAGNOSTIC TESTER: Please enter a <CR> here: ";
my $a, $b = scalar <STDIN>;
print "\n";
print $x/$y;
perl -w test.pl 2>test.out
./splain < test.out
(perl -w test.pl >/dev/tty) >& test.out
./splain < test.out
exec 3>&1; perl -w test.pl 2>&1 1>&3 3>&- | splain 1>&2 3>&-
use diagnostics; # checks entire compilation phase
print "\ntime for 1st bogus diags: SQUAWKINGS\n";
print BOGUS1 'nada';
print "done with 1st bogus\n";
disable diagnostics; # only turns off runtime warnings
print "\ntime for 2nd bogus: (squelched)\n";
print BOGUS2 'nada';
print "done with 2nd bogus\n";
enable diagnostics; # turns back on runtime warnings
print "\ntime for 3rd bogus: SQUAWKINGS\n";
print BOGUS3 'nada';
print "done with 3rd bogus\n";
disable diagnostics;
print "\ntime for 4th bogus: (squelched)\n";
print BOGUS4 'nada';
print "done with 4th bogus\n";
INTERNALS
Diagnostic messages derive from the perldiag.pod file when available at runtime. Otherwise, they may be embedded in the file itself when the splain package is built. See the Makefile for details.BEGIN { $diagnostics::DEBUG = 1 }
BUGS
Not being able to say "no diagnostics" is annoying, but may not be insurmountable.BEGIN { $diagnostics::PRETTY = 1 }
AUTHOR
Tom Christiansen < tchrist@mox.perl.com>, 25 June 1995.2024-12-21 | perl v5.32.0 |