1Parse::ErrorString::PerUls(e3r)Contributed Perl DocumentPaatrisoen::ErrorString::Perl(3)
2
3
4
6 Parse::ErrorString::Perl - Parse error messages from the perl
7 interpreter
8
10 Version 0.11
11
13 use Parse::ErrorString::Perl;
14
15 my $parser = Parse::ErrorString::Perl->new;
16 # or: my $parser = Parse::ErrorString::Perl->new(lang => 'FR') to get localized explanations
17 my @errors = $parser->parse_string($string_containing_stderr_output);
18
19 foreach my $error(@errors) {
20 print 'Captured error message "' .
21 $error->message .
22 '" in file ' . $error->file .
23 ' on line ' . $error->line . "\n";
24 }
25
27 new(lang => $lang)
28 Constructor. Receives an optional "lang" parameter, specifying that
29 error explanations need to be delivered in a language different
30 from the default (i.e. English). Will try to load
31 "POD2::$lang::perldiag".
32
33 parse_string($string)
34 Receives an error string generated from the perl interpreter and
35 attempts to parse it into a list of
36 "Parse::ErrorString::Perl::ErrorItem" objects providing information
37 for each error.
38
40 Each object contains the following accessors (only "message", "file",
41 and "line" are guaranteed to be present for every error):
42
43 type
44 Normally returns a single letter idnetifying the type of the error.
45 The possbile options are "W", "D", "S", "F", "P", "X", and "A".
46 Sometimes an error can be of either of two types, in which case a
47 string such as ""S|F"" is returned in scalar context and a list of
48 the two letters is returned in list context. If "type" is empty,
49 you can assume that the error was not emimtted by perl itself, but
50 by the user or by a third-party module.
51
52 type_description
53 A description of the error type. The possible options are:
54
55 W => warning
56 D => deprecation
57 S => severe warning
58 F => fatal error
59 P => internal error
60 X => very fatal error
61 A => alien error message
62
63 If the error can be of either or two types, the two types are
64 concactenated with "" or "". Note that this description is always
65 returned in English, regardless of the "lang" option.
66
67 message
68 The error message.
69
70 file
71 The path to the file in which the error occurred, possibly
72 truncated. If the error occurred in a script, the parser will
73 attempt to return only the filename; if the error occurred in a
74 module, the parser will attempt to return the path to the module
75 relative to the directory in @INC in which it resides.
76
77 file_abspath
78 Absolute path to the file in which the error occurred.
79
80 file_msgpath
81 The file path as displayed in which the error message.
82
83 line
84 Line in which the error occurred.
85
86 near
87 Text near which the error occurred (note that this often contains
88 newline characters).
89
90 at Additional information about where the error occurred (e.g. ""at
91 EOF"").
92
93 diagnostics
94 Detailed explanation of the error (from perldiag). If the "lang"
95 option is specified when constructing the parser, an attempt will
96 be made to return the diagnostics message in the appropriate
97 language. If an explanation is not found in the localized perldiag,
98 the default perldiag will also be searched. Returned as raw pod, so
99 you may need to use a pod parser to render into the format you
100 need.
101
102 stack
103 Callstack for the error. Returns a list of
104 Parse::ErrorString::Perl::StackItem objects.
105
107 sub The subroutine that was called, qualified with a package name (as
108 printed by "use diagnostics").
109
110 file
111 File where subroutine was called. See "file" in
112 "Parse::ErrorString::Perl::ErrorItem".
113
114 file_abspath
115 See "file_abspath" in "Parse::ErrorString::Perl::ErrorItem".
116
117 file_msgpath
118 See "file_msgpath" in "Parse::ErrorString::Perl::ErrorItem".
119
120 line
121 The line where the subroutine was called.
122
124 Petar Shangov, "<pshangov at yahoo.com>"
125
127 splain
128
130 Part of this module is based on code from splain.
131
133 Please report any bugs or feature requests to
134 "bug-parse-errorstring-perl at rt.cpan.org", or through the web
135 interface at
136 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-ErrorString-Perl
137 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-ErrorString-
138 Perl>. I will be notified, and then you'll automatically be notified
139 of progress on your bug as I make changes.
140
142 You can find documentation for this module with the perldoc command.
143
144 perldoc Parse::ErrorString::Perl
145
146 · RT: CPAN's request tracker
147
148 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-ErrorString-Perl
149 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-ErrorString-Perl>
150
151 · AnnoCPAN: Annotated CPAN documentation
152
153 http://annocpan.org/dist/Parse-ErrorString-Perl
154 <http://annocpan.org/dist/Parse-ErrorString-Perl>
155
156 · CPAN Ratings
157
158 http://cpanratings.perl.org/d/Parse-ErrorString-Perl
159 <http://cpanratings.perl.org/d/Parse-ErrorString-Perl>
160
161 · Search CPAN
162
163 http://search.cpan.org/dist/Parse-ErrorString-Perl/
164 <http://search.cpan.org/dist/Parse-ErrorString-Perl/>
165
167 Copyright 2008 Petar Shangov, all rights reserved.
168
169 This program is free software; you can redistribute it and/or modify it
170 under the same terms as Perl itself.
171
172
173
174perl v5.12.0 2010-05-15 Parse::ErrorString::Perl(3)