# As a pragma: use diagnostics; use diagnostics -verbose; enable diagnostics; disable diagnostics; # As a program: $ perl program 2>diag.out $ splain [-v] [-p] diag.out ***** use diagnostics; ***** no diagnostics ***** BEGIN { $diagnostics::PRETTY = 1 } ***** use diagnostics -verbose ***** 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 here: "; my $a, $b = scalar ; print "\n"; print $x/$y; ***** perl -w test.pl 2>test.out ./splain < test.out ***** perl -w -Mdiagnostics test.pl ***** 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 run-time warnings print "\ntime for 2nd bogus: (squelched)\n"; print BOGUS2 'nada'; print "done with 2nd bogus\n"; enable diagnostics; # turns back on run-time 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";