NAME

Text::Parser::Error - Exceptions for Text::Parser

VERSION

version 1.000

DESCRIPTION

This class replaces the older Text::Parser::Errors which created hundreds of subclasses. That method seemed very counter-productive and difficult to handle for programmers. There is only one function in this class that is used inside the Text::Parser package.

Any exceptions thrown by this package will be an instance of Text::Parser::Error. And Text::Parser::Error is a subclass of Throwable::Error. So you can write your code like this:

    use Try::Tiny;

    try {
        my $parser = Text::Parser->new();
        # do something
        $parser->read();
    } catch {
        print $_->as_string, "\n" if $_->isa('Text::Parser::Error');
    };

FUNCTIONS

parser_exception

Accepts a single string argument and uses it as the message attribute for the exception thrown.

    parser_exception("Something bad happened") if $something_bad;

BUGS

Please report any bugs or feature requests on the bugtracker website http://github.com/balajirama/Text-Parser/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Balaji Ramasubramanian <balajiram@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018-2019 by Balaji Ramasubramanian.

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