Parse::ErrorString::Perl - Parse error messages from the perl interpreter
Version 0.07
use Parse::ErrorString::Perl; my $parser = Parse::ErrorString::Perl->new; # or: my $parser = Parse::ErrorString::Perl->new(lang => 'FR') to get localized explanations my @errors = $parser->parse_string($string_containing_stderr_output); foreach my $error(@errors) { print 'Captured error message "' . $error->message . '" in file ' . $error->file . ' on line ' . $error->line . "\n"; }
Constructor. Receives an optional lang parameter, specifying that error explanations need to be delivered in a language different from the default (i.e. English). Will try to load POD2::$lang::perldiag.
lang
POD2::$lang::perldiag
Receives an error string generated from the perl interpreter and attempts to parse it into a list of Parse::ErrorString::Perl::ErrorItem objects providing information for each error.
Parse::ErrorString::Perl::ErrorItem
Each object contains the following accessors (only message, file, and line are guaranteed to be present for every error):
message
file
line
Normally returns a single letter idnetifying the type of the error. The possbile options are W, D, S, F, P, X, and A. Sometimes an error can be of either of two types, in which case a string such as "S|F" is returned in scalar context and a list of the two letters is returned in list context. If type is empty, you can assume that the error was not emimtted by perl itself, but by the user or by a third-party module.
W
D
S
F
P
X
A
S|F
type
A description of the error type. The possible options are:
W => warning D => deprecation S => severe warning F => fatal error P => internal error X => very fatal error A => alien error message
If the error can be of either or two types, the two types are concactenated with " or ". Note that this description is always returned in English, regardless of the lang option.
or
The error message.
The path to the file in which the error occurred, possibly trunicated. If the error occurred in a script, the parser will attempt to return only the filename; if the error occurred in a module, the parser will attempt to return the path to the module relative to the directory in @INC in which it resides.
Absolute path to the file in which the error occurred.
The file path as displayed in which the error message.
Line in which the error occurred.
Text near which the error occurred (note that this often contains newline characters).
Additional information about where the error occurred (e.g. "at EOF").
at EOF
Detailed explanation of the error (from perldiag). If the lang option is specified when constructing the parser, an attempt will be made to return the diagnostics message in the appropriate language. If an explanation is not found in the localized perldiag, the default perldiag will also be searched. Returned as raw pod, so you may need to use a pod parser to render into the format you need.
Callstack for the error. Returns a list of Parse::ErrorString::Perl::StackItem objects.
The subroutine that was called, qualified with a package name (as printed by use diagnostics).
use diagnostics
File where subroutine was called. See file in Parse::ErrorString::Perl::ErrorItem.
See file_abspath in Parse::ErrorString::Perl::ErrorItem.
file_abspath
See file_msgpath in Parse::ErrorString::Perl::ErrorItem.
file_msgpath
The line where the subroutine was called.
Petar Shangov, <pshangov at yahoo.com>
<pshangov at yahoo.com>
splain
Part of this module is based on code from splain.
Please report any bugs or feature requests to bug-parse-errorstring-perl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-ErrorString-Perl. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-parse-errorstring-perl at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Parse::ErrorString::Perl
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-ErrorString-Perl
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Parse-ErrorString-Perl
CPAN Ratings
http://cpanratings.perl.org/d/Parse-ErrorString-Perl
Search CPAN
http://search.cpan.org/dist/Parse-ErrorString-Perl/
Copyright 2008 Petar Shangov, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Parse::ErrorString::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::ErrorString::Perl
CPAN shell
perl -MCPAN -e shell install Parse::ErrorString::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.