NAME

Finance::Bank::Bankwest::Parsers - feed HTTP responses to multiple parsers in succession

VERSION

This module is part of distribution Finance-Bank-Bankwest v1.0.1.

This distribution's version numbering follows the conventions defined at semver.org.

DESCRIPTION

This module provides a convenient means to apply several Finance::Bank::Bankwest::Parser-consuming classes to an HTTP::Response at once in order to receive structured data from it, or have the most appropriate exception thrown.

METHODS

test

Finance::Bank::Bankwest::Parsers->test(
    $http_response,
    qw{ ParserA ParserB ... },
);

Instruct Finance::Bank::Bankwest::Parser::ParserA to inspect the supplied HTTP::Response object, returning if that parser recognises the response and deems it acceptable.

If not, and that parser doesn't emit a specific exception, repeat for Finance::Bank::Bankwest::Parser::ParserB and then any other parsers supplied.

If no parsers emit a specific exception, throw a Finance::Bank::Bankwest::Error::BadResponse exception directly.

parse

return Finance::Bank::Bankwest::Parsers->parse(
    $http_response,
    qw{ ParserA ParserB ... },
);

Instruct Finance::Bank::Bankwest::Parser::ParserA to inspect the supplied HTTP::Response object, returning structured data if that parser recognises the response and deems it acceptable.

If not, and that parser doesn't emit a specific exception, pass the response, Finance::Bank::Bankwest::Parser::ParserB and any other parsers to the "test" method so that a specific exception may be thrown.

SEE ALSO

AUTHOR

Alex Peters <lxp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Alex Peters.

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

The full text of the license can be found in the 'LICENSE' file included with this distribution.