-
-
21 Sep 2016 16:16:39 UTC
- Distribution: HTTP-Throwable-JSONFactory
- Module version: 0.002
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (526 / 0 / 0)
- Kwalitee
Bus factor: 1- 85.71% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (14.94KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Matthew Horsfall
NAME
HTTP::Throwable::JSONFactory - Throw exceptions with JSON bodies
VERSION
version 0.002
SYNOPSIS
use HTTP::Throwable::JSONFactory qw(http_throw); http_throw(Gone => { payload => { error => "You won't find what you're looking for here", }, });
OVERVIEW
This subclass of HTTP::Throwable::Factory arranges for each built/thrown exception to consume the HTTP::Throwable::Role::JSONBody role, which will generate HTTP responses with an
application/json
content type and encode the (optional) provided payload using JSON::MaybeXS.The
payload
attribute passed tohttp_throw
orhttp_exception
should be anything allowed by "encode_json" in JSON (hashref, arrayref, etc).AUTHOR
Matthew Horsfall <wolfsage@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Matthew Horsfall.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install HTTP::Throwable::JSONFactory, copy and paste the appropriate command in to your terminal.
cpanm HTTP::Throwable::JSONFactory
perl -MCPAN -e shell install HTTP::Throwable::JSONFactory
For more information on module installation, please visit the detailed CPAN module installation guide.