The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parse::ErrorString::Perl - Parse error messages from the perl interpreter

VERSION

Version 0.06

SYNOPSIS

    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";
    }
    

METHODS

new(lang => $lang)

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.

parse_string($string)

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):

type

A single letter idnetifying the type of the error (not implemented yet). The possbile options are W, D, S, F, P, X, and A.

type_description

A description of the error type (not implemented yet). 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
message

The error message.

file

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 (not implemented yet).

file_abspath

Absolute path to the file in which the error occurred.

file_msgpath

The file path as displayed in which the error message.

line

Line in which the error occurred.

near

Text near which the error occurred.

diagnostics

Detailed explanation of the error (from perldiag). Returned as pod, so you may need to use a pod parser to render into the format you need.

stack

Callstack for the error (not implemented yet).

AUTHOR

Petar Shangov, <pshangov at yahoo.com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Parse::ErrorString::Perl

COPYRIGHT & LICENSE

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.