HTTP-Throwable-0.027000755000767000024 013613423746 13465 5ustar00rjbsstaff000000000000README100644000767000024 64013613423746 14406 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027This archive contains the distribution HTTP-Throwable, version 0.027: a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.012. Changes100644000767000024 747113613423746 15052 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027Revision history for Perl extension HTTP::Throwable 0.027 2020-01-26 18:59:31-05:00 America/New_York - swap from AllUtils to Utils (thanks, Karen Etheridge) - work without . in @INC (thanks, Karen Etheridge) - fix a typo (thanks, Edward Betts) - teach Factory about 418 0.026 2016-01-07 23:03:30-05:00 America/New_York - fix documentation (abstract) on 429 / TooManyRequests 0.025 2016-01-02 17:51:15-05:00 America/New_York - add support for 429 (thanks, Chris Prather) - add roles_for_status_code to Factory (thanks, Chris Prather) - make it possible for factory to throw by status code, rather than short ident string 0.024 2015-08-10 08:47:31-04:00 America/New_York - update Package::Variant requirement based on CPAN testers reports 0.023 2015-08-08 09:08:51-04:00 America/New_York - fix one last bit of Moose that snuck through 0.022 2015-08-02 21:50:02-04:00 America/New_York - non-trial release of v0.021; now uses Moo instead of Moose 0.021 2015-07-11 18:45:56-04:00 America/New_York (TRIAL RELEASE) - experimentally replace Moose with Moo (thanks, Fitz Elliot, Graham Knop, and others) 0.020 2015-07-01 09:44:49-04:00 America/New_York - a 304 does not require a Location header! 0.019 2014-09-25 22:33:49-04:00 America/New_York - added a role for response 308, from RFC 7238 0.018 2013-11-19 19:54:21 America/New_York - removed use of deprecated enum syntax 0.017 2013-09-17 09:04:45 Asia/Tokyo - removed use of deprecated Class::MOP::load_class 0.016 2011-06-17 20:39:10 America/New_York - fix a test regex to work with DOS-style paths 0.015 2011-06-16 12:03:01 America/New_York - require Moose 1.23 to avoid bugs both various and sundry 0.014 2011-04-30 07:41:49 America/New_York - remove the use of // from a test, restoring perl 5.8 compatibility 0.013 2011-04-25 10:52:47 America/New_York - MooseX::StrictConstructor has changed API; track it 0.011 - fix Dist::Zilla configuration so that we get per-package $VERSION vars 0.010 [NOT BACKWARD COMPATIBLE] - significantly rewritten by rjbs, in terms of roles rather than subclasses - re-read the documentation! - HTTP::Throwable::Factory is now the piece intended most for end users - should be significantly easier to both use and extend 0.005 Sat. Feb. 12, 2011 - add proper support for RFC 2324 (thanks rjbs) - allowing more than one Proxy-Authenticate header (thanks to chansen for pointing this out, though he could have mentioned it before I released 0.004 :P) 0.004 Sat. Feb. 12, 2011 - allowing more than one WWW-Authenticate header (thanks to chansen for pointing this out) 0.003 Fri. Feb. 11, 2011 - introspection for status code via is_redirect, is_client_error and is_server_error (Brian Cassidy) 0.002 Tues. Feb. 8, 2011 - normalize *_location attributes to all be called location, since that is the name of the header - any time we allow additional headers to be passed in, the attribute is now called additional_headers instead of whatever it was before (usually cache_headers) - change the valid_methods attribute in HTTP::Throwable::MethodNotAllowed to be just allow (which is what the header is) - improved the type check on this as well - make the exceptions also function as PSGI apps - add to_app method - support &{} overload - added tests for this - overload stringification - added tests for this 0.001 Tues. Feb. 8, 2011 - first release LICENSE100644000767000024 4372413613423746 14605 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2011 by Infinity Interactive, Inc. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. 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 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2011 by Infinity Interactive, Inc. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End dist.ini100644000767000024 124013613423746 15207 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027name = HTTP-Throwable author = Stevan Little author = Ricardo Signes license = Perl_5 copyright_holder = Infinity Interactive, Inc. copyright_year = 2011 [@RJBS] [Authority] authority = cpan:STEVAN [Prereqs] Moo = 1.004003 MooX::StrictConstructor = 0 Throwable = 0.102080 Plack = 0.9967 Types::Standard = 0 Type::Tiny = 0 Package::Variant = 0 namespace::clean = 0 [Prereqs / TestRequires] Test::More = 0.88 Test::Fatal = 0.003 HTTP::Request::Common = 0 [RemovePrereqs] remove = Test::HT META.yml100644000767000024 3103413613423746 15040 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027--- abstract: 'a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries' author: - 'Stevan Little ' - 'Ricardo Signes ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' HTTP::Request::Common: '0' Plack::Builder: '0' Plack::Test: '0' Scalar::Util: '0' Test::Deep: '0' Test::Fatal: '0.003' Test::More: '0.96' base: '0' lib: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: HTTP-Throwable requires: Carp: '0' List::Util: '1.45' Module::Runtime: '0' Moo: '1.004003' Moo::Role: '0' MooX::StrictConstructor: '0' Package::Variant: '1.002000' Plack: '0.9967' Plack::Util: '0' StackTrace::Auto: '0' Sub::Exporter: '0' Sub::Exporter::Util: '0' Throwable: '0.102080' Type::Tiny: '0' Type::Utils: '0' Types::Standard: '0' namespace::clean: '0' overload: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/rjbs/HTTP-Throwable/issues homepage: https://github.com/rjbs/HTTP-Throwable repository: https://github.com/rjbs/HTTP-Throwable.git version: '0.027' x_Dist_Zilla: perl: version: '5.026003' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@RJBS/Git::GatherDir' version: '2.046' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@RJBS/CheckPrereqsIndexed' version: '0.020' - class: Dist::Zilla::Plugin::CheckExtraTests name: '@RJBS/CheckExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::RJBS phase: build run_under_travis: 0 skip: [] name: '@RJBS/RJBS-Outdated' version: '0.055' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 0 modules: [] phase: release run_under_travis: 0 skip: [] name: '@RJBS/CPAN-Outdated' version: '0.055' - class: Dist::Zilla::Plugin::PruneCruft name: '@RJBS/@Filter/PruneCruft' version: '6.012' - class: Dist::Zilla::Plugin::ManifestSkip name: '@RJBS/@Filter/ManifestSkip' version: '6.012' - class: Dist::Zilla::Plugin::MetaYAML name: '@RJBS/@Filter/MetaYAML' version: '6.012' - class: Dist::Zilla::Plugin::License name: '@RJBS/@Filter/License' version: '6.012' - class: Dist::Zilla::Plugin::Readme name: '@RJBS/@Filter/Readme' version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@RJBS/@Filter/ExecDir' version: '6.012' - class: Dist::Zilla::Plugin::ShareDir name: '@RJBS/@Filter/ShareDir' version: '6.012' - class: Dist::Zilla::Plugin::Manifest name: '@RJBS/@Filter/Manifest' version: '6.012' - class: Dist::Zilla::Plugin::TestRelease name: '@RJBS/@Filter/TestRelease' version: '6.012' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RJBS/@Filter/ConfirmRelease' version: '6.012' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RJBS/@Filter/UploadToCPAN' version: '6.012' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 9 name: '@RJBS/MakeMaker' version: '6.012' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RJBS/AutoPrereqs' version: '6.012' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: 0 version_regexp: (?^:^([0-9]+\.[0-9]+)$) Dist::Zilla::Role::Git::Repo: git_version: 2.25.0 repo_root: . name: '@RJBS/Git::NextVersion' version: '2.046' - class: Dist::Zilla::Plugin::PkgVersion name: '@RJBS/PkgVersion' version: '6.012' - class: Dist::Zilla::Plugin::MetaConfig name: '@RJBS/MetaConfig' version: '6.012' - class: Dist::Zilla::Plugin::MetaJSON name: '@RJBS/MetaJSON' version: '6.012' - class: Dist::Zilla::Plugin::NextRelease name: '@RJBS/NextRelease' version: '6.012' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: '@RJBS/Test::ChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RJBS/PodSyntaxTests' version: '6.012' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@RJBS/Test::ReportPrereqs' version: '0.027' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@RJBS/TestMoreWithSubtests' version: '6.012' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@RJBS' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Plugin::SingleEncoding name: '@RJBS/SingleEncoding' version: '4.015' - class: Pod::Weaver::Section::Name name: '@RJBS/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@RJBS/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@RJBS/Prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@RJBS/Synopsis' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@RJBS/Description' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@RJBS/Overview' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@RJBS/Stability' version: '4.015' - class: Pod::Weaver::Section::Collect name: Attributes version: '4.015' - class: Pod::Weaver::Section::Collect name: Methods version: '4.015' - class: Pod::Weaver::Section::Collect name: Functions version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@RJBS/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@RJBS/postlude' version: '4.015' - class: Pod::Weaver::Section::Authors name: '@RJBS/Authors' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@RJBS/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@RJBS/Legal' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@RJBS/List' version: '4.015' name: '@RJBS/PodWeaver' version: '4.008' - class: Dist::Zilla::Plugin::GithubMeta name: '@RJBS/GithubMeta' version: '0.58' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.25.0 repo_root: . name: '@RJBS/@Git/Check' version: '2.046' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.25.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Commit' version: '2.046' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: '0.027' tag_format: '%v' tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.25.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Tag' version: '2.046' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - 'origin :' - 'github :' remotes_must_exist: 0 Dist::Zilla::Role::Git::Repo: git_version: 2.25.0 repo_root: . name: '@RJBS/@Git/Push' version: '2.046' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.25.0 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@RJBS/Git::Contributors' version: '0.035' - class: Dist::Zilla::Plugin::Authority name: Authority version: '1.009' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: '6.012' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: TestRequires version: '6.012' - class: Dist::Zilla::Plugin::RemovePrereqs config: Dist::Zilla::Plugin::RemovePrereqs: modules_to_remove: - Test::HT name: RemovePrereqs version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.012' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.012' x_authority: cpan:STEVAN x_contributors: - 'Brian Cassidy ' - 'Chris Prather ' - 'Edward Betts ' - 'Fitz Elliott ' - 'Karen Etheridge ' x_generated_by_perl: v5.26.3 x_serialization_backend: 'YAML::Tiny version 1.73' MANIFEST100644000767000024 431213613423746 14677 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README README.md dist.ini lib/HTTP/Throwable.pm lib/HTTP/Throwable/Factory.pm lib/HTTP/Throwable/Role/BoringText.pm lib/HTTP/Throwable/Role/Generic.pm lib/HTTP/Throwable/Role/NoBody.pm lib/HTTP/Throwable/Role/Redirect.pm lib/HTTP/Throwable/Role/Status/BadGateway.pm lib/HTTP/Throwable/Role/Status/BadRequest.pm lib/HTTP/Throwable/Role/Status/Conflict.pm lib/HTTP/Throwable/Role/Status/ExpectationFailed.pm lib/HTTP/Throwable/Role/Status/Forbidden.pm lib/HTTP/Throwable/Role/Status/Found.pm lib/HTTP/Throwable/Role/Status/GatewayTimeout.pm lib/HTTP/Throwable/Role/Status/Gone.pm lib/HTTP/Throwable/Role/Status/HTTPVersionNotSupported.pm lib/HTTP/Throwable/Role/Status/ImATeapot.pm lib/HTTP/Throwable/Role/Status/InternalServerError.pm lib/HTTP/Throwable/Role/Status/LengthRequired.pm lib/HTTP/Throwable/Role/Status/MethodNotAllowed.pm lib/HTTP/Throwable/Role/Status/MovedPermanently.pm lib/HTTP/Throwable/Role/Status/MultipleChoices.pm lib/HTTP/Throwable/Role/Status/NotAcceptable.pm lib/HTTP/Throwable/Role/Status/NotFound.pm lib/HTTP/Throwable/Role/Status/NotImplemented.pm lib/HTTP/Throwable/Role/Status/NotModified.pm lib/HTTP/Throwable/Role/Status/PermanentRedirect.pm lib/HTTP/Throwable/Role/Status/PreconditionFailed.pm lib/HTTP/Throwable/Role/Status/ProxyAuthenticationRequired.pm lib/HTTP/Throwable/Role/Status/RequestEntityTooLarge.pm lib/HTTP/Throwable/Role/Status/RequestTimeout.pm lib/HTTP/Throwable/Role/Status/RequestURITooLong.pm lib/HTTP/Throwable/Role/Status/RequestedRangeNotSatisfiable.pm lib/HTTP/Throwable/Role/Status/SeeOther.pm lib/HTTP/Throwable/Role/Status/ServiceUnavailable.pm lib/HTTP/Throwable/Role/Status/TemporaryRedirect.pm lib/HTTP/Throwable/Role/Status/TooManyRequests.pm lib/HTTP/Throwable/Role/Status/Unauthorized.pm lib/HTTP/Throwable/Role/Status/UnsupportedMediaType.pm lib/HTTP/Throwable/Role/Status/UseProxy.pm lib/HTTP/Throwable/Role/TextBody.pm lib/HTTP/Throwable/Variant.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/000-load.t t/001-basic.t t/002-to-app.t t/300-all.t t/400-all.t t/500-all.t t/lib/Test/HT.pm xt/author/pod-syntax.t xt/release/changes_has_content.t README.md100644000767000024 136113613423746 15026 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027# HTTP-Throwable This is a set of strongy-typed, PSGI-friendly exception classes corresponding to the HTTP error status code (4xx-5xx) as well as the redirection codes (3xx). ## Installation To install this module type the following: perl Makefile.PL make make test make install ## Dependencies This module requires these other modules and libraries: Moo MooX::StrictConstructor Throwable Plack List::AllUtils Types::Standard Type::Tiny Package::Variant namespace::clean ## Copyright and License Copyright (C) 2011 Infinity Interactive, Inc. (http://www.iinteractive.com) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. META.json100644000767000024 4732013613423746 15215 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027{ "abstract" : "a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries", "author" : [ "Stevan Little ", "Ricardo Signes " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "HTTP-Throwable", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Encode" : "0", "Test::More" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "List::Util" : "1.45", "Module::Runtime" : "0", "Moo" : "1.004003", "Moo::Role" : "0", "MooX::StrictConstructor" : "0", "Package::Variant" : "1.002000", "Plack" : "0.9967", "Plack::Util" : "0", "StackTrace::Auto" : "0", "Sub::Exporter" : "0", "Sub::Exporter::Util" : "0", "Throwable" : "0.102080", "Type::Tiny" : "0", "Type::Utils" : "0", "Types::Standard" : "0", "namespace::clean" : "0", "overload" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "HTTP::Request::Common" : "0", "Plack::Builder" : "0", "Plack::Test" : "0", "Scalar::Util" : "0", "Test::Deep" : "0", "Test::Fatal" : "0.003", "Test::More" : "0.96", "base" : "0", "lib" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/rjbs/HTTP-Throwable/issues" }, "homepage" : "https://github.com/rjbs/HTTP-Throwable", "repository" : { "type" : "git", "url" : "https://github.com/rjbs/HTTP-Throwable.git", "web" : "https://github.com/rjbs/HTTP-Throwable" } }, "version" : "0.027", "x_Dist_Zilla" : { "perl" : { "version" : "5.026003" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@RJBS/Git::GatherDir", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@RJBS/CheckPrereqsIndexed", "version" : "0.020" }, { "class" : "Dist::Zilla::Plugin::CheckExtraTests", "name" : "@RJBS/CheckExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::RJBS" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@RJBS/RJBS-Outdated", "version" : "0.055" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 0, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [] } }, "name" : "@RJBS/CPAN-Outdated", "version" : "0.055" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@RJBS/@Filter/PruneCruft", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@RJBS/@Filter/ManifestSkip", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RJBS/@Filter/MetaYAML", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RJBS/@Filter/License", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@RJBS/@Filter/Readme", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RJBS/@Filter/ExecDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RJBS/@Filter/ShareDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RJBS/@Filter/Manifest", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RJBS/@Filter/TestRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RJBS/@Filter/ConfirmRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RJBS/@Filter/UploadToCPAN", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 9 } }, "name" : "@RJBS/MakeMaker", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RJBS/AutoPrereqs", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : 0, "version_regexp" : "(?^:^([0-9]+\\.[0-9]+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.25.0", "repo_root" : "." } }, "name" : "@RJBS/Git::NextVersion", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@RJBS/PkgVersion", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RJBS/MetaConfig", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RJBS/MetaJSON", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RJBS/NextRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "@RJBS/Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RJBS/PodSyntaxTests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@RJBS/Test::ReportPrereqs", "version" : "0.027" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@RJBS/TestMoreWithSubtests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@RJBS" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@RJBS/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@RJBS/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@RJBS/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/Prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Synopsis", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Description", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Overview", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Stability", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Attributes", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Methods", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Functions", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@RJBS/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@RJBS/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@RJBS/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@RJBS/Legal", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@RJBS/List", "version" : "4.015" } ] } }, "name" : "@RJBS/PodWeaver", "version" : "4.008" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@RJBS/GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.25.0", "repo_root" : "." } }, "name" : "@RJBS/@Git/Check", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.25.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Commit", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "0.027", "tag_format" : "%v", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.25.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Tag", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin :", "github :" ], "remotes_must_exist" : 0 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.25.0", "repo_root" : "." } }, "name" : "@RJBS/@Git/Push", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.25.0", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@RJBS/Git::Contributors", "version" : "0.035" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "TestRequires", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::RemovePrereqs", "config" : { "Dist::Zilla::Plugin::RemovePrereqs" : { "modules_to_remove" : [ "Test::HT" ] } }, "name" : "RemovePrereqs", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.012" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.012" } }, "x_authority" : "cpan:STEVAN", "x_contributors" : [ "Brian Cassidy ", "Chris Prather ", "Edward Betts ", "Fitz Elliott ", "Karen Etheridge " ], "x_generated_by_perl" : "v5.26.3", "x_serialization_backend" : "Cpanel::JSON::XS version 4.18" } t000755000767000024 013613423746 13651 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027300-all.t100644000767000024 354513613423746 15255 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use Test::More; use lib 't/lib'; use Test::HT; ht_test(MultipleChoices => { location => '/test' }, { code => 300, reason => 'Multiple Choices', headers => [ Location => '/test' ], }); ht_test(MovedPermanently => { location => '/test' }, { code => 301, reason => 'Moved Permanently', headers => [ Location => '/test', ], }); ht_test( Found => { location => '/test', additional_headers => [ Expires => 'Soonish', ], }, { code => 302, reason => 'Found', headers => [ Location => '/test', Expires => 'Soonish', ], }, ); ht_test(SeeOther => { location => '/test' }, { code => 303, reason => 'See Other', headers => [ Location => '/test', ], }); ht_test(303 => { location => '/test' }, { code => 303, reason => 'See Other', headers => [ Location => '/test', ], }); ht_test( NotModified => { additional_headers => [ 'Expires' => 'Soonish', ], }, { code => 304, reason => 'Not Modified', as_string => '304 Not Modified', body => undef, length => 0, headers => [ Expires => 'Soonish', ], }, ); ht_test(UseProxy => { location => '/proxy/test' }, { code => 305, reason => 'Use Proxy', headers => [ Location => '/proxy/test', ], }); ht_test( TemporaryRedirect => { location => '/test', additional_headers => [ 'Expires' => 'Soonish' ] }, { code => 307, reason => 'Temporary Redirect', headers => [ 'Location' => '/test', 'Expires' => 'Soonish', ], }, ); done_testing; 400-all.t100644000767000024 520413613423746 15250 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Fatal; use lib 't/lib'; use Test::HT; ht_test(BadRequest => {}, { code => 400, reason => 'Bad Request', }); ht_test(400 => {}, { code => 400, reason => 'Bad Request', }); ht_test( Unauthorized => { www_authenticate => 'Basic realm="realm"' }, { code => 401, reason => 'Unauthorized', headers => [ 'WWW-Authenticate' => 'Basic realm="realm"' ], }, ); ht_test( Unauthorized => { www_authenticate => [ 'Basic realm="basic realm"', 'Digest realm="digest realm"', ] }, { code => 401, reason => 'Unauthorized', headers => [ 'WWW-Authenticate' => 'Basic realm="basic realm"', 'WWW-Authenticate' => 'Digest realm="digest realm"', ], }, ); ht_test(Forbidden => {}, { code => 403, reason => 'Forbidden', }); ht_test(NotFound=> {}, { code => 404, reason => 'Not Found', }); ht_test(MethodNotAllowed => { allow => [ qw(GET PUT) ] }, { code => 405, reason => 'Method Not Allowed', headers => [ Allow => 'GET,PUT' ], }); like( exception { HTTP::Throwable::Factory->throw(MethodNotAllowed => { allow => [ 'GET', 'PUT', 'OPTIONS', 'PUT' ], }); }, qr/did not pass type constraint.+\{"allow"\}/, '... type check works (must be unique list)', ); like( exception { HTTP::Throwable::Factory->throw(MethodNotAllowed => { allow => [ 'GET', 'PUT', 'OPTIONS', 'TEST' ], }); }, qr/did not pass type constraint.+\{"allow"\}/, '... type check works (must be all known methods)', ); ht_test(NotAcceptable => {}, { code => 406, reason => 'Not Acceptable', }); ht_test( ProxyAuthenticationRequired => { proxy_authenticate => 'Basic realm="realm"' }, { code => 407, reason => 'Proxy Authentication Required', headers => [ 'Proxy-Authenticate' => 'Basic realm="realm"' ], }, ); ht_test( ProxyAuthenticationRequired => { proxy_authenticate => [ 'Basic realm="realm"', 'Digest realm="other_realm"', ], }, { code => 407, reason => 'Proxy Authentication Required', headers => [ 'Proxy-Authenticate' => 'Basic realm="realm"', 'Proxy-Authenticate' => 'Digest realm="other_realm"', ], }, ); ht_test(RequestTimeout => {}, { code => 408, reason => 'Request Timeout', }); ht_test(Conflict => {}, { code => 409, reason => 'Conflict', }); done_testing; 500-all.t100644000767000024 160613613423746 15253 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use Test::Deep qw(ignore re); use Test::More; use Test::Fatal; use lib 't/lib'; use Test::HT; ht_test(InternalServerError => {}, { code => 500, reason => 'Internal Server Error', length => ignore(), body => re(qr{500 Internal Server Error.+at t.lib.Test.HT.pm}s), }); ht_test(NotImplemented => {}, { code => 501, reason => 'Not Implemented', }); ht_test(BadGateway => {}, { code => 502, reason => 'Bad Gateway', }); ht_test(ServiceUnavailable => { retry_after => 'A Little While' }, { code => 503, reason => 'Service Unavailable', headers => [ 'Retry-After' => 'A Little While' ], }); ht_test(GatewayTimeout => {}, { code => 504, reason => 'Gateway Timeout', }); ht_test(HTTPVersionNotSupported => {}, { code => 505, reason => 'HTTP Version Not Supported', }); done_testing; Makefile.PL100644000767000024 475113613423746 15527 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries", "AUTHOR" => "Stevan Little , Ricardo Signes ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "HTTP-Throwable", "LICENSE" => "perl", "NAME" => "HTTP::Throwable", "PREREQ_PM" => { "Carp" => 0, "List::Util" => "1.45", "Module::Runtime" => 0, "Moo" => "1.004003", "Moo::Role" => 0, "MooX::StrictConstructor" => 0, "Package::Variant" => "1.002000", "Plack" => "0.9967", "Plack::Util" => 0, "StackTrace::Auto" => 0, "Sub::Exporter" => 0, "Sub::Exporter::Util" => 0, "Throwable" => "0.102080", "Type::Tiny" => 0, "Type::Utils" => 0, "Types::Standard" => 0, "namespace::clean" => 0, "overload" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "HTTP::Request::Common" => 0, "Plack::Builder" => 0, "Plack::Test" => 0, "Scalar::Util" => 0, "Test::Deep" => 0, "Test::Fatal" => "0.003", "Test::More" => "0.96", "base" => 0, "lib" => 0 }, "VERSION" => "0.027", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "HTTP::Request::Common" => 0, "List::Util" => "1.45", "Module::Runtime" => 0, "Moo" => "1.004003", "Moo::Role" => 0, "MooX::StrictConstructor" => 0, "Package::Variant" => "1.002000", "Plack" => "0.9967", "Plack::Builder" => 0, "Plack::Test" => 0, "Plack::Util" => 0, "Scalar::Util" => 0, "StackTrace::Auto" => 0, "Sub::Exporter" => 0, "Sub::Exporter::Util" => 0, "Test::Deep" => 0, "Test::Fatal" => "0.003", "Test::More" => "0.96", "Throwable" => "0.102080", "Type::Tiny" => 0, "Type::Utils" => 0, "Types::Standard" => 0, "base" => 0, "lib" => 0, "namespace::clean" => 0, "overload" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); 000-load.t100644000767000024 16413613423746 15373 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { use_ok('HTTP::Throwable'); } done_testing;001-basic.t100644000767000024 243213613423746 15556 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Fatal; use lib 't/lib'; use Test::HT; ht_test( { status_code => 500, reason => 'Internal Server Error' }, { code => 500, reason => 'Internal Server Error', assert => sub { my $e = shift; is( "$e", '500 Internal Server Error', '... got the right string overload', ); if ($e->does('HTTP::Throwable::Role::TextBody')) { is_deeply( $e->(), [ 500, [ 'Content-Type' => 'text/plain', 'Content-Length' => 25, ], [ '500 Internal Server Error' ] ], '... got the right &{} overload transformation' ); } }, }, ); subtest "strict constructors all around" => sub { my $error = exception { HTTP::Throwable::Factory->throw(MovedPermanently => { location => '/foo', bogus => 123, }); }; like( $error, qr{Found unknown attribute\(s\) passed to the constructor}, "http throwables have strict constructors", ); }; done_testing; 002-to-app.t100644000767000024 470513613423746 15703 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!/usr/bin/perl use strict; use warnings; use HTTP::Throwable::Factory; use Test::More; use Plack::Test; use Plack::Builder; use HTTP::Request::Common qw[ GET ]; test_psgi( app => builder { mount '/old' => HTTP::Throwable::Factory->new_exception( MovedPermanently => { location => '/new' } ); mount '/new' => sub { [ 200, [], ['HERE']]; }; }, client => sub { my $cb = shift; { my $req = GET "/old"; my $res = $cb->($req); is($res->code, 301, '... got the right status code'); is($res->header('Content-Type'), 'text/plain', '... got the right Content-Type header'); is($res->header('Content-Length'), 21, '... got the right Content-Length header'); is($res->header('Location'), '/new', '... got the right Allow header'); is($res->content, '301 Moved Permanently', '... got the right content body'); } { my $req = GET "/new"; my $res = $cb->($req); is($res->code, 200, '... got the right status code'); is($res->content, 'HERE', '... got the right content body'); } } ); test_psgi( app => HTTP::Throwable::Factory->new_exception( MethodNotAllowed => { allow => [ qw(POST PUT) ] } ), client => sub { my $cb = shift; { my $req = GET "/"; my $res = $cb->($req); is($res->code, 405, '... got the right status code'); is($res->header('Content-Type'), 'text/plain', '... got the right Content-Type header'); is($res->header('Content-Length'), 22, '... got the right Content-Length header'); is($res->header('Allow'), 'POST,PUT', '... got the right Allow header'); is($res->content, '405 Method Not Allowed', '... got the right content body'); } } ); test_psgi( app => HTTP::Throwable::Factory->new_exception('NotFound'), client => sub { my $cb = shift; { my $req = GET "/"; my $res = $cb->($req); is($res->code, 404, '... got the right status code'); is($res->header('Content-Type'), 'text/plain', '... got the right Content-Type header'); is($res->header('Content-Length'), 13, '... got the right Content-Length header'); is($res->content, '404 Not Found', '... got the right content body'); } } ); done_testing; Test000755000767000024 013613423746 15336 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t/libHT.pm100644000767000024 1160513613423746 16372 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t/lib/Testpackage Test::HT; use strict; use warnings; use HTTP::Throwable::Factory; use Scalar::Util qw(blessed reftype); use Test::Deep qw(cmp_deeply bag); use Test::Fatal; use Test::More; use Sub::Exporter -setup => { exports => [ qw(ht_test) ], groups => [ default => [ '-all' ] ], }; { package MyFactory; use base 'HTTP::Throwable::Factory'; sub extra_roles { return qw( HTTP::Throwable::Role::NoBody ); } } sub ht_test { my ($identifier, $arg); ($identifier, $arg) = ref $_[0] ? (undef, shift) : (shift, shift || {}); my $comment = (defined $_[0] and ! ref $_[0]) ? shift(@_) : sprintf("ht_test at %s, line %s", (caller)[1, 2]); my $extra = (! defined $_[0]) ? {} : (! reftype $_[0]) ? confess("bogus extra value") : (reftype $_[0] eq 'CODE') ? { assert => $_[0] } : (reftype $_[0] eq 'HASH') ? $_[0] : confess("bogus extra value"); subtest $comment => sub { for my $factory_class ( 'HTTP::Throwable::Factory', 'MyFactory', ) { subtest "...using $factory_class" => sub { local $Test::Builder::Level = $Test::Builder::Level + 1; my $err = exception { $factory_class->throw($identifier, $arg); }; if (ok( blessed($err), "thrown exception is an object")) { ok( $err->does('HTTP::Throwable') ); ok( $err->does('Throwable') ); } else { diag "want: a blessed exception object"; diag "have: $err"; die "further testing would be useless"; } if (my $code = $extra->{code}) { is($err->status_code, $code, "got expected status code"); $code =~ /^3/ ? ok( $err->is_redirect, "it's a redirect" ) : ok( ! $err->is_redirect, "it's not a redirect" ); $code =~ /^4/ ? ok( $err->is_client_error, "it's a client error") : ok( ! $err->is_client_error, "it's a not client error"); $code =~ /^5/ ? ok( $err->is_server_error, "it's a server error") : ok( ! $err->is_server_error, "it's not a server error"); } if (defined $extra->{reason}) { is($err->reason, $extra->{reason}, "got expected reason"); } my $status_line; if (defined $extra->{code} and defined $extra->{reason}) { $status_line = join q{ }, @$extra{ qw(code reason) }; is( $err->status_line, $status_line, "expected status line", ); } # XXX: Gross, sorry. -- rjbs, 2011-02-21 my $as_string = exists $extra->{as_string} ? $extra->{as_string} : $factory_class eq 'MyFactory' ? $status_line : exists $extra->{body} ? $extra->{body} : $status_line; cmp_deeply($err->as_string, $as_string, "expected as_string") if defined $as_string; { my $body = exists $extra->{body} ? $extra->{body} : $status_line; # XXX: Another gross conditional -- rjbs, 2011-02-21 $body = undef if $factory_class eq 'MyFactory'; my $length = defined $extra->{length} ? $extra->{length} : defined length $body ? length $body : 0; my $psgi = $err->as_psgi; my $expect = [ $extra->{code}, bag( (defined $body ? ('Content-Type' => 'text/plain') : ()), 'Content-Length' => $length, @{ $extra->{headers} || [] }, ), [ defined $body ? $body : () ] ]; cmp_deeply( $psgi, $expect, '... got the right PSGI transformation' ); } if ($extra->{assert}) { local $_ = $err; $extra->{assert}->($err); } } } }; } 1; HTTP000755000767000024 013613423746 14733 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/libThrowable.pm100644000767000024 5456613613423746 17420 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTPpackage HTTP::Throwable; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::VERSION = '0.027'; use Types::Standard qw(Int Str ArrayRef); use Moo::Role; use overload '&{}' => 'to_app', '""' => 'as_string', fallback => 1; use Plack::Util (); with 'Throwable'; has 'status_code' => ( is => 'ro', isa => Int, builder => 'default_status_code', ); has 'reason' => ( is => 'ro', isa => Str, required => 1, builder => 'default_reason', ); has 'message' => ( is => 'ro', isa => Str, predicate => 'has_message', ); # TODO: type this attribute more strongly -- rjbs, 2011-02-21 has 'additional_headers' => ( is => 'ro', isa => ArrayRef ); sub build_headers { my ($self, $body) = @_; my @headers; @headers = @{ $self->body_headers($body) }; if ( my $additional_headers = $self->additional_headers ) { push @headers => @$additional_headers; } return \@headers; } sub status_line { my $self = shift; my $out = $self->status_code . " " . $self->reason; $out .= " " . $self->message if $self->message; return $out; } requires 'body'; requires 'body_headers'; requires 'as_string'; sub as_psgi { my $self = shift; my $body = $self->body; my $headers = $self->build_headers( $body ); [ $self->status_code, $headers, [ defined $body ? $body : () ] ]; } sub to_app { my $self = shift; sub { my $env; $self->as_psgi( $env ) } } sub is_redirect { my $status = (shift)->status_code; return $status >= 300 && $status < 400; } sub is_client_error { my $status = (shift)->status_code; return $status >= 400 && $status < 500; } sub is_server_error { my $status = (shift)->status_code; return $status >= 500 && $status < 600; } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable - a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries =head1 VERSION version 0.027 =head1 SYNOPSIS B: The interface for HTTP::Throwable has changed significantly between 0.005 and 0.010. Further backward incompatibilities may appear in the next few weeks, as the interface is refined. This notice will be removed when it has stabilized. I, you probably want to use L, so here's a sample of how that works: use HTTP::Throwable::Factory qw(http_throw http_exception); # you can just throw a generic exception... HTTP::Throwable::Factory->throw({ status_code => 500, reason => 'Internal Server Error', message => 'Something has gone very wrong!' }); # or with a little sugar... http_throw({ status_code => 500, reason => 'Internal Server Error', message => 'Something has gone very wrong!' }); # ...but it's much more convenient to throw well-defined exceptions, like # this: http_throw(InternalServerError => { message => 'Something has gone very wrong!', }); # or you can use the exception objects as PSGI apps: builder { mount '/old' => http_exception(MovedPermanently => { location => '/new' }), # ... }; =head1 DESCRIPTION HTTP-Throwable provides a set of strongly-typed, PSGI-friendly exception implementations corresponding to the HTTP error status code (4xx-5xx) as well as the redirection codes (3xx). This particular package (HTTP::Throwable) is the shared role for all the exceptions involved. It's not intended that you use HTTP::Throwable directly, although you can, and instructions for using it correctly are given below. Instead, you probably want to use L, which will assemble exception classes from roles needed to build an exception for your use case. For example, you can throw a redirect: use HTTP::Throwable::Factory qw(http_throw); http_throw(MovedPermanently => { location => '/foo-bar' }); ...or a generic fully user-specified exception... http_throw({ status_code => 512, reason => 'Server on fire', message => "Please try again after heavy rain", }); For a list of pre-defined, known errors, see L below. These types will have the correct status code and reason, and will understand extra status-related arguments like redirect location or authentication realms. For information on using HTTP::Throwable directly, see L, below. =head2 HTTP::Exception This module is similar to HTTP::Exception with a few, well uhm, exceptions. First, we are not implementing the 1xx and 2xx status codes, it is this authors opinion that those not being errors or an exception control flow (redirection) should not be handled with exceptions. And secondly, this module is very PSGI friendly in that it can turn your exception into a PSGI response with just a method call. All that said HTTP::Exception is a wonderful module and if that better suits your needs, then by all means, use it. =head2 Note about Stack Traces It should be noted that even though these are all exception objects, only the 500 Internal Server Error error actually includes the stack trace (albeit optionally). This is because more often then not you will not actually care about the stack trace and therefore do not the extra overhead. If you do find you want a stack trace though, it is as simple as adding the L role to your exceptions. =head1 ATTRIBUTES =head2 status_code This is the status code integer as specified in the HTTP spec. =head2 reason This is the reason phrase as specified in the HTTP spec. =head2 message This is an additional message string that can be supplied, which I be used when stringifying or building an HTTP response. =head2 additional_headers This is an arrayref of pairs that will be added to the headers of the exception when converted to a HTTP message. =head1 METHODS =head2 status_line This returns a string that would be used as a status line in a response, like C<404 Not Found>. =head2 as_string This returns a string representation of the exception. This method B be implemented by any class consuming this role. =head2 as_psgi This returns a representation of the exception object as PSGI response. In theory, it accepts a PSGI environment as its only argument, but currently the environment is ignored. =head2 to_app This is the standard Plack convention for Ls. It will return a CODE ref which expects the C<$env> parameter and returns the results of C. =head2 &{} We overload C<&{}> to call C, again in keeping with the L convention. =head1 WELL-KNOWN TYPES Below is a list of the well-known types recognized by the factory and shipped with this distribution. The obvious 4xx and 5xx errors are included but we also include the 3xx redirection status codes. This is because, while not really an error, the 3xx status codes do represent an exceptional control flow. The implementation for each of these is in a role with a name in the form C. For example, "Gone" is C. When throwing the exception with the factory, just pass "Gone" =head2 Redirection 3xx This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. =over 4 =item 300 L =item 301 L =item 302 L =item 303 L =item 304 L =item 305 L =item 307 L =back =head2 Client Error 4xx The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included entity to the user. =over 4 =item 400 L =item 401 L =item 403 L =item 404 L =item 405 L =item 406 L =item 407 L =item 408 L =item 409 L =item 410 L =item 411 L =item 412 L =item 413 L =item 414 L =item 415 L =item 416 L =item 417 L =back =head2 Server Error 5xx Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents SHOULD display any included entity to the user. These response codes are applicable to any request method. =over 4 =item 500 L =item 501 L =item 502 L =item 503 L =item 504 L =item 505 L =back =head1 COMPOSING WITH HTTP::THROWABLE In general, we expect that you'll use L or a subclass to throw exceptions. You can still use HTTP::Throwable directly, though, if you keep these things in mind: HTTP::Throwable is mostly concerned about providing basic headers and a PSGI representation. It doesn't worry about the body or a stringification. You B provide the methods C and C and C. The C method returns the string (of octets) to be sent as the HTTP entity. That body is passed to the C method, which must return an arrayref of headers to add to the response. These will generally include the Content-Type and Content-Length headers. The C method should return a printable string, even if the body is going to be empty. For convenience, these three methods are implemented by the roles L and L. =head1 SEE ALSO =over 4 =item * L =item * L =back =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 CONTRIBUTORS =for stopwords Brian Cassidy Chris Prather Edward Betts Fitz Elliott Karen Etheridge =over 4 =item * Brian Cassidy =item * Chris Prather =item * Edward Betts =item * Fitz Elliott =item * Karen Etheridge =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: a set of strongly-typed, PSGI-friendly HTTP 1.1 exception libraries #pod =head1 SYNOPSIS #pod #pod B: The interface for HTTP::Throwable has changed significantly #pod between 0.005 and 0.010. Further backward incompatibilities may appear in the #pod next few weeks, as the interface is refined. This notice will be removed when #pod it has stabilized. #pod #pod I, you probably want to use L, so here's a #pod sample of how that works: #pod #pod use HTTP::Throwable::Factory qw(http_throw http_exception); #pod #pod # you can just throw a generic exception... #pod HTTP::Throwable::Factory->throw({ #pod status_code => 500, #pod reason => 'Internal Server Error', #pod message => 'Something has gone very wrong!' #pod }); #pod #pod # or with a little sugar... #pod http_throw({ #pod status_code => 500, #pod reason => 'Internal Server Error', #pod message => 'Something has gone very wrong!' #pod }); #pod #pod #pod # ...but it's much more convenient to throw well-defined exceptions, like #pod # this: #pod #pod http_throw(InternalServerError => { #pod message => 'Something has gone very wrong!', #pod }); #pod #pod # or you can use the exception objects as PSGI apps: #pod builder { #pod mount '/old' => http_exception(MovedPermanently => { location => '/new' }), #pod # ... #pod }; #pod #pod =head1 DESCRIPTION #pod #pod HTTP-Throwable provides a set of strongly-typed, PSGI-friendly exception #pod implementations corresponding to the HTTP error status code (4xx-5xx) as well #pod as the redirection codes (3xx). #pod #pod This particular package (HTTP::Throwable) is the shared role for all the #pod exceptions involved. It's not intended that you use HTTP::Throwable #pod directly, although you can, and instructions for using it correctly are #pod given below. Instead, you probably want to use #pod L, which will assemble exception classes from #pod roles needed to build an exception for your use case. #pod #pod For example, you can throw a redirect: #pod #pod use HTTP::Throwable::Factory qw(http_throw); #pod #pod http_throw(MovedPermanently => { location => '/foo-bar' }); #pod #pod ...or a generic fully user-specified exception... #pod #pod http_throw({ #pod status_code => 512, #pod reason => 'Server on fire', #pod message => "Please try again after heavy rain", #pod }); #pod #pod For a list of pre-defined, known errors, see L below. #pod These types will have the correct status code and reason, and will #pod understand extra status-related arguments like redirect location or authentication realms. #pod #pod For information on using HTTP::Throwable directly, see L, below. #pod #pod =head2 HTTP::Exception #pod #pod This module is similar to HTTP::Exception with a few, well uhm, #pod exceptions. First, we are not implementing the 1xx and 2xx status #pod codes, it is this authors opinion that those not being errors or #pod an exception control flow (redirection) should not be handled with #pod exceptions. And secondly, this module is very PSGI friendly in that #pod it can turn your exception into a PSGI response with just a #pod method call. #pod #pod All that said HTTP::Exception is a wonderful module and if that #pod better suits your needs, then by all means, use it. #pod #pod =head2 Note about Stack Traces #pod #pod It should be noted that even though these are all exception objects, #pod only the 500 Internal Server Error error actually includes the stack #pod trace (albeit optionally). This is because more often then not you will #pod not actually care about the stack trace and therefore do not the extra #pod overhead. If you do find you want a stack trace though, it is as simple #pod as adding the L role to your exceptions. #pod #pod =attr status_code #pod #pod This is the status code integer as specified in the HTTP spec. #pod #pod =attr reason #pod #pod This is the reason phrase as specified in the HTTP spec. #pod #pod =attr message #pod #pod This is an additional message string that can be supplied, which I #pod be used when stringifying or building an HTTP response. #pod #pod =attr additional_headers #pod #pod This is an arrayref of pairs that will be added to the headers of the #pod exception when converted to a HTTP message. #pod #pod =method status_line #pod #pod This returns a string that would be used as a status line in a response, #pod like C<404 Not Found>. #pod #pod =method as_string #pod #pod This returns a string representation of the exception. This method #pod B be implemented by any class consuming this role. #pod #pod =method as_psgi #pod #pod This returns a representation of the exception object as PSGI #pod response. #pod #pod In theory, it accepts a PSGI environment as its only argument, but #pod currently the environment is ignored. #pod #pod =method to_app #pod #pod This is the standard Plack convention for Ls. #pod It will return a CODE ref which expects the C<$env> parameter #pod and returns the results of C. #pod #pod =method &{} #pod #pod We overload C<&{}> to call C, again in keeping with the #pod L convention. #pod #pod =head1 WELL-KNOWN TYPES #pod #pod Below is a list of the well-known types recognized by the factory and #pod shipped with this distribution. The obvious 4xx and 5xx errors are #pod included but we also include the 3xx redirection status codes. This is #pod because, while not really an error, the 3xx status codes do represent an #pod exceptional control flow. #pod #pod The implementation for each of these is in a role with a name in the #pod form C. For example, "Gone" #pod is C. When throwing the exception #pod with the factory, just pass "Gone" #pod #pod =head2 Redirection 3xx #pod #pod This class of status code indicates that further action needs to #pod be taken by the user agent in order to fulfill the request. The #pod action required MAY be carried out by the user agent without #pod interaction with the user if and only if the method used in the #pod second request is GET or HEAD. #pod #pod =over 4 #pod #pod =item 300 L #pod #pod =item 301 L #pod #pod =item 302 L #pod #pod =item 303 L #pod #pod =item 304 L #pod #pod =item 305 L #pod #pod =item 307 L #pod #pod =back #pod #pod =head2 Client Error 4xx #pod #pod The 4xx class of status code is intended for cases in which #pod the client seems to have erred. Except when responding to a #pod HEAD request, the server SHOULD include an entity containing an #pod explanation of the error situation, and whether it is a temporary #pod or permanent condition. These status codes are applicable to any #pod request method. User agents SHOULD display any included entity #pod to the user. #pod #pod =over 4 #pod #pod =item 400 L #pod #pod =item 401 L #pod #pod =item 403 L #pod #pod =item 404 L #pod #pod =item 405 L #pod #pod =item 406 L #pod #pod =item 407 L #pod #pod =item 408 L #pod #pod =item 409 L #pod #pod =item 410 L #pod #pod =item 411 L #pod #pod =item 412 L #pod #pod =item 413 L #pod #pod =item 414 L #pod #pod =item 415 L #pod #pod =item 416 L #pod #pod =item 417 L #pod #pod =back #pod #pod =head2 Server Error 5xx #pod #pod Response status codes beginning with the digit "5" indicate #pod cases in which the server is aware that it has erred or is #pod incapable of performing the request. Except when responding to #pod a HEAD request, the server SHOULD include an entity containing #pod an explanation of the error situation, and whether it is a #pod temporary or permanent condition. User agents SHOULD display #pod any included entity to the user. These response codes are applicable #pod to any request method. #pod #pod =over 4 #pod #pod =item 500 L #pod #pod =item 501 L #pod #pod =item 502 L #pod #pod =item 503 L #pod #pod =item 504 L #pod #pod =item 505 L #pod #pod =back #pod #pod =head1 COMPOSING WITH HTTP::THROWABLE #pod #pod In general, we expect that you'll use L or a #pod subclass to throw exceptions. You can still use HTTP::Throwable #pod directly, though, if you keep these things in mind: #pod #pod HTTP::Throwable is mostly concerned about providing basic headers and a #pod PSGI representation. It doesn't worry about the body or a #pod stringification. You B provide the methods C and #pod C and C. #pod #pod The C method returns the string (of octets) to be sent as the HTTP #pod entity. That body is passed to the C method, which must #pod return an arrayref of headers to add to the response. These will #pod generally include the Content-Type and Content-Length headers. #pod #pod The C method should return a printable string, even if the #pod body is going to be empty. #pod #pod For convenience, these three methods are implemented by the roles #pod L and L. #pod #pod =head1 SEE ALSO #pod #pod =for :list #pod * L #pod * L 00-report-prereqs.t100644000767000024 1342613613423746 17433 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/t#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: author000755000767000024 013613423746 15343 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/xtpod-syntax.t100644000767000024 25213613423746 17755 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); 00-report-prereqs.dd100644000767000024 531413613423746 17534 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/tdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'requires' => { 'Encode' => '0', 'Test::More' => '0', 'Test::Pod' => '1.41' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'List::Util' => '1.45', 'Module::Runtime' => '0', 'Moo' => '1.004003', 'Moo::Role' => '0', 'MooX::StrictConstructor' => '0', 'Package::Variant' => '1.002000', 'Plack' => '0.9967', 'Plack::Util' => '0', 'StackTrace::Auto' => '0', 'Sub::Exporter' => '0', 'Sub::Exporter::Util' => '0', 'Throwable' => '0.102080', 'Type::Tiny' => '0', 'Type::Utils' => '0', 'Types::Standard' => '0', 'namespace::clean' => '0', 'overload' => '0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'HTTP::Request::Common' => '0', 'Plack::Builder' => '0', 'Plack::Test' => '0', 'Scalar::Util' => '0', 'Test::Deep' => '0', 'Test::Fatal' => '0.003', 'Test::More' => '0.96', 'base' => '0', 'lib' => '0' } } }; $x; }Throwable000755000767000024 013613423746 16662 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTPFactory.pm100644000767000024 2624113613423746 21014 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwablepackage HTTP::Throwable::Factory; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Factory::VERSION = '0.027'; use strict; use warnings; use HTTP::Throwable::Variant; use Sub::Exporter::Util (); use Sub::Exporter -setup => { exports => [ http_throw => Sub::Exporter::Util::curry_method('throw'), http_exception => Sub::Exporter::Util::curry_method('new_exception'), ], }; use Module::Runtime; sub throw { my $factory = shift; my $ident = (! ref $_[0]) ? shift(@_) : undef; my $arg = shift || {}; $factory->class_for($ident, $arg)->throw($arg); } sub new_exception { my $factory = shift; my $ident = (! ref $_[0]) ? shift(@_) : undef; my $arg = shift || {}; $factory->class_for($ident, $arg)->new($arg); } sub core_roles { return qw( HTTP::Throwable ); } sub extra_roles { return qw( HTTP::Throwable::Role::TextBody ); } sub roles_for_ident { my ($self, $ident) = @_; Carp::confess("roles_for_ident called with undefined ident") unless defined $ident; Carp::confess("roles_for_ident called with empty ident string") unless length $ident; return "HTTP::Throwable::Role::Status::$ident"; } sub roles_for_no_ident { my ($self, $ident) = @_; return qw( HTTP::Throwable::Role::Generic HTTP::Throwable::Role::BoringText ); } sub base_class { () } sub class_for { my ($self, $ident) = @_; my @roles; if (defined $ident) { if ($ident =~ /\A[0-9]{3}\z/) { @roles = $self->roles_for_status_code($ident); } else { @roles = $self->roles_for_ident($ident); } } else { @roles = $self->roles_for_no_ident; } Module::Runtime::use_module($_) for @roles; my $class = HTTP::Throwable::Variant->build_variant( superclasses => [ $self->base_class ], roles => [ $self->core_roles, $self->extra_roles, @roles ], ); return $class; } my %lookup = ( 300 => 'MultipleChoices', 301 => 'MovedPermanently', 302 => 'Found', 303 => 'SeeOther', 304 => 'NotModified', 305 => 'UseProxy', 307 => 'TemporaryRedirect', 400 => 'BadRequest', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'NotFound', 405 => 'MethodNotAllowed', 406 => 'NotAcceptable', 407 => 'ProxyAuthenticationRequired', 408 => 'RequestTimeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'LengthRequired', 412 => 'PreconditionFailed', 413 => 'RequestEntityTooLarge', 414 => 'RequestURITooLong', 415 => 'UnsupportedMediaType', 416 => 'RequestedRangeNotSatisfiable', 417 => 'ExpectationFailed', 418 => 'ImATeapot', 500 => 'InternalServerError', 501 => 'NotImplemented', 502 => 'BadGateway', 503 => 'Status::ServiceUnavailable', 504 => 'GatewayTimeout', 505 => 'HTTPVersionNotSupported', ); sub roles_for_status_code { my ($self, $code) = @_; my $ident = $lookup{$code}; return $self->roles_for_ident($ident); } 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Factory - a factory that throws HTTP::Throwables for you =head1 VERSION version 0.027 =head1 OVERVIEW L is a role that makes it easy to build exceptions that, once thrown, can be turned into L-style HTTP responses. Because HTTP::Throwable and all its related roles are, well, roles, they can't be instantiated or thrown directly. Instead, they must be built into classes first. HTTP::Throwable::Factory takes care of this job, building classes out of the roles you need for the exception you want to throw. You can use the factory to either I or I an exception of either a I or I type. Building and throwing are very similar -- the only difference is whether or not the newly built object is thrown or returned. To throw an exception, use the C method on the factory. To return it, use the C method. In the examples below, we'll just use C. To throw a generic exception -- one where you must specify the status code and reason, and any other headers -- you pass C a hashref of arguments that will be passed to the exception class's constructor. HTTP::Throwable::Factory->throw({ status_code => 301, reason => 'Moved Permanently', additional_headers => [ Location => '/new', ], }); To throw a specific type of exception, include an exception type identifier, like this: HTTP::Throwable::Factory->throw(MovedPermanently => { location => '/new' }); The type identifier is (by default) the end of a role name in the form C. The full list of such included roles is given in L. =head2 Exports You can import routines called C and C that work like the C and C methods, respectively, but are not called as methods. For example: use HTTP::Throwable::Factory 'http_exception'; builder { mount '/old' => http_exception('Gone'), }; =head1 SUBCLASSING One of the big benefits of using HTTP::Throwable::Factory is that you can subclass it to change the kind of exceptions it provides. If you subclass it, you can change its behavior by overriding the following methods -- provided in the order of likelihood that you'd want to override them, most likely first. =head2 extra_roles This method returns a list of role names that will be included in any class built by the factory. By default, it includes only L to satisfy HTTP::Throwable's requirements for methods needed to build a body. This is the method you're most likely to override in a subclass. =head2 roles_for_ident =head2 roles_for_status_code =head2 roles_for_no_ident This methods convert the exception type identifier to a role to apply. For example, if you call: Factory->throw(NotFound => { ... }) ...then C is called with "NotFound" as its argument. C is used if the string is three ASCII digits. If C is called I a type identifier, C is called. By default, C returns C and C returns L and L. =head2 base_class This is the base class that will be subclassed and into which all the roles will be composed. By default, it is L, the universal base Moo class. =head2 core_roles This method returns the roles that are expected to be applied to every HTTP::Throwable exception. This method's results might change over time, and you are encouraged I> to alter it. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: a factory that throws HTTP::Throwables for you #pod =head1 OVERVIEW #pod #pod L is a role that makes it easy to build exceptions that, once #pod thrown, can be turned into L-style HTTP responses. Because #pod HTTP::Throwable and all its related roles are, well, roles, they can't be #pod instantiated or thrown directly. Instead, they must be built into classes #pod first. HTTP::Throwable::Factory takes care of this job, building classes out #pod of the roles you need for the exception you want to throw. #pod #pod You can use the factory to either I or I an exception of either a #pod I or I type. Building and throwing are very similar -- the #pod only difference is whether or not the newly built object is thrown or returned. #pod To throw an exception, use the C method on the factory. To return it, #pod use the C method. In the examples below, we'll just use #pod C. #pod #pod To throw a generic exception -- one where you must specify the status code and #pod reason, and any other headers -- you pass C a hashref of arguments that #pod will be passed to the exception class's constructor. #pod #pod HTTP::Throwable::Factory->throw({ #pod status_code => 301, #pod reason => 'Moved Permanently', #pod additional_headers => [ #pod Location => '/new', #pod ], #pod }); #pod #pod To throw a specific type of exception, include an exception type identifier, #pod like this: #pod #pod HTTP::Throwable::Factory->throw(MovedPermanently => { location => '/new' }); #pod #pod The type identifier is (by default) the end of a role name in the form #pod C. The full list of such included #pod roles is given in L. #pod #pod =head2 Exports #pod #pod You can import routines called C and C that work #pod like the C and C methods, respectively, but are not #pod called as methods. For example: #pod #pod use HTTP::Throwable::Factory 'http_exception'; #pod #pod builder { #pod mount '/old' => http_exception('Gone'), #pod }; #pod #pod =head1 SUBCLASSING #pod #pod One of the big benefits of using HTTP::Throwable::Factory is that you can #pod subclass it to change the kind of exceptions it provides. #pod #pod If you subclass it, you can change its behavior by overriding the following #pod methods -- provided in the order of likelihood that you'd want to override #pod them, most likely first. #pod #pod =head2 extra_roles #pod #pod This method returns a list of role names that will be included in any class #pod built by the factory. By default, it includes only #pod L to satisfy HTTP::Throwable's requirements #pod for methods needed to build a body. #pod #pod This is the method you're most likely to override in a subclass. #pod #pod =head2 roles_for_ident #pod #pod =head2 roles_for_status_code #pod #pod =head2 roles_for_no_ident #pod #pod This methods convert the exception type identifier to a role to apply. For #pod example, if you call: #pod #pod Factory->throw(NotFound => { ... }) #pod #pod ...then C is called with "NotFound" as its argument. #pod C is used if the string is three ASCII digits. #pod #pod If C is called I a type identifier, C is #pod called. #pod #pod By default, C returns C #pod and C returns L and #pod L. #pod #pod =head2 base_class #pod #pod This is the base class that will be subclassed and into which all the roles #pod will be composed. By default, it is L, the universal base Moo #pod class. #pod #pod =head2 core_roles #pod #pod This method returns the roles that are expected to be applied to every #pod HTTP::Throwable exception. This method's results might change over time, and #pod you are encouraged I> to alter it. Variant.pm100644000767000024 325613613423746 20772 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwablepackage HTTP::Throwable::Variant; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Variant::VERSION = '0.027'; use strict; use warnings; use Package::Variant 1.002000 importing => ['Moo', 'MooX::StrictConstructor'], subs => [ qw(extends with) ]; sub make_variant { my ($class, $target_package, %arguments) = @_; extends @{ $arguments{superclasses} } if @{ $arguments{superclasses} }; with @{ $arguments{roles} }; } 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Variant - a package that constructs Moo-based HTTP::Throwables for you =head1 VERSION version 0.027 =head1 OVERVIEW This package is used by L to build exceptions at runtime. The exceptions are L-based, with L applied as well. It takes two arguments: C, an arrayref of classes to extend, and C, an arrayref of roles to compose. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: a package that constructs Moo-based HTTP::Throwables for you #pod =head1 OVERVIEW #pod #pod This package is used by L to build #pod exceptions at runtime. The exceptions are L-based, with #pod L applied as well. It takes two arguments: #pod C, an arrayref of classes to extend, and C, an #pod arrayref of roles to compose. release000755000767000024 013613423746 15461 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/xtchanges_has_content.t100644000767000024 210113613423746 21775 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/xt/releaseuse Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.027'; my $trial_token = '-TRIAL'; my $encoding = 'UTF-8'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); if ($encoding) { require Encode; $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); } close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } Role000755000767000024 013613423746 17563 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/ThrowableNoBody.pm100644000767000024 276613613423746 21466 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Rolepackage HTTP::Throwable::Role::NoBody; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::NoBody::VERSION = '0.027'; use Moo::Role; sub body { return } sub body_headers { my ($self, $body) = @_; return [ 'Content-Length' => 0, ]; } sub as_string { $_[0]->status_line } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::NoBody - an exception with no body =head1 VERSION version 0.027 =head1 OVERVIEW This is a very simple role, implementing the required C, C, and C for L. When an HTTP::Throwable exception uses this role, its PSGI response will have no entity body. It will report a Content-Length of zero. It will stringify to its status line. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: an exception with no body #pod =head1 OVERVIEW #pod #pod This is a very simple role, implementing the required C, C, #pod and C for L. #pod #pod When an HTTP::Throwable exception uses this role, its PSGI response will have #pod no entity body. It will report a Content-Length of zero. It will stringify to #pod its status line. Generic.pm100644000767000024 237113613423746 21640 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Rolepackage HTTP::Throwable::Role::Generic; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Generic::VERSION = '0.027'; use Carp qw(confess); use Moo::Role; with 'HTTP::Throwable'; sub default_status_code { confess "generic HTTP::Throwable must be given status code in constructor"; } sub default_reason { confess "generic HTTP::Throwable must be given reason in constructor"; } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Generic - a generic built-by-hand exception =head1 VERSION version 0.027 =head1 DESCRIPTION This role is used (for boring internals-related reasons) when you throw an exception with no special roles mixed in. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: a generic built-by-hand exception #pod =head1 DESCRIPTION #pod #pod This role is used (for boring internals-related reasons) when you throw an #pod exception with no special roles mixed in. #pod Redirect.pm100644000767000024 357513613423746 22034 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Rolepackage HTTP::Throwable::Role::Redirect; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Redirect::VERSION = '0.027'; use Types::Standard qw(Str); use Moo::Role; has 'location' => ( is => 'ro', isa => Str, required => 1, ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); push @$headers => ('Location' => $self->location); return $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Redirect - an exception that is a redirect =head1 VERSION version 0.027 =head1 OVERVIEW This is an extremely simple method used by most of the 3xx series of exceptions. It adds a C attribute that will be provided as the Location header when the exception is converted to an HTTP message. Note that "MultipleChoices," the 300 status code is I currently a redirect, as its Location header is optional. This may change in the future of the semantics of this role are refined. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: an exception that is a redirect #pod =head1 OVERVIEW #pod #pod This is an extremely simple method used by most of the 3xx series of #pod exceptions. It adds a C attribute that will be provided as the #pod Location header when the exception is converted to an HTTP message. #pod #pod Note that "MultipleChoices," the 300 status code is I currently a #pod redirect, as its Location header is optional. This may change in the future of #pod the semantics of this role are refined. TextBody.pm100644000767000024 416013613423746 22024 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Rolepackage HTTP::Throwable::Role::TextBody; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::TextBody::VERSION = '0.027'; use Moo::Role; sub body { $_[0]->text_body } sub body_headers { my ($self, $body) = @_; return [ 'Content-Type' => 'text/plain', 'Content-Length' => length $body, ]; } sub as_string { $_[0]->body } requires 'text_body'; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::TextBody - an exception with a plaintext body =head1 VERSION version 0.027 =head1 OVERVIEW This is a very simple role, implementing the required C, C, and C for L. In turn, it requires that a C method be provided. When an HTTP::Throwable exception uses this role, its PSGI response will have a C content type and will send the result of calling its C method as the response body. It will also stringify to the text body. The role L can be useful to provide a C method that issues the C as the body. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: an exception with a plaintext body #pod =head1 OVERVIEW #pod #pod This is a very simple role, implementing the required C, C, #pod and C for L. In turn, it requires that a #pod C method be provided. #pod #pod When an HTTP::Throwable exception uses this role, its PSGI response will have a #pod C content type and will send the result of calling its C #pod method as the response body. It will also stringify to the text body. #pod #pod The role L can be useful to provide a #pod C method that issues the C as the body. BoringText.pm100644000767000024 316713613423746 22355 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Rolepackage HTTP::Throwable::Role::BoringText; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::BoringText::VERSION = '0.027'; use Moo::Role; sub text_body { $_[0]->status_line } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::BoringText - provide the simplest text_body method possible =head1 VERSION version 0.027 =head1 OVERVIEW This role is as simple as can be. It provides a single method, C, which returns the result of calling the C method. This method exists so that exception classes can easily be compatible with the L role to provide a plain text body when converted to an HTTP message. Most of the core well-known exception types consume this method. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: provide the simplest text_body method possible #pod =head1 OVERVIEW #pod #pod This role is as simple as can be. It provides a single method, C, #pod which returns the result of calling the C method. #pod #pod This method exists so that exception classes can easily be compatible with the #pod L role to provide a plain text body when #pod converted to an HTTP message. Most of the core well-known exception types #pod consume this method. #pod Status000755000767000024 013613423746 21046 5ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/RoleGone.pm100644000767000024 571113613423746 22440 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::Gone; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::Gone::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 410 } sub default_reason { 'Gone' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::Gone - 410 Gone =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cacheable unless indicated otherwise. The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server's site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time -- that is left to the discretion of the server owner. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 410 Gone #pod =head1 DESCRIPTION #pod #pod The requested resource is no longer available at the server and #pod no forwarding address is known. This condition is expected to #pod be considered permanent. Clients with link editing capabilities #pod SHOULD delete references to the Request-URI after user approval. #pod If the server does not know, or has no facility to determine, #pod whether or not the condition is permanent, the status code 404 #pod (Not Found) SHOULD be used instead. This response is cacheable #pod unless indicated otherwise. #pod #pod The 410 response is primarily intended to assist the task of web #pod maintenance by notifying the recipient that the resource is #pod intentionally unavailable and that the server owners desire that #pod remote links to that resource be removed. Such an event is common #pod for limited-time, promotional services and for resources belonging #pod to individuals no longer working at the server's site. It is not #pod necessary to mark all permanently unavailable resources as "gone" #pod or to keep the mark for any length of time -- that is left to the #pod discretion of the server owner. #pod Found.pm100644000767000024 426513613423746 22626 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::Found; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::Found::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::Redirect', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 302 } sub default_reason { 'Found' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::Found - 302 Found =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field. The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). =head1 ATTRIBUTES =head2 location This is a required string, which will be used in the Location header when creating a PSGI response. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 302 Found #pod =head1 DESCRIPTION #pod #pod The requested resource resides temporarily under a different URI. #pod Since the redirection might be altered on occasion, the client #pod SHOULD continue to use the Request-URI for future requests. This #pod response is only cacheable if indicated by a Cache-Control or #pod Expires header field. #pod #pod The temporary URI SHOULD be given by the Location field in the #pod response. Unless the request method was HEAD, the entity of the #pod response SHOULD contain a short hypertext note with a hyperlink #pod to the new URI(s). #pod #pod =attr location #pod #pod This is a required string, which will be used in the Location header #pod when creating a PSGI response. #pod Conflict.pm100644000767000024 560713613423746 23315 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::Conflict; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::Conflict::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 409 } sub default_reason { 'Conflict' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::Conflict - 409 Conflict =head1 VERSION version 0.027 =head1 DESCRIPTION The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required. Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 409 Conflict #pod =head1 DESCRIPTION #pod #pod The request could not be completed due to a conflict with #pod the current state of the resource. This code is only allowed #pod in situations where it is expected that the user might be able #pod to resolve the conflict and resubmit the request. The response #pod body SHOULD include enough information for the user to recognize #pod the source of the conflict. Ideally, the response entity would #pod include enough information for the user or user agent to fix #pod the problem; however, that might not be possible and is not #pod required. #pod #pod Conflicts are most likely to occur in response to a PUT request. #pod For example, if versioning were being used and the entity being #pod PUT included changes to a resource which conflict with those #pod made by an earlier (third-party) request, the server might use #pod the 409 response to indicate that it can't complete the request. #pod In this case, the response entity would likely contain a list of #pod the differences between the two versions in a format defined by #pod the response Content-Type. #pod NotFound.pm100644000767000024 356713613423746 23313 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::NotFound; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::NotFound::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 404 } sub default_reason { 'Not Found' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::NotFound - 404 Not Found =head1 VERSION version 0.027 =head1 DESCRIPTION The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 404 Not Found #pod =head1 DESCRIPTION #pod #pod The server has not found anything matching the Request-URI. #pod No indication is given of whether the condition is temporary #pod or permanent. The 410 (Gone) status code SHOULD be used if #pod the server knows, through some internally configurable mechanism, #pod that an old resource is permanently unavailable and has no #pod forwarding address. This status code is commonly used when #pod the server does not wish to reveal exactly why the request #pod has been refused, or when no other response is applicable. #pod SeeOther.pm100644000767000024 440513613423746 23265 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::SeeOther; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::SeeOther::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::Redirect', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 303 } sub default_reason { 'See Other' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::SeeOther - 303 See Other =head1 VERSION version 0.027 =head1 DESCRIPTION The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable. The different URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 303 See Other #pod =head1 DESCRIPTION #pod #pod The response to the request can be found under a different URI #pod and SHOULD be retrieved using a GET method on that resource. #pod This method exists primarily to allow the output of a #pod POST-activated script to redirect the user agent to a selected #pod resource. The new URI is not a substitute reference for the #pod originally requested resource. The 303 response MUST NOT be #pod cached, but the response to the second (redirected) request #pod might be cacheable. #pod #pod The different URI SHOULD be given by the Location field in #pod the response. Unless the request method was HEAD, the entity #pod of the response SHOULD contain a short hypertext note with a #pod hyperlink to the new URI(s). UseProxy.pm100644000767000024 272513613423746 23350 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::UseProxy; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::UseProxy::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::Redirect', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 305 } sub default_reason { 'Use Proxy' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::UseProxy - 305 Use Proxy =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource MUST be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is expected to repeat this single request via the proxy. 305 responses MUST only be generated by origin servers. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 305 Use Proxy #pod =head1 DESCRIPTION #pod #pod The requested resource MUST be accessed through the proxy given #pod by the Location field. The Location field gives the URI of the #pod proxy. The recipient is expected to repeat this single request #pod via the proxy. 305 responses MUST only be generated by origin #pod servers. #pod Forbidden.pm100644000767000024 344213613423746 23443 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::Forbidden; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::Forbidden::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 403 } sub default_reason { 'Forbidden' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::Forbidden - 403 Forbidden =head1 VERSION version 0.027 =head1 DESCRIPTION The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 403 Forbidden #pod =head1 DESCRIPTION #pod #pod The server understood the request, but is refusing to fulfill it. #pod Authorization will not help and the request SHOULD NOT be repeated. #pod If the request method was not HEAD and the server wishes to make #pod public why the request has not been fulfilled, it SHOULD describe #pod the reason for the refusal in the entity. If the server does not #pod wish to make this information available to the client, the status #pod code 404 (Not Found) can be used instead. #pod #pod ImATeapot.pm100644000767000024 447413613423746 23400 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::ImATeapot; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::ImATeapot::VERSION = '0.027'; use Types::Standard qw(Bool); use Moo::Role; with( 'HTTP::Throwable', ); has 'short' => (is => 'ro', isa => Bool, default => 0); has 'stout' => (is => 'ro', isa => Bool, default => 0); sub default_status_code { 418 } sub default_reason { q{I'm a teapot} } my $TEAPOT = <<'END'; ( _ ) ) _,(_)._ (( I'M A LITTLE TEAPOT__X__ ___,(_______). ) ,'__. / \ /\_ /,' / |""| \ / / | | | |__| |,' / \`.| / `. : : / `. :.,' `-.________,-' END sub text_body { my $self = shift; my $base = $TEAPOT; my $msg = $self->short && $self->stout ? " SHORT AND STOUT" : $self->short ? " SHORT NOT STOUT" : $self->stout ? " MERELY STOUT" : " WITH A SPOUT"; $base =~ s/__X__/$msg/; return $base; } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::ImATeapot - 418 I'm a teapot =head1 VERSION version 0.027 =head1 DESCRIPTION This exception provides RFC2324 support, in accordance with section 2.3.3: Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout. Boolean attributes C and C are provided, and default to false. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 418 I'm a teapot #pod =head1 DESCRIPTION #pod #pod This exception provides RFC2324 support, in accordance with section 2.3.3: #pod #pod Any attempt to brew coffee with a teapot should result in the error code #pod "418 I'm a teapot". The resulting entity body MAY be short and stout. #pod #pod Boolean attributes C and C are provided, and default to false. #pod BadGateway.pm100644000767000024 233313613423746 23555 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::BadGateway; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::BadGateway::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 502 } sub default_reason { 'Bad Gateway' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::BadGateway - 502 Bad Gateway =head1 VERSION version 0.027 =head1 DESCRIPTION The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 502 Bad Gateway #pod =head1 DESCRIPTION #pod #pod The server, while acting as a gateway or proxy, received #pod an invalid response from the upstream server it accessed #pod in attempting to fulfill the request. #pod #pod BadRequest.pm100644000767000024 226313613423746 23606 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::BadRequest; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::BadRequest::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 400 } sub default_reason { 'Bad Request' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::BadRequest - 400 Bad Request =head1 VERSION version 0.027 =head1 DESCRIPTION The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 400 Bad Request #pod =head1 DESCRIPTION #pod #pod The request could not be understood by the server due to #pod malformed syntax. The client SHOULD NOT repeat the request #pod without modifications. NotModified.pm100644000767000024 1050713613423746 23770 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::NotModified; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::NotModified::VERSION = '0.027'; use Moo::Role; use Plack::Util (); with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 304 } sub default_reason { 'Not Modified' } around 'as_psgi' => sub { my $next = shift; my $self = shift; my $psgi = $self->$next(); # MUST NOT have a message body, see below Plack::Util::header_set( $psgi->[1], 'Content-Length' => 0 ); Plack::Util::header_remove( $psgi->[1], 'Content-Type'); $psgi->[2] = []; $psgi; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::NotModified - 304 Not Modified =head1 VERSION version 0.027 =head1 DESCRIPTION If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields. The response MUST include the following header fields: =over 4 =item Date, unless its omission is required by section 14.18.1 If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without one (as already specified by [RFC 2068], section 14.19), caches will operate correctly. =item ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request =item Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant =back If the conditional GET used a strong cache validator, the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. If a 304 response indicates an entity not currently cached, then the cache MUST disregard the response and repeat the request without the conditional. If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 304 Not Modified #pod =head1 DESCRIPTION #pod #pod If the client has performed a conditional GET request and access #pod is allowed, but the document has not been modified, the server #pod SHOULD respond with this status code. The 304 response MUST NOT #pod contain a message-body, and thus is always terminated by the #pod first empty line after the header fields. #pod #pod The response MUST include the following header fields: #pod #pod =begin :list #pod #pod = Date, unless its omission is required by section 14.18.1 #pod #pod If a clockless origin server obeys these rules, and proxies and #pod clients add their own Date to any response received without one #pod (as already specified by [RFC 2068], section 14.19), caches will #pod operate correctly. #pod #pod = ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request #pod #pod = Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant #pod #pod =end :list #pod #pod If the conditional GET used a strong cache validator, the response #pod SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional #pod GET used a weak validator), the response MUST NOT include other #pod entity-headers; this prevents inconsistencies between cached #pod entity-bodies and updated headers. #pod #pod If a 304 response indicates an entity not currently cached, then #pod the cache MUST disregard the response and repeat the request without #pod the conditional. #pod #pod If a cache uses a received 304 response to update a cache entry, #pod the cache MUST update the entry to reflect any new field values #pod given in the response. #pod Unauthorized.pm100644000767000024 710413613423746 24227 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::Unauthorized; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::Unauthorized::VERSION = '0.027'; use Types::Standard qw(Str ArrayRef); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 401 } sub default_reason { 'Unauthorized' } has 'www_authenticate' => ( is => 'ro', isa => Str | ArrayRef[Str], required => 1, ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); my $www_auth = $self->www_authenticate; if ( ref $www_auth ) { push @$headers => (map { ('WWW-Authenticate' => $_) } @$www_auth); } else { push @$headers => ('WWW-Authenticate' => $www_auth ); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::Unauthorized - 401 Unauthorized =head1 VERSION version 0.027 =head1 DESCRIPTION The request requires user authentication. The response MUST include a WWW-Authenticate header field containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field. If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity might include relevant diagnostic information. =head1 ATTRIBUTES =head2 www_authenticate This is a required string or array of string that will be used to populate the 'WWW-Authenticate' header(s) when creating a PSGI response. =head1 SEE ALSO HTTP Authentication: Basic and Digest Access Authentication - L WWW-Authenticate Header - L =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 401 Unauthorized #pod =head1 DESCRIPTION #pod #pod The request requires user authentication. The response MUST include a #pod WWW-Authenticate header field containing a challenge applicable to the #pod requested resource. The client MAY repeat the request with a suitable #pod Authorization header field. If the request already included Authorization #pod credentials, then the 401 response indicates that authorization has been #pod refused for those credentials. If the 401 response contains the same #pod challenge as the prior response, and the user agent has already attempted #pod authentication at least once, then the user SHOULD be presented the entity #pod that was given in the response, since that entity might include relevant #pod diagnostic information. #pod #pod =attr www_authenticate #pod #pod This is a required string or array of string that will be used to populate #pod the 'WWW-Authenticate' header(s) when creating a PSGI response. #pod #pod =head1 SEE ALSO #pod #pod HTTP Authentication: Basic and Digest Access Authentication - L #pod #pod WWW-Authenticate Header - L NotAcceptable.pm100644000767000024 653113613423746 24255 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::NotAcceptable; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::NotAcceptable::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 406 } sub default_reason { 'Not Acceptable' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::NotAcceptable - 406 Not Acceptable =head1 VERSION version 0.027 =head1 DESCRIPTION The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. Unless it was a HEAD request, the response SHOULD include an entity containing a list of available entity characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection. Note: HTTP/1.1 servers are allowed to return responses which are not acceptable according to the accept headers sent in the request. In some cases, this may even be preferable to sending a 406 response. User agents are encouraged to inspect the headers of an incoming response to determine if it is acceptable. If the response could be unacceptable, a user agent SHOULD temporarily stop receipt of more data and query the user for a decision on further actions. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 406 Not Acceptable #pod =head1 DESCRIPTION #pod #pod The resource identified by the request is only capable of generating #pod response entities which have content characteristics not acceptable #pod according to the accept headers sent in the request. #pod #pod Unless it was a HEAD request, the response SHOULD include an entity #pod containing a list of available entity characteristics and location(s) #pod from which the user or user agent can choose the one most appropriate. #pod The entity format is specified by the media type given in the #pod Content-Type header field. Depending upon the format and the capabilities #pod of the user agent, selection of the most appropriate choice MAY be #pod performed automatically. However, this specification does not define #pod any standard for such automatic selection. #pod #pod Note: HTTP/1.1 servers are allowed to return responses which are #pod not acceptable according to the accept headers sent in the #pod request. In some cases, this may even be preferable to sending a #pod 406 response. User agents are encouraged to inspect the headers of #pod an incoming response to determine if it is acceptable. #pod #pod If the response could be unacceptable, a user agent SHOULD temporarily #pod stop receipt of more data and query the user for a decision on further #pod actions. GatewayTimeout.pm100644000767000024 270013613423746 24513 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::GatewayTimeout; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::GatewayTimeout::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 504 } sub default_reason { 'Gateway Timeout' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::GatewayTimeout - 504 Gateway Timeout =head1 VERSION version 0.027 =head1 DESCRIPTION The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 504 Gateway Timeout #pod =head1 DESCRIPTION #pod #pod The server, while acting as a gateway or proxy, did not #pod receive a timely response from the upstream server specified #pod by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary #pod server (e.g. DNS) it needed to access in attempting to #pod complete the request. #pod LengthRequired.pm100644000767000024 257213613423746 24474 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::LengthRequired; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::LengthRequired::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 411 } sub default_reason { 'Length Required' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::LengthRequired - 411 Length Required =head1 VERSION version 0.027 =head1 DESCRIPTION The server refuses to accept the request without a defined Content-Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 411 Length Required #pod =head1 DESCRIPTION #pod #pod The server refuses to accept the request without a defined #pod Content-Length. The client MAY repeat the request if it #pod adds a valid Content-Length header field containing the #pod length of the message-body in the request message. NotImplemented.pm100644000767000024 260013613423746 24466 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::NotImplemented; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::NotImplemented::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 501 } sub default_reason { 'Not Implemented' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::NotImplemented - 501 Not Implemented =head1 VERSION version 0.027 =head1 DESCRIPTION The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 501 Not Implemented #pod =head1 DESCRIPTION #pod #pod The server does not support the functionality required to #pod fulfill the request. This is the appropriate response when #pod the server does not recognize the request method and is #pod not capable of supporting it for any resource. #pod #pod RequestTimeout.pm100644000767000024 241713613423746 24547 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::RequestTimeout; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::RequestTimeout::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 408 } sub default_reason { 'Request Timeout' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::RequestTimeout - 408 Request Timeout =head1 VERSION version 0.027 =head1 DESCRIPTION The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 408 Request Timeout #pod =head1 DESCRIPTION #pod #pod The client did not produce a request within the #pod time that the server was prepared to wait. The #pod client MAY repeat the request without modifications #pod at any later time. #pod MultipleChoices.pm100644000767000024 1001413613423746 24651 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::MultipleChoices; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::MultipleChoices::VERSION = '0.027'; use Types::Standard qw(Str); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 300 } sub default_reason { 'Multiple Choices' } has 'location' => ( is => 'ro', isa => Str ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); if ( my $location = $self->location ) { push @$headers => ('Location' => $location); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::MultipleChoices - 300 Multiple Choices =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent-driven negotiation information is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location. Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection. If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise. =head1 ATTRIBUTES =head2 location This is an optional string, which, if supplied, will be used in the Location header when creating a PSGI response. Note that this is I (at present) the location attribute provided by the role L, which this role does not include. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 300 Multiple Choices #pod =head1 DESCRIPTION #pod #pod The requested resource corresponds to any one of a set of representations, #pod each with its own specific location, and agent-driven negotiation information #pod is being provided so that the user (or user agent) can select a preferred #pod representation and redirect its request to that location. #pod #pod Unless it was a HEAD request, the response SHOULD include an entity containing #pod a list of resource characteristics and location(s) from which the user or user #pod agent can choose the one most appropriate. The entity format is specified by #pod the media type given in the Content-Type header field. Depending upon the #pod format and the capabilities of the user agent, selection of the most appropriate #pod choice MAY be performed automatically. However, this specification does not #pod define any standard for such automatic selection. #pod #pod If the server has a preferred choice of representation, it SHOULD include #pod the specific URI for that representation in the Location field; user agents #pod MAY use the Location field value for automatic redirection. This response is #pod cacheable unless indicated otherwise. #pod #pod =attr location #pod #pod This is an optional string, which, if supplied, will be used in the Location #pod header when creating a PSGI response. #pod #pod Note that this is I (at present) the location attribute provided by the #pod role L, which this role does not include. TooManyRequests.pm100644000767000024 300713613423746 24666 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::TooManyRequests; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::TooManyRequests::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 429 } sub default_reason { 'Too Many Requests' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::TooManyRequests - 429 Too Many Requests =head1 VERSION version 0.027 =head1 DESCRIPTION The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting"). The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how to wait before making a new request. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 429 Too Many Requests #pod =head1 DESCRIPTION #pod #pod The 429 status code indicates that the user has sent too many #pod requests in a given amount of time ("rate limiting"). The response #pod representations SHOULD include details explaining the condition, #pod and MAY include a Retry-After header indicating how to wait before #pod making a new request. #pod MethodNotAllowed.pm100644000767000024 526613613423746 24766 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::MethodNotAllowed; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::MethodNotAllowed::VERSION = '0.027'; use Type::Utils qw(subtype as where enum); use Types::Standard qw(ArrayRef); use List::Util 1.45 qw[ uniq ]; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); my $method_enum_type = enum "HttpThrowableTypeMethod" => [ qw[ OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT ] ]; # TODO: Consider adding a coersion to upper-case lower-cased strings and to # uniq the given input. -- rjbs, 2011-02-21 my $method_list_type = subtype "HttpThrowableTypeMethodList", as ArrayRef[ $method_enum_type ], where { (scalar uniq @{$_}) == (scalar @{$_}) }; sub default_status_code { 405 } sub default_reason { 'Method Not Allowed' } has 'allow' => ( is => 'ro', isa => $method_list_type, required => 1 ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); push @$headers => ('Allow' => join "," => @{ $self->allow }); $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::MethodNotAllowed - 405 Method Not Allowed =head1 VERSION version 0.027 =head1 DESCRIPTION The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource. =head1 ATTRIBUTES =head2 allow This is an ArrayRef of HTTP methods, it is required and the HTTP methods will be type checked to ensure validity and uniqueness. =head1 SEE ALSO HTTP Methods - L =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 405 Method Not Allowed #pod =head1 DESCRIPTION #pod #pod The method specified in the Request-Line is not allowed for the #pod resource identified by the Request-URI. The response MUST include #pod an Allow header containing a list of valid methods for the requested #pod resource. #pod #pod =attr allow #pod #pod This is an ArrayRef of HTTP methods, it is required and the HTTP #pod methods will be type checked to ensure validity and uniqueness. #pod #pod =head1 SEE ALSO #pod #pod HTTP Methods - L #pod #pod MovedPermanently.pm100644000767000024 426013613423746 25037 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::MovedPermanently; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::MovedPermanently::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::Redirect', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 301 } sub default_reason { 'Moved Permanently' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::MovedPermanently - 301 Moved Permanently =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise. The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 301 Moved Permanently #pod =head1 DESCRIPTION #pod #pod The requested resource has been assigned a new permanent URI and #pod any future references to this resource SHOULD use one of the #pod returned URIs. Clients with link editing capabilities ought to #pod automatically re-link references to the Request-URI to one or more #pod of the new references returned by the server, where possible. This #pod response is cacheable unless indicated otherwise. #pod #pod The new permanent URI SHOULD be given by the Location field in the #pod response. Unless the request method was HEAD, the entity of the #pod response SHOULD contain a short hypertext note with a hyperlink to #pod the new URI(s). #pod ExpectationFailed.pm100644000767000024 257713613423746 25147 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::ExpectationFailed; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::ExpectationFailed::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 417 } sub default_reason { 'Expectation Failed' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::ExpectationFailed - 417 Expectation Failed =head1 VERSION version 0.027 =head1 DESCRIPTION The expectation given in an Expect request-header field could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 417 Expectation Failed #pod =head1 DESCRIPTION #pod #pod The expectation given in an Expect request-header field #pod could not be met by this server, or, if the server is a #pod proxy, the server has unambiguous evidence that the #pod request could not be met by the next-hop server. #pod PermanentRedirect.pm100644000767000024 435713613423746 25170 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::PermanentRedirect; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::PermanentRedirect::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', 'HTTP::Throwable::Role::Redirect', ); sub default_status_code { 308 } sub default_reason { 'Permanent Redirect' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::PermanentRedirect - 308 Permanent Redirect =head1 VERSION version 0.027 =head1 DESCRIPTION This status code is defined in L. The 308 (Permanent Redirect) status code indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. The server SHOULD generate a Location header field ([RFC7231], Section 7.1.2) in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s). =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 308 Permanent Redirect #pod =head1 DESCRIPTION #pod #pod This status code is defined in L. #pod #pod The 308 (Permanent Redirect) status code indicates that the target resource has #pod been assigned a new permanent URI and any future references to this resource #pod ought to use one of the enclosed URIs. #pod #pod The server SHOULD generate a Location header field ([RFC7231], Section 7.1.2) #pod in the response containing a preferred URI reference for the new permanent URI. #pod The user agent MAY use the Location field value for automatic redirection. The #pod server's response payload usually contains a short hypertext note with a #pod hyperlink to the new URI(s). #pod RequestURITooLong.pm100644000767000024 420313613423746 25055 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::RequestURITooLong; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::RequestURITooLong::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 414 } sub default_reason { 'Request-URI Too Long' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::RequestURITooLong - 414 Request-URI Too Long =head1 VERSION version 0.027 =head1 DESCRIPTION The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 414 Request-URI Too Long #pod =head1 DESCRIPTION #pod #pod The server is refusing to service the request because the #pod Request-URI is longer than the server is willing to interpret. #pod This rare condition is only likely to occur when a client has #pod improperly converted a POST request to a GET request with long #pod query information, when the client has descended into a URI #pod "black hole" of redirection (e.g., a redirected URI prefix that #pod points to a suffix of itself), or when the server is under attack #pod by a client attempting to exploit security holes present in some #pod servers using fixed-length buffers for reading or manipulating #pod the Request-URI. #pod TemporaryRedirect.pm100644000767000024 456013613423746 25215 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::TemporaryRedirect; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::TemporaryRedirect::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', 'HTTP::Throwable::Role::Redirect', ); sub default_status_code { 307 } sub default_reason { 'Temporary Redirect' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::TemporaryRedirect - 307 Temporary Redirect =head1 VERSION version 0.027 =head1 DESCRIPTION The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field. The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s), since many pre-HTTP/1.1 user agents do not understand the 307 status. Therefore, the note SHOULD contain the information necessary for a user to repeat the original request on the new URI. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 307 Temporary Redirect #pod =head1 DESCRIPTION #pod #pod The requested resource resides temporarily under a different URI. #pod Since the redirection MAY be altered on occasion, the client #pod SHOULD continue to use the Request-URI for future requests. #pod This response is only cacheable if indicated by a Cache-Control #pod or Expires header field. #pod #pod The temporary URI SHOULD be given by the Location field in the #pod response. Unless the request method was HEAD, the entity of the #pod response SHOULD contain a short hypertext note with a hyperlink #pod to the new URI(s), since many pre-HTTP/1.1 user agents do not #pod understand the 307 status. Therefore, the note SHOULD contain #pod the information necessary for a user to repeat the original #pod request on the new URI. #pod PreconditionFailed.pm100644000767000024 321513613423746 25307 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::PreconditionFailed; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::PreconditionFailed::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 412 } sub default_reason { 'Precondition Failed' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::PreconditionFailed - 412 Precondition Failed =head1 VERSION version 0.027 =head1 DESCRIPTION The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 412 Precondition Failed #pod =head1 DESCRIPTION #pod #pod The precondition given in one or more of the request-header #pod fields evaluated to false when it was tested on the server. #pod This response code allows the client to place preconditions #pod on the current resource metainformation (header field data) #pod and thus prevent the requested method from being applied to #pod a resource other than the one intended. #pod ServiceUnavailable.pm100644000767000024 463513613423746 25320 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::ServiceUnavailable; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::ServiceUnavailable::VERSION = '0.027'; use Types::Standard qw(Str); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 503 } sub default_reason { 'Service Unavailable' } has 'retry_after' => ( is => 'ro', isa => Str ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); if ( my $retry = $self->retry_after ) { push @$headers => ('Retry-After' => $retry); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::ServiceUnavailable - 503 Service Unavailable =head1 VERSION version 0.027 =head1 DESCRIPTION The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response. Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 503 Service Unavailable #pod =head1 DESCRIPTION #pod #pod The server is currently unable to handle the request due to #pod a temporary overloading or maintenance of the server. The #pod implication is that this is a temporary condition which will #pod be alleviated after some delay. If known, the length of the #pod delay MAY be indicated in a Retry-After header. If no #pod Retry-After is given, the client SHOULD handle the response as #pod it would for a 500 response. #pod #pod Note: The existence of the 503 status code does not imply that a #pod server must use it when becoming overloaded. Some servers may wish #pod to simply refuse the connection. #pod #pod InternalServerError.pm100644000767000024 345213613423746 25525 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::InternalServerError; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::InternalServerError::VERSION = '0.027'; use Types::Standard qw(Bool); use Moo::Role; with( 'HTTP::Throwable', 'StackTrace::Auto', ); sub default_status_code { 500 } sub default_reason { 'Internal Server Error' } has 'show_stack_trace' => ( is => 'ro', isa => Bool, default => 1 ); sub text_body { my ($self) = @_; my $out = $self->status_line; $out .= "\n\n" . $self->stack_trace->as_string if $self->show_stack_trace; return $out; } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::InternalServerError - 500 Internal Server Error =head1 VERSION version 0.027 =head1 DESCRIPTION The server encountered an unexpected condition which prevented it from fulfilling the request. =head1 ATTRIBUTES =head2 show_stack_trace This is a boolean attribute which by default is true and indicates to the C method whether or not to show the stack trace in the output. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 500 Internal Server Error #pod =head1 DESCRIPTION #pod #pod The server encountered an unexpected condition which prevented it #pod from fulfilling the request. #pod #pod =attr show_stack_trace #pod #pod This is a boolean attribute which by default is true and indicates #pod to the C method whether or not to show the stack trace #pod in the output. #pod UnsupportedMediaType.pm100644000767000024 244713613423746 25705 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::UnsupportedMediaType; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::UnsupportedMediaType::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 415 } sub default_reason { 'Unsupported Media Type' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::UnsupportedMediaType - 415 Unsupported Media Type =head1 VERSION version 0.027 =head1 DESCRIPTION The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 415 Unsupported Media Type #pod =head1 DESCRIPTION #pod #pod The server is refusing to service the request because the entity #pod of the request is in a format not supported by the requested resource #pod for the requested method. #pod RequestEntityTooLarge.pm100644000767000024 447313613423746 26036 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::RequestEntityTooLarge; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::RequestEntityTooLarge::VERSION = '0.027'; use Types::Standard qw(Str); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 413 } sub default_reason { 'Request Entity Too Large' } has 'retry_after' => ( is => 'ro', isa => Str ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); if ( my $retry = $self->retry_after ) { push @$headers => ('Retry-After' => $retry); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::RequestEntityTooLarge - 413 Request Entity Too Large =head1 VERSION version 0.027 =head1 DESCRIPTION The server is refusing to process a request because the request entity is larger than the server is willing or able to process. The server MAY close the connection to prevent the client from continuing the request. If the condition is temporary, the server SHOULD include a Retry-After header field to indicate that it is temporary and after what time the client MAY try again. =head1 ATTRIBUTES =head2 retry_after This is an optional string to be used to add a Retry-After header in the PSGI response. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 413 Request Entity Too Large #pod =head1 DESCRIPTION #pod #pod The server is refusing to process a request because the request #pod entity is larger than the server is willing or able to process. #pod The server MAY close the connection to prevent the client from #pod continuing the request. #pod #pod If the condition is temporary, the server SHOULD include a #pod Retry-After header field to indicate that it is temporary and #pod after what time the client MAY try again. #pod #pod =attr retry_after #pod #pod This is an optional string to be used to add a Retry-After header #pod in the PSGI response. HTTPVersionNotSupported.pm100644000767000024 351213613423746 26261 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::HTTPVersionNotSupported; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::HTTPVersionNotSupported::VERSION = '0.027'; use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 505 } sub default_reason { 'HTTP Version Not Supported' } no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::HTTPVersionNotSupported - 505 HTTP Version Not Supported =head1 VERSION version 0.027 =head1 DESCRIPTION The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, other than with this error message. The response SHOULD contain an entity describing why that version is not supported and what other protocols are supported by that server. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 505 HTTP Version Not Supported #pod =head1 DESCRIPTION #pod #pod The server does not support, or refuses to support, the #pod HTTP protocol version that was used in the request message. #pod The server is indicating that it is unable or unwilling to #pod complete the request using the same major version as the #pod client, other than with this error message. The response #pod SHOULD contain an entity describing why that version is not #pod supported and what other protocols are supported by that #pod server. ProxyAuthenticationRequired.pm100644000767000024 600213613423746 27264 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::ProxyAuthenticationRequired; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::ProxyAuthenticationRequired::VERSION = '0.027'; use Types::Standard qw(Str ArrayRef); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 407 } sub default_reason { 'Proxy Authentication Required' } has 'proxy_authenticate' => ( is => 'ro', isa => Str | ArrayRef[ Str ], required => 1, ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); my $proxy_auth = $self->proxy_authenticate; if ( ref $proxy_auth ) { push @$headers => (map { ('Proxy-Authenticate' => $_) } @$proxy_auth); } else { push @$headers => ('Proxy-Authenticate' => $proxy_auth ); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::ProxyAuthenticationRequired - 407 Proxy Authentication Required =head1 VERSION version 0.027 =head1 DESCRIPTION This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy. The proxy MUST return a Proxy-Authenticate header field containing a challenge applicable to the proxy for the requested resource. The client MAY repeat the request with a suitable Proxy-Authorization header field. =head1 ATTRIBUTES =head2 proxy_authenticate This is a required string or array of strings that will be used to populate the 'Proxy-Authenticate' header(s) when creating a PSGI response. =head1 SEE ALSO HTTP Authentication: Basic and Digest Access Authentication - L Proxy-Authenticate Header - L =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 407 Proxy Authentication Required #pod =head1 DESCRIPTION #pod #pod This code is similar to 401 (Unauthorized), but indicates that the #pod client must first authenticate itself with the proxy. The proxy MUST #pod return a Proxy-Authenticate header field containing a challenge applicable #pod to the proxy for the requested resource. The client MAY repeat the request #pod with a suitable Proxy-Authorization header field. #pod #pod =attr proxy_authenticate #pod #pod This is a required string or array of strings that will be used to populate #pod the 'Proxy-Authenticate' header(s) when creating a PSGI response. #pod #pod =head1 SEE ALSO #pod #pod HTTP Authentication: Basic and Digest Access Authentication - L #pod #pod Proxy-Authenticate Header - L RequestedRangeNotSatisfiable.pm100644000767000024 535513613423746 27322 0ustar00rjbsstaff000000000000HTTP-Throwable-0.027/lib/HTTP/Throwable/Role/Statuspackage HTTP::Throwable::Role::Status::RequestedRangeNotSatisfiable; our $AUTHORITY = 'cpan:STEVAN'; $HTTP::Throwable::Role::Status::RequestedRangeNotSatisfiable::VERSION = '0.027'; use Types::Standard qw(Str); use Moo::Role; with( 'HTTP::Throwable', 'HTTP::Throwable::Role::BoringText', ); sub default_status_code { 416 } sub default_reason { 'Requested Range Not Satisfiable' } has 'content_range' => ( is => 'ro', isa => Str ); around 'build_headers' => sub { my $next = shift; my $self = shift; my $headers = $self->$next( @_ ); if ( my $content_range = $self->content_range ) { push @$headers => ('Content-Range' => $content_range); } $headers; }; no Moo::Role; 1; =pod =encoding UTF-8 =head1 NAME HTTP::Throwable::Role::Status::RequestedRangeNotSatisfiable - 416 Requested Range Not Satisfiable =head1 VERSION version 0.027 =head1 DESCRIPTION A server SHOULD return a response with this status code if a request included a Range request-header field, and none of the range-specifier values in this field overlap the current extent of the selected resource, and the request did not include an If-Range request-header field. (For byte-ranges, this means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected resource.) When this status code is returned for a byte-range request, the response SHOULD include a Content-Range entity-header field specifying the current length of the selected resource. This response MUST NOT use the multipart/byteranges content-type. =head1 AUTHORS =over 4 =item * Stevan Little =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: 416 Requested Range Not Satisfiable #pod =head1 DESCRIPTION #pod #pod A server SHOULD return a response with this status code if a #pod request included a Range request-header field, and none of the #pod range-specifier values in this field overlap the current extent #pod of the selected resource, and the request did not include an #pod If-Range request-header field. (For byte-ranges, this means that #pod the first-byte-pos of all of the byte-range-spec values were greater #pod than the current length of the selected resource.) #pod #pod When this status code is returned for a byte-range request, the #pod response SHOULD include a Content-Range entity-header field specifying #pod the current length of the selected resource. This response MUST NOT #pod use the multipart/byteranges content-type. #pod