Parse:...::Perl(3pm)

πŸ“¦
version 0.27 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Parse::ErrorString::Perl β€” ok bestie, it's giving parser energy πŸ’–

So this page lives in the User Contributed Perl Documentation section, and it's filed under Parse:...::Perl(3pm) (yes the name is abbreviated like that, that's just how it's indexed, don't come for me).

✨ NAME ✨

Parse::ErrorString::Perl β€” parse error messages from the perl interpreter πŸ¦‹

Like. That's the whole vibe. Perl yells at you, this module reads the yelling and translates it into something structured. Iconic behaviour honestly.


🌸 SYNOPSIS 🌸

Here's the tea, code-verbatim, no cap:

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

So you make a parser, you feed it the string of stderr output, and it hands you back a lil list of error objects you can loop over. Chef's kiss. πŸ’…


πŸŽ€ METHODS πŸŽ€

new(lang => $lang)

Constructor, bestie. It takes an optional lang parameter β€” that's you saying "hey, I want my error explanations in a language that is NOT the default". And the default is English, obviously. It will try to load POD2::$lang::perldiag. 🌈

parse_string($string)

This one is the main character fr fr. You hand it an error string generated from the perl interpreter, and it attempts to parse it into a list of Parse::ErrorString::Perl::ErrorItem objects β€” each one giving you info for one single error. πŸ“

Heads up: it attempts to parse. That's the module's own wording, so don't @ me if it's not a 100% flawless slay every time. 😭

πŸ’œ SEE ALSO πŸ’œ

🫢 ACKNOWLEDGEMENTS 🫢

Part of this module is based on code from splain β€” http://perldoc.perl.org/splain.html. Shoutout, respect, we love a credited ancestor. πŸ’–

🧚 SUPPORT 🧚

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

perldoc Parse::ErrorString::Perl

Boom. Docs. Right there. In your terminal. No browser needed. ✨

πŸ‘‘ AUTHOR πŸ‘‘

Petar Shangov, <pshangov at yahoo.com> πŸ’Œ

Copyright 2008-2013 The Padre development team as listed in Padre.pm. http://padre.perlide.org/

πŸ’€ LICENSE πŸ’€

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. 🌸

πŸ”₯ DISCLAIMER OF WARRANTY πŸ”₯

Okay this part is ALL CAPS and it is ALL CAPS for a REASON, bestie, do not skip it.

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Translation: it's free, it's as-is, if it breaks, that's on you. Periodt. πŸ™ˆ


And that's the whole page, bestie!! This one's from perl v5.36.0, dated 2022-12-06, and it was filed under Parse:...::Perl(3pm) in the User Contributed Perl Documentation section. ily, go parse some errors πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from