LinuxCommandLibrary

perldiag

TLDR

View all Perl diagnostics

$ perldoc perldiag
copy
Search for specific message
$ perldoc perldiag | grep "[error message]"
copy
Use splain for explanations
$ perl [script.pl] 2>&1 | splain
copy
Enable verbose warnings
$ perl -Mdiagnostics [script.pl]
copy

SYNOPSIS

perldoc perldiag
splain [errormessage_]

DESCRIPTION

perldiag is a Perl documentation file containing all diagnostic messages that Perl can produce. Each message includes explanation and suggested fixes.
Access via perldoc or use diagnostics module for runtime explanations.

EXAMPLES

$ # Read full diagnostics
perldoc perldiag

# Use diagnostics module in script
perl -Mdiagnostics script.pl

# Explain error messages
echo "Use of uninitialized value" | splain
copy

IN SCRIPT

$ use diagnostics;      # Verbose messages
use warnings;         # Enable warnings

# Or for specific categories
use warnings qw(all);
no warnings qw(uninitialized);
copy

MESSAGE TYPES

$ (W) Warning - may indicate problem
(D) Deprecation - feature being removed
(S) Severe warning - almost certainly wrong
(F) Fatal - compilation error
(X) Alien - error from external source
copy

CAVEATS

Part of core Perl documentation. diagnostics module adds runtime overhead. Use only during development.

HISTORY

perldiag is part of Perl core documentation by Larry Wall and the Perl community.

SEE ALSO

perl(1), perlre(1), splain(1), perldoc(1)

Copied to clipboard