Catalyst-Engine-Apache-1.16000711001750001750 011452456126 14640 5ustar00raflrafl000000000000README000644001750001750 45311452456126 15572 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16 This archive contains the distribution Catalyst-Engine-Apache, version 1.16: Catalyst Apache Engines This software is copyright (c) 2010 by The "AUTHORS". This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Changes000600001750001750 731411452456126 16220 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16This file documents the revision history for Catalyst::Engine::Apache. 1.16 2010-10-05 00:29:16 - No code changes. - Don't ship .rej files in the dist. - Convert to Dist::Zilla. 1.15 2010-10-03 22:07:00 - Fix license info for debian et all. 1.14 - No changes since dev release. 1.13_01 - Update tests to pass again. - Update tests to not throw warnings with newer versions of Catalyst. - Fix $c->req->remote_user with this engine. - Clarify use with non-standard ports. - Fixes RT#61707, RT#61706, RT#61704, RT#36829 1.13 - Workaround change in LWP that broke a cookie test (RT #40037) - Update streaming test to latest 5.70 1.12 2008-02-20 09:00:00 - Fixed bug where %2b in query parameter is doubly decoded to ' ', instead of '+' (Gavin Henry, Tatsuhiko Miyagawa) - Fixed bug where req->base and req->uri would include a port number when running in SSL mode. - Fixed warning when a non-trivial regex is used in a LocationMatch block. (Steffen Schwigon) - Clear the value of $c->engine->return() before each request. - Added support for 'PerlSetVar CatalystDisableLocationMatch 1' to disable check for a LocationMatch regex to set base path. 1.11 2007-05-18 08:30:00 - Don't 'use mod_perl;' as this may not work on some mod_perl installations. 1.10 2007-05-15 17:40:00 - Properly detect the base when running within a LocationMatch block. - Use the unparsed URI for building the path instead of Apache's pre-parsed URI. - Load APR::Table when using mod_perl 1.99. - Switch to Module::Install. 1.09 2007-03-28 23:00:00 - Fixed compatibility with older Catalyst versions. 5.7008+ is recommended for best performance. 1.08 2007-03-28 22:45:00 - Improved prepare_query_parameters performance by using C-based Apache modules instead of URI and URI::Escape. - Improved prepare_path performance by removing the use of URI.pm. - Extract host and port from X-Forwarded-Host. - Use Apache2::ModSSL for determining SSL mode if available. 1.07 2006-02-17 17:00:00 - Fixed bug: Can't locate object method "FIRSTKEY" via package "APR::Table" when running under mod_perl 2.0.2. 1.06 2006-01-17 16:30:00 - Removed t/01use.t as it will fail if Catalyst is not installed. 1.05 2005-12-23 10:00:00 - Fixed double-cookie bug on redirects. - Synced tests with Catalyst. 1.04 2005-12-22 13:15:00 - Fixed bug when processing a bare HTTP/1.0 HEAD request with no headers. 1.03 2005-12-13 22:30:00 - Removed dependency on Catalyst because it causes an endless loop when trying to install Cat with AutoInstall. 1.02 2005-12-06 08:35:00 - Default to text/html, like the standalone server. 1.01 2005-12-05 14:25:00 - Added $c->engine->return method to allow custom Apache status codes to be returned from the mod_perl handler. - Fixed mod_perl 1.99 engine to use correct Apache::OK status code. 1.00 2005-11-13 19:30:00 - No changes, version bumped to coincide with Catalyst 5.50. 0.99002 2005-11-08 09:00:00 - Really fixed the return values and status codes this time! 0.99001 2005-10-25 21:25:00 - Fixed return value from handler to use the correct Apache::Const or Apache2::Const value rather than a numeric value. - Fixed query param handling. - Added automated tests using Apache::Test. 0.99 2005-10-10 10:15:00 - Initial release, separated Apache engines from Catalyst core. LICENSE000644001750001750 4351711452456126 15767 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16This software is copyright (c) 2010 by The "AUTHORS". 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) 2010 by The "AUTHORS". 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. 59 Temple Place, Suite 330, Boston, MA 02111-1307, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 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) 2010 by The "AUTHORS". 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.ini000600001750001750 73311452456126 16347 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16name = Catalyst-Engine-Apache version = 1.16 author = Sebastian Riedel author = Christian Hansen author = Andy Grundman author = Tomas Doran license = Perl_5 copyright_holder = The "AUTHORS" [@Filter] -bundle = @FLORA -remove = PodCoverageTests -remove = EOLTests dist = Catalyst-Engine-Apache repository_at = catsvn authority = cpan:BOBTFISH auto_prereqs = 0 [Prereqs] Catalyst::Runtime = 5.80 META.yml000644001750001750 765411452456126 16215 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16--- abstract: 'Catalyst Apache Engines' author: - 'Sebastian Riedel ' - 'Christian Hansen ' - 'Andy Grundman ' - 'Tomas Doran ' build_requires: {} configure_requires: ExtUtils::MakeMaker: 6.31 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.102341, CPAN::Meta::Converter version 2.102400' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Catalyst-Engine-Apache requires: Catalyst::Runtime: 5.80 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Engine-Apache homepage: http://search.cpan.org/dist/Catalyst-Engine-Apache repository: http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Engine-Apache/ version: 1.16 x_Dist_Zilla: plugins: - class: Dist::Zilla::Plugin::GatherDir name: '@Filter/@Basic/GatherDir' version: 4.102341 - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/@Basic/PruneCruft' version: 4.102341 - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/@Basic/ManifestSkip' version: 4.102341 - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/@Basic/MetaYAML' version: 4.102341 - class: Dist::Zilla::Plugin::License name: '@Filter/@Basic/License' version: 4.102341 - class: Dist::Zilla::Plugin::Readme name: '@Filter/@Basic/Readme' version: 4.102341 - class: Dist::Zilla::Plugin::ExtraTests name: '@Filter/@Basic/ExtraTests' version: 4.102341 - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/@Basic/ExecDir' version: 4.102341 - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/@Basic/ShareDir' version: 4.102341 - class: Dist::Zilla::Plugin::MakeMaker name: '@Filter/@Basic/MakeMaker' version: 4.102341 - class: Dist::Zilla::Plugin::Manifest name: '@Filter/@Basic/Manifest' version: 4.102341 - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/@Basic/TestRelease' version: 4.102341 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/@Basic/ConfirmRelease' version: 4.102341 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/@Basic/UploadToCPAN' version: 4.102341 - class: Dist::Zilla::Plugin::MetaConfig name: '@Filter/MetaConfig' version: 4.102341 - class: Dist::Zilla::Plugin::MetaJSON name: '@Filter/MetaJSON' version: 4.102341 - class: Dist::Zilla::Plugin::PkgVersion name: '@Filter/PkgVersion' version: 4.102341 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Filter/PodSyntaxTests' version: 4.102341 - class: Dist::Zilla::Plugin::NoTabsTests name: '@Filter/NoTabsTests' version: 0.01 - class: Dist::Zilla::Plugin::MetaResources name: '@Filter/MetaResources' version: 4.102341 - class: Dist::Zilla::Plugin::Authority name: '@Filter/Authority' version: 1.000 - class: Dist::Zilla::Plugin::PodWeaver name: '@Filter/PodWeaver' version: 3.101640 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: 4.102341 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 4.102341 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 4.102341 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 4.102341 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 4.102341 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 4.102341 x_authority: cpan:BOBTFISH MANIFEST000644001750001750 2025111452456126 16101 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Catalyst/Engine/Apache.pm lib/Catalyst/Engine/Apache/MP13.pm lib/Catalyst/Engine/Apache2.pm lib/Catalyst/Engine/Apache2/MP19.pm lib/Catalyst/Engine/Apache2/MP20.pm t/00compiles.t t/author-live_component_controller_action_action.t t/author-live_component_controller_action_auto.t t/author-live_component_controller_action_begin.t t/author-live_component_controller_action_chained.t t/author-live_component_controller_action_default.t t/author-live_component_controller_action_detach.t t/author-live_component_controller_action_end.t t/author-live_component_controller_action_forward.t t/author-live_component_controller_action_global.t t/author-live_component_controller_action_index.t t/author-live_component_controller_action_inheritance.t t/author-live_component_controller_action_local.t t/author-live_component_controller_action_multipath.t t/author-live_component_controller_action_path.t t/author-live_component_controller_action_private.t t/author-live_component_controller_action_regexp.t t/author-live_component_controller_action_streaming.t t/author-live_component_controller_args.t t/author-live_engine_request_body.t t/author-live_engine_request_body_demand.t t/author-live_engine_request_cookies.t t/author-live_engine_request_headers.t t/author-live_engine_request_parameters.t t/author-live_engine_request_uploads.t t/author-live_engine_request_uri.t t/author-live_engine_response_cookies.t t/author-live_engine_response_errors.t t/author-live_engine_response_headers.t t/author-live_engine_response_large.t t/author-live_engine_response_redirect.t t/author-live_engine_response_status.t t/author-live_engine_setup_basics.t t/author-live_engine_setup_plugins.t t/author-live_fork.t t/author-live_loop.t t/author-live_plugin_loaded.t t/author-live_priorities.t t/author-live_recursion.t t/author-notabs.t t/author-pod.t t/author-podcoverage.t t/catalyst_130pix.gif t/conf/extra.conf.in t/lib/ACLTestApp.pm t/lib/ACLTestApp/Controller/Root.pm t/lib/CDICompatTestPlugin.pm t/lib/Catalyst/Action/TestAfter.pm t/lib/Catalyst/Action/TestBefore.pm t/lib/Catalyst/Plugin/Test/Deprecated.pm t/lib/Catalyst/Plugin/Test/Errors.pm t/lib/Catalyst/Plugin/Test/Headers.pm t/lib/Catalyst/Plugin/Test/MangleDollarUnderScore.pm t/lib/Catalyst/Plugin/Test/Plugin.pm t/lib/Catalyst/Script/Bar.pm t/lib/Catalyst/Script/Baz.pm t/lib/Catalyst/Script/CompileTest.pm t/lib/ChainedActionsApp.pm t/lib/ChainedActionsApp/Controller/Root.pm t/lib/DeprecatedActionsInAppClassTestApp.pm t/lib/DeprecatedTestApp.pm t/lib/DeprecatedTestApp/C/Root.pm t/lib/NullPackage.pm t/lib/PluginTestApp.pm t/lib/PluginTestApp/Controller/Root.pm t/lib/ScriptTestApp/Script/Bar.pm t/lib/ScriptTestApp/Script/CompileTest.pm t/lib/ScriptTestApp/Script/Foo.pm t/lib/TestApp.pm t/lib/TestApp/Action/TestBefore.pm t/lib/TestApp/Action/TestExtraArgsAction.pm t/lib/TestApp/Action/TestMyAction.pm t/lib/TestApp/Controller/Action.pm t/lib/TestApp/Controller/Action/Action.pm t/lib/TestApp/Controller/Action/Auto.pm t/lib/TestApp/Controller/Action/Auto/Abort.pm t/lib/TestApp/Controller/Action/Auto/Deep.pm t/lib/TestApp/Controller/Action/Auto/Default.pm t/lib/TestApp/Controller/Action/Begin.pm t/lib/TestApp/Controller/Action/Chained.pm t/lib/TestApp/Controller/Action/Chained/ArgsOrder.pm t/lib/TestApp/Controller/Action/Chained/Auto.pm t/lib/TestApp/Controller/Action/Chained/Auto/Bar.pm t/lib/TestApp/Controller/Action/Chained/Auto/Detach.pm t/lib/TestApp/Controller/Action/Chained/Auto/Foo.pm t/lib/TestApp/Controller/Action/Chained/Auto/Forward.pm t/lib/TestApp/Controller/Action/Chained/Bar.pm t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm t/lib/TestApp/Controller/Action/Chained/Foo.pm t/lib/TestApp/Controller/Action/Chained/ParentChain.pm t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm t/lib/TestApp/Controller/Action/Chained/PassedArgs.pm t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm t/lib/TestApp/Controller/Action/Chained/Root.pm t/lib/TestApp/Controller/Action/Default.pm t/lib/TestApp/Controller/Action/Detach.pm t/lib/TestApp/Controller/Action/End.pm t/lib/TestApp/Controller/Action/Forward.pm t/lib/TestApp/Controller/Action/ForwardTo.pm t/lib/TestApp/Controller/Action/Global.pm t/lib/TestApp/Controller/Action/Go.pm t/lib/TestApp/Controller/Action/Index.pm t/lib/TestApp/Controller/Action/Inheritance.pm t/lib/TestApp/Controller/Action/Local.pm t/lib/TestApp/Controller/Action/Path.pm t/lib/TestApp/Controller/Action/Private.pm t/lib/TestApp/Controller/Action/Regexp.pm t/lib/TestApp/Controller/Action/Streaming.pm t/lib/TestApp/Controller/Action/TestMultipath.pm t/lib/TestApp/Controller/Action/TestRelative.pm t/lib/TestApp/Controller/Action/Visit.pm t/lib/TestApp/Controller/Anon.pm t/lib/TestApp/Controller/Args.pm t/lib/TestApp/Controller/Attributes.pm t/lib/TestApp/Controller/ContextClosure.pm t/lib/TestApp/Controller/Dump.pm t/lib/TestApp/Controller/Engine/Request/URI.pm t/lib/TestApp/Controller/Engine/Request/Uploads.pm t/lib/TestApp/Controller/Engine/Response/Cookies.pm t/lib/TestApp/Controller/Engine/Response/Errors.pm t/lib/TestApp/Controller/Engine/Response/Headers.pm t/lib/TestApp/Controller/Engine/Response/Large.pm t/lib/TestApp/Controller/Engine/Response/Print.pm t/lib/TestApp/Controller/Engine/Response/Redirect.pm t/lib/TestApp/Controller/Engine/Response/Status.pm t/lib/TestApp/Controller/Fork.pm t/lib/TestApp/Controller/Immutable.pm t/lib/TestApp/Controller/Immutable/HardToReload.pm t/lib/TestApp/Controller/Index.pm t/lib/TestApp/Controller/Keyword.pm t/lib/TestApp/Controller/Moose.pm t/lib/TestApp/Controller/Moose/MethodModifiers.pm t/lib/TestApp/Controller/Moose/NoAttributes.pm t/lib/TestApp/Controller/Priorities.pm t/lib/TestApp/Controller/Priorities/MultiMethod.pm t/lib/TestApp/Controller/Priorities/loc_vs_index.pm t/lib/TestApp/Controller/Priorities/locre_vs_index.pm t/lib/TestApp/Controller/Priorities/path_vs_index.pm t/lib/TestApp/Controller/Priorities/re_vs_index.pm t/lib/TestApp/Controller/Root.pm t/lib/TestApp/DispatchType/CustomPostLoad.pm t/lib/TestApp/DispatchType/CustomPreLoad.pm t/lib/TestApp/Model.pm t/lib/TestApp/Model/ClosuresInConfig.pm t/lib/TestApp/Model/Foo.pm t/lib/TestApp/Model/Foo/Bar.pm t/lib/TestApp/Model/Generating.pm t/lib/TestApp/Plugin/AddDispatchTypes.pm t/lib/TestApp/Plugin/FullyQualified.pm t/lib/TestApp/Plugin/ParameterizedRole.pm t/lib/TestApp/RequestBaseBug.pm t/lib/TestApp/Role.pm t/lib/TestApp/View/Dump.pm t/lib/TestApp/View/Dump/Body.pm t/lib/TestApp/View/Dump/Env.pm t/lib/TestApp/View/Dump/Request.pm t/lib/TestApp/View/Dump/Response.pm t/lib/TestAppBadlyImmutable.pm t/lib/TestAppChainedAbsolutePathPart.pm t/lib/TestAppChainedAbsolutePathPart/Controller/Foo.pm t/lib/TestAppChainedRecursive.pm t/lib/TestAppChainedRecursive/Controller/Foo.pm t/lib/TestAppClassExceptionSimpleTest.pm t/lib/TestAppDoubleAutoBug.pm t/lib/TestAppDoubleAutoBug/Controller/Root.pm t/lib/TestAppEncoding.pm t/lib/TestAppEncoding/Controller/Root.pm t/lib/TestAppIndexDefault.pm t/lib/TestAppIndexDefault/Controller/Default.pm t/lib/TestAppIndexDefault/Controller/IndexChained.pm t/lib/TestAppIndexDefault/Controller/IndexPrivate.pm t/lib/TestAppIndexDefault/Controller/Root.pm t/lib/TestAppMatchSingleArg.pm t/lib/TestAppMatchSingleArg/Controller/Root.pm t/lib/TestAppMetaCompat.pm t/lib/TestAppMetaCompat/Controller/Base.pm t/lib/TestAppMetaCompat/Controller/Books.pm t/lib/TestAppNonMooseController.pm t/lib/TestAppNonMooseController/Controller/Foo.pm t/lib/TestAppNonMooseController/ControllerBase.pm t/lib/TestAppOnDemand.pm t/lib/TestAppOnDemand/Controller/Body.pm t/lib/TestAppOneView.pm t/lib/TestAppOneView/Controller/Root.pm t/lib/TestAppOneView/View/Dummy.pm t/lib/TestAppPathBug.pm t/lib/TestAppPluginWithConstructor.pm t/lib/TestAppPluginWithConstructor/Controller/Root.pm t/lib/TestAppShowInternalActions.pm t/lib/TestAppShowInternalActions/Controller/Root.pm t/lib/TestAppStats.pm t/lib/TestAppStats/Controller/Root.pm t/lib/TestAppToTestScripts.pm t/lib/TestAppUnknownError.pm t/lib/TestAppViewWarnings.pm t/lib/TestAppViewWarnings/Controller/Root.pm t/lib/TestAppWithMeta.pm t/lib/TestAppWithMeta/Controller/Root.pm t/lib/TestPluginWithConstructor.pm t/optional/mod_perl-locationmatch.pl t/optional/mod_perl-non-root.pl t/optional/mod_perl.pl t/release-no-tabs.t t/release-pod-syntax.t META.json000644001750001750 1374211452456126 16400 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16{ "abstract" : "Catalyst Apache Engines", "author" : [ "Sebastian Riedel ", "Christian Hansen ", "Andy Grundman ", "Tomas Doran " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.102341, CPAN::Meta::Converter version 2.102400", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Catalyst-Engine-Apache", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.31" } }, "runtime" : { "requires" : { "Catalyst::Runtime" : "5.80" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-Catalyst-Engine-Apache@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Engine-Apache" }, "homepage" : "http://search.cpan.org/dist/Catalyst-Engine-Apache", "repository" : { "type" : "svn", "url" : "http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Engine-Apache/", "web" : "http://dev.catalystframework.org/svnweb/Catalyst/browse/Catalyst-Engine-Apache" } }, "version" : "1.16", "x_Dist_Zilla" : { "plugins" : [ { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@Filter/@Basic/GatherDir", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/@Basic/PruneCruft", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/@Basic/ManifestSkip", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/@Basic/MetaYAML", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Filter/@Basic/License", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Filter/@Basic/Readme", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Filter/@Basic/ExtraTests", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/@Basic/ExecDir", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/@Basic/ShareDir", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@Filter/@Basic/MakeMaker", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/@Basic/Manifest", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/@Basic/TestRelease", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/@Basic/ConfirmRelease", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/@Basic/UploadToCPAN", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Filter/MetaConfig", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Filter/MetaJSON", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Filter/PkgVersion", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Filter/PodSyntaxTests", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "name" : "@Filter/NoTabsTests", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Filter/MetaResources", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@Filter/Authority", "version" : "1.000" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "name" : "@Filter/PodWeaver", "version" : "3.101640" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "4.102341" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "4.102341" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "4.102341" } }, "x_authority" : "cpan:BOBTFISH" } Makefile.PL000644001750001750 213511452456126 16703 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16 use strict; use warnings; use ExtUtils::MakeMaker 6.31; my %WriteMakefileArgs = ( 'ABSTRACT' => 'Catalyst Apache Engines', 'AUTHOR' => 'Sebastian Riedel , Christian Hansen , Andy Grundman , Tomas Doran ', 'BUILD_REQUIRES' => {}, 'CONFIGURE_REQUIRES' => { 'ExtUtils::MakeMaker' => '6.31' }, 'DISTNAME' => 'Catalyst-Engine-Apache', 'EXE_FILES' => [], 'LICENSE' => 'perl', 'NAME' => 'Catalyst::Engine::Apache', 'PREREQ_PM' => { 'Catalyst::Runtime' => '5.80' }, 'VERSION' => '1.16', 'test' => { 'TESTS' => 't/*.t' } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); t000711001750001750 011452456126 15024 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.1600compiles.t000600001750001750 14411452456126 17302 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/tuse strict; use warnings; use Test::More 0.88; use_ok 'Catalyst::Engine::Apache'; done_testing; author-pod.t000600001750001750 35511452456126 17415 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use Test::Pod 1.14; all_pod_files_ok(); lib000711001750001750 011452456126 15572 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/tTestApp.pm000600001750001750 550611452456126 17655 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestApp; use strict; use Catalyst qw/ Test::MangleDollarUnderScore Test::Errors Test::Headers Test::Plugin Test::Inline +TestApp::Plugin::FullyQualified +TestApp::Plugin::AddDispatchTypes +TestApp::Role /; use Catalyst::Utils; use Moose; use namespace::autoclean; # ----------- # t/aggregate/unit_core_ctx_attr.t pukes until lazy is true package Greeting; use Moose; sub hello_notlazy { 'hello there' } sub hello_lazy { 'hello there' } package TestApp; has 'my_greeting_obj_notlazy' => ( is => 'ro', isa => 'Greeting', default => sub { Greeting->new() }, handles => [ qw( hello_notlazy ) ], lazy => 0, ); has 'my_greeting_obj_lazy' => ( is => 'ro', isa => 'Greeting', default => sub { Greeting->new() }, handles => [ qw( hello_lazy ) ], lazy => 1, ); # ----------- our $VERSION = '0.01'; TestApp->config( name => 'TestApp', root => '/some/dir', use_request_uri_for_path => 1 ); # Test bug found when re-adjusting the metaclass compat code in Moose # in 292360. Test added to Moose in 4b760d6, but leave this attribute # above ->setup so we have some generated methods to be double sure. has an_attribute_before_we_change_base_classes => ( is => 'ro'); if ($::setup_leakchecker && eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) { with 'CatalystX::LeakChecker'; has leaks => ( is => 'ro', default => sub { [] }, ); } sub found_leaks { my ($ctx, @leaks) = @_; push @{ $ctx->leaks }, @leaks; } sub count_leaks { my ($ctx) = @_; return scalar @{ $ctx->leaks }; } TestApp->setup; sub execute { my $c = shift; my $class = ref( $c->component( $_[0] ) ) || $_[0]; my $action = $_[1]->reverse; my $method; if ( $action =~ /->(\w+)$/ ) { $method = $1; } elsif ( $action =~ /\/(\w+)$/ ) { $method = $1; } elsif ( $action =~ /^(\w+)$/ ) { $method = $action; } if ( $class && $method && $method !~ /^_/ ) { my $executed = sprintf( "%s->%s", $class, $method ); my @executed = $c->response->headers->header('X-Catalyst-Executed'); push @executed, $executed; $c->response->headers->header( 'X-Catalyst-Executed' => join ', ', @executed ); } no warnings 'recursion'; return $c->SUPER::execute(@_); } # Replace the very large HTML error page with # useful info if something crashes during a test sub finalize_error { my $c = shift; $c->next::method(@_); $c->res->status(500); $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) ); } { no warnings 'redefine'; sub Catalyst::Log::error { } } # Make sure we can load Inline plugins. package Catalyst::Plugin::Test::Inline; use strict; use base qw/Class::Data::Inheritable/; 1; author-notabs.t000600001750001750 42311452456126 20115 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use File::Spec; use FindBin (); use Test::More; use Test::NoTabs; all_perl_files_ok(qw/lib/); ACLTestApp.pm000600001750001750 65511452456126 20155 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage ACLTestApp; use Test::More; use strict; use warnings; use MRO::Compat; use Scalar::Util (); use base qw/Catalyst Catalyst::Controller/; use Catalyst qw//; sub execute { my $c = shift; my ( $class, $action ) = @_; if ( Scalar::Util::blessed($action) and $action->name ne "foobar" ) { eval { $c->detach( 'foobar', [$action, 'foo'] ) }; } $c->next::method( @_ ); } __PACKAGE__->setup; 1; release-no-tabs.t000644001750001750 45011452456126 20320 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; eval 'use Test::NoTabs'; plan skip_all => 'Test::NoTabs required' if $@; all_perl_files_ok(); conf000711001750001750 011452456126 15751 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/textra.conf.in000600001750001750 257711452456126 20522 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/conf# mod_perl 1 use lib qw(@ServerRoot@/lib); PerlModule TestApp SetHandler perl-script PerlHandler TestApp # test at a non-root location SetHandler perl-script PerlHandler TestApp # mod_perl 2 # Needed to pass some %2F tests AllowEncodedSlashes on PerlSwitches -I@ServerRoot@/lib PerlModule TestApp SetHandler modperl PerlResponseHandler TestApp # test at a non-root location SetHandler modperl PerlResponseHandler TestApp # test LocationMatch (RT 26921) SetHandler modperl PerlResponseHandler TestApp # test using the perl-script handler SetHandler perl-script PerlResponseHandler TestApp NullPackage.pm000600001750001750 46611452456126 20443 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage NullPackage; # Do nothing class, there should be no code or symbols defined here.. # Loading this works fine in 5.70, but a die was introduced in 5.80 which caused # it to fail. This has been changed to a warning to maintain back-compat. # See Catalyst::Utils::ensure_class_loaded() for more info. 1; author-live_loop.t000600001750001750 131511452456126 20640 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 3; use Catalyst::Test 'TestApp'; SKIP: { # Net::HTTP::Methods crashes when talking to a remote server because this # test causes a very long header line to be sent if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 3; } ok( my $response = request('http://localhost/loop_test'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( $response->header('X-Class-Forward-Test-Method'), 'Loop OK' ); } author-live_fork.t000600001750001750 335311452456126 20634 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!/usr/bin/perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } # live_fork.t # Copyright (c) 2006 Jonathan Rockway =head1 SYNOPSIS Tests if Catalyst can fork/exec other processes successfully =cut use strict; use warnings; use Test::More; use YAML; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test qw(TestApp); plan skip_all => 'Using remote server' if $ENV{CATALYST_SERVER}; plan skip_all => 'Skipping fork tests: no /bin/ls' if !-e '/bin/ls'; # see if /bin/ls exists plan tests => 13; # otherwise { system: ok(my $result = get('/fork/system/%2Fbin%2Fls'), 'system'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); is($result_ref->{result}, 0, 'exited OK'); } { backticks: ok(my $result = get('/fork/backticks/%2Fbin%2Fls'), '`backticks`'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); is($result_ref->{code}, 0, 'exited successfully'); like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$'); like($result_ref->{result}, qr{\n.*\n}m, 'contains two newlines'); } { fork: ok(my $result = get('/fork/fork'), 'fork'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); isnt($result_ref->{pid}, 0, q{fork's "pid" wasn't 0}); isnt($result_ref->{pid}, $$, 'fork got a new pid'); is($result_ref->{result}, 'ok', 'fork was effective'); } catalyst_130pix.gif000600001750001750 1310511452456126 20622 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/tPNG  IHDR-+$gAMAOX2tEXtSoftwareAdobe ImageReadyqe<IDATx[ \T;/ 6l"".g,zm*ʧ2sA@\JAQV]ٗffflof)/0s=;b}Crͅ "NJ 8qՐG HܻW+`\\0J%I–Hk5e˗>T* Ņ.?VВtqgYKN%-VykG'ڊ%x fmim1(WZ?ޠh[Z|&Nl۸ZSزPo/bۻWf>M E1B {JSi)1&2Y|AJD.iMq^!V??cW(eҤ{W4R1.C`|hX w"gϿ! 11)Y0$*|֜R2c/^y ?RstH,Y-{q3'&d?I۹}3Sg6l}0+Uի umM㝝&D" 8؁W5-%e0R={L>> &MؑoJ==}☈̖75  ˗j9Eszzzht0?P}hk;ڡRQ(0dQ܊X2,D"ɤܷuu [z̪`<?84lX*aJvVyi] ]3q#~x:DΕl6@ (T-$lp(ss^5 L {@ ikmmO͜!a`$9viR ndf';¬I`0͟~74SaF"Ϛ b׶my +^|dJ2˂h4Ff DbqWWzRit qk|\HP0jA$889'r/֌FW,jnTpF4 /NH0j.~#c0nd ?fx 4taPKe __b~~ŋhD@.rIa\E۳}jթd."0(xS8n۹{t87T*Ny8z{g_?x?{ ) &;X,a^Z܅'Myh_7˹Z^Vv׉IGGǤ$#H.5`q8S'a`q!#NY@rٔ܏g}`[,m^`0j  h/T},U_aaXXCjlme Pt /l6;|D&'G%. R{aY[k (CeP,lx%ׯAf"b6'~쬂y3l Fy/[ a]ܔ{eSf!rۗ`v_> \V;gou(pNѨZ\^^9exPk))}zrNtl6*HldxLUZ7%|FDdW* uѠLxN  6aăߴ+(j51,[\m1 {p SZ|]Q  8@>oB3[Ϗ3fk4fr9{#|5n??u ?tqcCRA&3'&jNFcKKzziAAC腅[׭C;;#:1Fpپ9AB\+GF!;\BQag_+H$.}%TR3gAQHO Uc͈MضbAGysc!xލ!g[[qQQgmۼ⢯GQ;[lhn&:95]2f 6`fAc[X@a^ h;=]'ƍv}~YwW{ Id0'N}uM }06k>_agE_Ølmo[Al`p(Hp8yH쳤[_0op0-s]BX] %Qpmht'N,iڿrgPd[>6ra/T `aq&9rlA~ƱB.K0ׯ*p@ƎiϝO7@pus_[?^FX&xP9pL`pokjF{>iRS[:K0/-?Y`?#,qu^''gX9 57ss>BE / @+ D対E`ːE z~39tl=HXtġ;Fz]$?:uLO/oj R:Xc k#=7 Cwq1M&>I'S:kgwm)+OG1w'N_nMS1~`CƎr̽}1#Pd2!C rpF E8*U3gˡKR`<HɤPli[,(K"w>VR|84ș1{.sgި(#)gxDČYs&^#"#OAhD7 ׬v 'ΝLpqw`9ӁjGw/3z= m+Kzt:l+gm׿ꥌ8,M6=zmX } ﮫ(/H<'<9ٞxHsqs[;2/#úh4:H"rd2/`HaA:9͙{oص wAy {؀PXUuh? a#CÞYbϿ8±nӦu$=sDG4([bbjnܐ8`HL^-]}Q&0P2lXd2dʔLݾ}2'68=iԨnmԨH TVV]C||2˫u Qk8Qʽ VWwW~nhb\t1pH3JhZc}Zk+tzY^TXe#Rڵ]]G<*>\]\Tݸ!wއX$$pֶ6eEBK$!~~"]9ɸǏ__~&;`CK&sr܃zk`y-_(i{ti3b 2`>Y@"PD@W7VF $OBM^\Tbs9 V^Ɇzzy0 EɔH$ *Pܹyxdf0)J ֩р҃B ttt Dhl79px":}mqqfZqN3xP2}@2L0M,6F D"Ge!X,n7PNt#]۷PHR`پ|e>R{QA[g&+BSc+Z@&j ;x+;zL ɩױcBݎ><`URTwKx0n`Cvj"96`0\ Cj<$vV* :l1Zm^ufWѿ]PR;;۷!v- m&۫TqC}CsAAPCF64)Qiix_n[ //?bB41&/ nڤ0~d^K݂cׯ(;0‚yҿ' [_O^7IENDB`TestAppStats.pm000600001750001750 65211452456126 20651 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libuse strict; use warnings; package TestAppStats; use Catalyst qw/ -Stats=1 /; our $VERSION = '0.01'; our @log_messages; __PACKAGE__->config( name => 'TestAppStats', root => '/some/dir' ); __PACKAGE__->log(TestAppStats::Log->new); __PACKAGE__->setup; package TestAppStats::Log; use base qw/Catalyst::Log/; sub info { push(@TestAppStats::log_messages, @_); } sub debug { push(@TestAppStats::log_messages, @_); } 1; TestApp000711001750001750 011452456126 17152 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libRole.pm000600001750001750 50711452456126 20532 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApppackage TestApp::Role; use Moose::Role; use namespace::clean -except => 'meta'; requires 'fully_qualified'; # Comes from TestApp::Plugin::FullyQualified our $SETUP_FINALIZE = 0; our $SETUP_DISPATCHER = 0; before 'setup_finalize' => sub { $SETUP_FINALIZE++ }; before 'setup_dispatcher' => sub { $SETUP_DISPATCHER++ }; 1; PluginTestApp.pm000600001750001750 151311452456126 21026 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage PluginTestApp; use Test::More; use Catalyst ( 'Test::Plugin', '+TestApp::Plugin::FullyQualified', (eval { require MooseX::Role::Parameterized; 1 } ? ('+TestApp::Plugin::ParameterizedRole' => { method_name => 'affe' }) : ()), ); sub _test_plugins { my $c = shift; is_deeply [ $c->registered_plugins ], [ qw/Catalyst::Plugin::Test::Plugin TestApp::Plugin::FullyQualified/ ], '... and it should report the correct plugins'; ok $c->registered_plugins('Catalyst::Plugin::Test::Plugin'), '... or if we have a particular plugin'; ok $c->registered_plugins('Test::Plugin'), '... even if it is not fully qualified'; ok !$c->registered_plugins('No::Such::Plugin'), '... and it should return false if the plugin does not exist'; } __PACKAGE__->setup; Model.pm000600001750001750 53111452456126 20666 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApppackage TestApp::Model; use Moose; use namespace::clean -except => 'meta'; extends 'Catalyst::Model'; # Test a closure here, r10394 made this blow up when we clone the config down # onto the subclass.. __PACKAGE__->config( escape_flags => { 'js' => sub { ${ $_[0] } =~ s/\'/\\\'/g; }, } ); __PACKAGE__->meta->make_immutable; optional000711001750001750 011452456126 16651 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/tmod_perl.pl000711001750001750 114411452456126 21151 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/optional#!perl # Run all tests against Apache mod_perl # # Note, to get this to run properly, you may need to give it the path to your # httpd.conf: # # perl t/optional/mod_perl.pl -httpd_conf /etc/apache/httpd.conf # # For debugging, you can start TestApp and leave it running with # perl t/optional/mod_perl.pl -httpd_conf /etc/apache/httpd.conf --start-httpd # # To stop it: # perl t/optional/mod_perl.pl -httpd_conf /etc/apache/httpd.conf --stop-httpd use strict; use warnings; use Apache::Test; use Apache::TestRunPerl (); $ENV{CATALYST_SERVER} = 'http://localhost:8529'; Apache::TestRunPerl->new->run(@ARGV); author-podcoverage.t000600001750001750 75411452456126 21134 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use Pod::Coverage 0.19; use Test::Pod::Coverage 1.04; my @modules = all_modules; our @private = ( 'BUILD' ); foreach my $module (@modules) { local @private = (@private, 'run') if $module =~ /^Catalyst::Script::/; pod_coverage_ok($module, { also_private => \@private }); } done_testing; release-pod-syntax.t000644001750001750 45011452456126 21063 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); TestAppPathBug.pm000600001750001750 67711452456126 21114 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libuse strict; use warnings; package TestAppPathBug; use strict; use warnings; use Catalyst; our $VERSION = '0.01'; __PACKAGE__->config( name => 'TestAppPathBug', root => '/some/dir' ); __PACKAGE__->log(TestAppPathBug::Log->new); __PACKAGE__->setup; sub foo : Path { my ( $self, $c ) = @_; $c->res->body( 'This is the foo method.' ); } package TestAppPathBug::Log; use strict; use warnings; use base qw/Catalyst::Log/; sub warn {} 1; TestAppOneView.pm000600001750001750 13111452456126 21117 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppOneView; use strict; use warnings; use Catalyst; __PACKAGE__->setup; 1; TestAppOnDemand.pm000600001750001750 44011452456126 21233 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppOnDemand; use strict; use Catalyst qw/ Test::Errors Test::Headers /; use Catalyst::Utils; our $VERSION = '0.01'; __PACKAGE__->config( name => __PACKAGE__, root => '/some/dir', parse_on_demand => 1, ); __PACKAGE__->setup; 1; TestAppEncoding.pm000600001750001750 23411452456126 21275 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppEncoding; use strict; use warnings; use base qw/Catalyst/; use Catalyst; __PACKAGE__->config(name => __PACKAGE__); __PACKAGE__->setup; 1; TestAppWithMeta.pm000600001750001750 23111452456126 21266 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppWithMeta; use strict; use warnings; use Catalyst; no warnings 'redefine'; sub meta {} use warnings 'redefine'; __PACKAGE__->setup; 1; author-live_recursion.t000600001750001750 143511452456126 21703 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 3; use Catalyst::Test 'TestApp'; local $^W = 0; SKIP: { # Net::HTTP::Methods crashes when talking to a remote server because this # test causes a very long header line to be sent if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 3; } ok( my $response = request('http://localhost/recursion_test'), 'Request' ); ok( !$response->is_success, 'Response Not Successful' ); is( $response->header('X-Catalyst-Error'), 'Deep recursion detected calling "/recursion_test"', 'Deep Recursion Detected' ); } DeprecatedTestApp.pm000600001750001750 31411452456126 21606 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage DeprecatedTestApp; use strict; use Catalyst qw/ Test::Deprecated /; our $VERSION = '0.01'; __PACKAGE__->config( name => 'DeprecatedTestApp', root => '/some/dir' ); __PACKAGE__->setup; 1; TestAppMetaCompat.pm000600001750001750 16611452456126 21605 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppMetaCompat; use base qw/Catalyst/; __PACKAGE__->config(name => __PACKAGE__); __PACKAGE__->setup; 1; ChainedActionsApp.pm000600001750001750 46211452456126 21566 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage ChainedActionsApp; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw//; extends 'Catalyst'; our $VERSION = "0.01"; $VERSION = eval $VERSION; __PACKAGE__->config( name => 'ChainedActionsApp', disable_component_regex_fallback => 1, ); __PACKAGE__->setup; 1; Model000711001750001750 011452456126 20212 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppFoo.pm000600001750001750 54311452456126 21414 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Modelpackage TestApp::Model::Foo; use strict; use warnings; use base qw/ Catalyst::Model /; __PACKAGE__->config( 'quux' => 'chunkybacon' ); sub model_foo_method { 1 } sub model_quux_method { shift->{quux} } package TestApp::Model::Foo::Bar; sub model_foo_bar_method_from_foo { 1 } package TestApp::Model::Foo; sub bar { "TestApp::Model::Foo::Bar" } 1; View000711001750001750 011452456126 20064 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppDump.pm000600001750001750 247111452456126 21472 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Viewpackage TestApp::View::Dump; use strict; use base 'Catalyst::View'; use Data::Dumper (); use Scalar::Util qw(blessed weaken); sub dump { my ( $self, $reference ) = @_; return unless $reference; my $dumper = Data::Dumper->new( [$reference] ); $dumper->Indent(1); $dumper->Purity(1); $dumper->Useqq(0); $dumper->Deepcopy(1); $dumper->Quotekeys(0); $dumper->Terse(1); return $dumper->Dump; } sub process { my ( $self, $c, $reference ) = @_; # Force processing of on-demand data $c->prepare_body; # Remove body from reference if needed $reference->{__body_type} = blessed $reference->body if (blessed $reference->{_body}); my $body = delete $reference->{_body}; # Remove context from reference if needed my $context = delete $reference->{_context}; if ( my $output = $self->dump( $reference ) ) { $c->res->headers->content_type('text/plain'); $c->res->output($output); if ($context) { # Repair context $reference->{_context} = $context; weaken( $reference->{_context} ); } if ($body) { # Repair body delete $reference->{__body_type}; $reference->{_body} = $body; } return 1; } return 0; } 1; author-live_priorities.t000600001750001750 570711452456126 22071 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 28; use Catalyst::Test 'TestApp'; use Data::Dumper; local $^W = 0; my $uri_base = 'http://localhost/priorities'; my @tests = ( # Simple 'Regex vs. Local', { path => '/re_vs_loc', expect => 'local' }, 'Regex vs. LocalRegex', { path => '/re_vs_locre', expect => 'regex' }, 'Regex vs. Path', { path => '/re_vs_path', expect => 'path' }, 'Local vs. LocalRegex', { path => '/loc_vs_locre', expect => 'local' }, 'Local vs. Path 1', { path => '/loc_vs_path1', expect => 'local' }, 'Local vs. Path 2', { path => '/loc_vs_path2', expect => 'path' }, 'Path vs. LocalRegex', { path => '/path_vs_locre', expect => 'path' }, # index 'index vs. Regex', { path => '/re_vs_index', expect => 'index' }, 'index vs. Local', { path => '/loc_vs_index', expect => 'index' }, 'index vs. LocalRegex', { path => '/locre_vs_index', expect => 'index' }, 'index vs. Path', { path => '/path_vs_index', expect => 'index' }, 'multimethod zero', { path => '/multimethod', expect => 'zero' }, 'multimethod one', { path => '/multimethod/1', expect => 'one 1' }, 'multimethod two', { path => '/multimethod/1/2', expect => 'two 1 2' }, ); while ( @tests ) { my $name = shift @tests; my $data = shift @tests; # Run tests for path with trailing slash and without SKIP: for my $req_uri ( join( '' => $uri_base, $data->{ path } ), # Without trailing path join( '' => $uri_base, $data->{ path }, '/' ), # With trailing path ) { my $end_slash = ( $req_uri =~ qr(/$) ? 1 : 0 ); # use slash_expect argument if URI ends with slash # and the slash_expect argument is defined my $expect = $data->{ expect } || ''; if ( $end_slash and exists $data->{ slash_expect } ) { $expect = $data->{ slash_expect }; } # Call the URI on the TestApp my $response = request( $req_uri ); # Leave expect out to see the result unless ( $expect ) { skip 'Nothing expected, winner is ' . $response->content, 1; } # Show error if response was no success if ( not $response->is_success ) { diag 'Error: ' . $response->headers->{ 'x-catalyst-error' }; } # Test if content matches expectations. # TODO This might flood the screen with the catalyst please-come-later # page. So I don't know it is a good idea. is( $response->content, $expect, "$name: @{[ $data->{ expect } ]} wins" . ( $end_slash ? ' (trailing slash)' : '' ) ); } } TestAppViewWarnings.pm000600001750001750 62211452456126 22173 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libuse strict; use warnings; package TestAppViewWarnings; use Catalyst; our @log_messages; __PACKAGE__->config( name => 'TestAppWarnings', root => '/some/dir', default_view => "DoesNotExist" ); __PACKAGE__->log(TestAppViewWarnings::Log->new); __PACKAGE__->setup; package TestAppViewWarnings::Log; use base qw/Catalyst::Log/; sub warn { push(@TestAppViewWarnings::log_messages, @_[1..$#_]); } 1; CDICompatTestPlugin.pm000600001750001750 235611452456126 22057 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage CDICompatTestPlugin; # This plugin specificially tests an edge case of C::D::I compat, # where you load a plugin which creates an accessor with the same # name as a class data accessor (_config in this case).. # This is what happens if you use the authentication back-compat # stuff, as C::A::Plugin::Credential::Password is added to the plugin # list, and that uses base C::A::C::P class, does the mk_accessors. # If a class data method called _config hasn't been created in # MyApp ($app below), then our call to ->config gets our accessor # (rather than the class data one), and we fail.. use strict; use warnings; use base qw/Class::Accessor::Fast/; use MRO::Compat; __PACKAGE__->mk_accessors(qw/_config/); sub setup { my $app = shift; $app->config; $app->next::method(@_); } # However, if we are too enthusiastic about adding accessors to the # MyApp package, then this method isn't called (as there is a local # symbol already). # Note - use a different package here, so that Moose's # package detection code doesn't get confused.. $CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 0; sub setup_finished { my $app = shift; $CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 1; $app->next::method(@_); } 1; TestAppIndexDefault.pm000600001750001750 13611452456126 22124 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppIndexDefault; use strict; use warnings; use Catalyst; __PACKAGE__->setup; 1; TestAppUnknownError.pm000600001750001750 35711452456126 22226 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestApp; use strict; use warnings; use Catalyst::Runtime 5.70; use base qw/Catalyst/; use Catalyst; __PACKAGE__->setup(); sub _test { my $self = shift; $self->_method_which_does_not_exist; } __PACKAGE__->_test; 1; Script000711001750001750 011452456126 20622 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/CatalystBaz.pm000600001750001750 44311452456126 22014 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Scriptpackage Catalyst::Script::Baz; use Moose; use namespace::autoclean; use Test::More; with 'Catalyst::ScriptRole'; sub run { __PACKAGE__ } after new_with_options => sub { my ($self, %args) = @_; is_deeply \%args, { application_name => 'ScriptTestApp' }, 'App name correct'; }; 1; Bar.pm000600001750001750 17711452456126 22010 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Scriptpackage Catalyst::Script::Bar; use Moose; use namespace::autoclean; with 'Catalyst::ScriptRole'; sub run { __PACKAGE__ } 1; Engine000711001750001750 011452456126 20320 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/CatalystApache.pm000600001750001750 2371111452456126 22222 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/Enginepackage Catalyst::Engine::Apache; BEGIN { $Catalyst::Engine::Apache::AUTHORITY = 'cpan:BOBTFISH'; } BEGIN { $Catalyst::Engine::Apache::VERSION = '1.16'; } # ABSTRACT: Catalyst Apache Engines use strict; use warnings; use base 'Catalyst::Engine'; use File::Spec; use URI; use URI::http; use URI::https; use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 ); __PACKAGE__->mk_accessors(qw/apache return/); sub prepare_request { my ( $self, $c, $r ) = @_; $self->apache( $r ); $self->return( undef ); } sub prepare_connection { my ( $self, $c ) = @_; $c->request->address( $self->apache->connection->remote_ip ); PROXY_CHECK: { my $headers = $self->apache->headers_in; unless ( $c->config->{using_frontend_proxy} ) { last PROXY_CHECK if $c->request->address ne '127.0.0.1'; last PROXY_CHECK if $c->config->{ignore_frontend_proxy}; } last PROXY_CHECK unless $headers->{'X-Forwarded-For'}; # If we are running as a backend server, the user will always appear # as 127.0.0.1. Select the most recent upstream IP (last in the list) my ($ip) = $headers->{'X-Forwarded-For'} =~ /([^,\s]+)$/; $c->request->address( $ip ); } $c->request->hostname( $self->apache->connection->remote_host ); $c->request->protocol( $self->apache->protocol ); $c->request->user( $self->apache->user ); $c->request->remote_user( $self->apache->user ); # when config options are set, check them here first if ($INC{'Apache2/ModSSL.pm'}) { $c->request->secure(1) if $self->apache->connection->is_https; } else { my $https = $self->apache->subprocess_env('HTTPS'); $c->request->secure(1) if defined $https and uc $https eq 'ON'; } } sub prepare_query_parameters { my ( $self, $c ) = @_; if ( my $query_string = $self->apache->args ) { $self->SUPER::prepare_query_parameters( $c, $query_string ); } } sub prepare_headers { my ( $self, $c ) = @_; $c->request->method( $self->apache->method ); if ( my %headers = %{ $self->apache->headers_in } ) { $c->request->header( %headers ); } } sub prepare_path { my ( $self, $c ) = @_; my $scheme = $c->request->secure ? 'https' : 'http'; my $host = $self->apache->hostname || 'localhost'; my $port = $self->apache->get_server_port; # If we are running as a backend proxy, get the true hostname PROXY_CHECK: { unless ( $c->config->{using_frontend_proxy} ) { last PROXY_CHECK if $host !~ /localhost|127.0.0.1/; last PROXY_CHECK if $c->config->{ignore_frontend_proxy}; } last PROXY_CHECK unless $c->request->header( 'X-Forwarded-Host' ); $host = $c->request->header( 'X-Forwarded-Host' ); if ( $host =~ /^(.+):(\d+)$/ ) { $host = $1; $port = $2; } else { # backend could be on any port, so # assume frontend is on the default port $port = $c->request->secure ? 443 : 80; } } my $base_path = ''; # Are we running in a non-root Location block? my $location = $self->apache->location; if ( $location && $location ne '/' ) { $base_path = $location; } # Using URI directly is way too slow, so we construct the URLs manually my $uri_class = "URI::$scheme"; if ( $port !~ /^(?:80|443)$/ && $host !~ /:/ ) { $host .= ":$port"; } # We want the path before Apache escapes it. Under mod_perl2 this is available # with the unparsed_uri method. Under mod_perl 1 we must parse it out of the # request line. my ($path, $qs); if ( MP2 ) { ($path, $qs) = split /\?/, $self->apache->unparsed_uri, 2; } else { my (undef, $path_query) = split / /, $self->apache->the_request, 3; ($path, $qs) = split /\?/, $path_query, 2; } # Don't check for LocationMatch blocks if requested # http://rt.cpan.org/Ticket/Display.html?id=26921 if ( $self->apache->dir_config('CatalystDisableLocationMatch') ) { $base_path = ''; } # Check if $base_path appears to be a regex (contains invalid characters), # meaning we're in a LocationMatch block elsif ( $base_path =~ m/[^$URI::uric]/o ) { # Find out what part of the URI path matches the LocationMatch regex, # that will become our base my $match = qr/($base_path)/; my ($base_match) = $path =~ $match; $base_path = $base_match || ''; } # Strip leading slash $path =~ s{^/+}{}; # base must end in a slash $base_path .= '/' unless $base_path =~ m{/$}; # Are we an Apache::Registry script? Why anyone would ever want to run # this way is beyond me, but we'll support it! # XXX: This needs a test if ( defined $ENV{SCRIPT_NAME} && $self->apache->filename && -f $self->apache->filename && -x _ ) { $base_path .= $ENV{SCRIPT_NAME}; } # If the path is contained within the base, we need to make the path # match base. This handles the case where the app is running at /deep/path # but a request to /deep/path fails where /deep/path/ does not. if ( $base_path ne '/' && $base_path ne $path && $base_path =~ m{/$path} ) { $path = $base_path; $path =~ s{^/+}{}; } my $query = $qs ? '?' . $qs : ''; my $uri = $scheme . '://' . $host . '/' . $path . $query; $c->request->uri( bless \$uri, $uri_class ); my $base_uri = $scheme . '://' . $host . $base_path; $c->request->base( bless \$base_uri, $uri_class ); } sub read_chunk { my $self = shift; my $c = shift; $self->apache->read( @_ ); } sub finalize_body { my ( $self, $c ) = @_; $self->SUPER::finalize_body($c); # Data sent using $self->apache->print is buffered, so we need # to flush it after we are done writing. $self->apache->rflush; } sub finalize_headers { my ( $self, $c ) = @_; for my $name ( $c->response->headers->header_field_names ) { next if $name =~ /^Content-(Length|Type)$/i; my @values = $c->response->header($name); # allow X headers to persist on error if ( $name =~ /^X-/i ) { $self->apache->err_headers_out->add( $name => $_ ) for @values; } else { $self->apache->headers_out->add( $name => $_ ) for @values; } } # persist cookies on error responses if ( $c->response->header('Set-Cookie') && $c->response->status >= 400 ) { for my $cookie ( $c->response->header('Set-Cookie') ) { $self->apache->err_headers_out->add( 'Set-Cookie' => $cookie ); } } # The trick with Apache is to set the status code in $apache->status but # always return the OK constant back to Apache from the handler. $self->apache->status( $c->response->status ); $c->response->status( $self->return || $self->ok_constant ); my $type = $c->response->header('Content-Type') || 'text/html'; $self->apache->content_type( $type ); if ( my $length = $c->response->content_length ) { $self->apache->set_content_length( $length ); } return 0; } sub write { my ( $self, $c, $buffer ) = @_; if ( ! $self->apache->connection->aborted && defined $buffer) { return $self->apache->print( $buffer ); } return; } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Engine::Apache - Catalyst Apache Engines =head1 SYNOPSIS For example Apache configurations, see the documentation for the engine that corresponds to your Apache version. C - mod_perl 1.3x C - mod_perl 1.99x C - mod_perl 2.x =head1 DESCRIPTION These classes provide mod_perl support for Catalyst. =head1 METHODS =head2 $c->engine->apache Returns an C, C or C object, depending on your mod_perl version. This method is also available as $c->apache. =head2 $c->engine->return If you need to return something other than OK from the mod_perl handler, you may set any other Apache constant in this method. You should only use this method if you know what you are doing or bad things may happen! For example, to return DECLINED in mod_perl 2: use Apache2::Const -compile => qw(DECLINED); $c->engine->return( Apache2::Const::DECLINED ); =head2 NOTES ABOUT LOCATIONMATCH The Apache engine tries to figure out the correct base path if your app is running within a LocationMatch block. For example: SetHandler modperl PerlResponseHandler MyApp This will correctly set the base path to '/match/this/' or '/match/that/' depending on which path was used for the request. In some cases this may not be what you want, so you can disable this behavior by adding this to your configuration: PerlSetVar CatalystDisableLocationMatch 1 =head2 NOTES ON NON-STANDARD PORTS If you wish to run your site on a non-standard port you will need to use the C Apache config rather than C. This will result in the correct port being added to urls created using C. Port 8080 =head1 OVERLOADED METHODS This class overloads some methods from C. =over 4 =item prepare_request($r) =item prepare_connection =item prepare_query_parameters =item prepare_headers =item prepare_path =item read_chunk =item finalize_body =item finalize_headers =item write =back =head1 SEE ALSO L L. =head1 AUTHORS =over 4 =item * Sebastian Riedel =item * Christian Hansen =item * Andy Grundman =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by The "AUTHORS". 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 TestAppToTestScripts.pm000600001750001750 22111452456126 22335 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppToTestScripts; use strict; use warnings; use Carp; our @RUN_ARGS; sub run { @RUN_ARGS = @_; 1; # Does this work? } 1; TestAppDoubleAutoBug.pm000600001750001750 174111452456126 22274 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libuse strict; use warnings; package TestAppDoubleAutoBug; use Catalyst qw/ Test::Errors Test::Headers Test::Plugin /; our $VERSION = '0.01'; __PACKAGE__->config( name => 'TestAppDoubleAutoBug', root => '/some/dir' ); __PACKAGE__->setup; sub execute { my $c = shift; my $class = ref( $c->component( $_[0] ) ) || $_[0]; my $action = $_[1]->reverse(); my $method; if ( $action =~ /->(\w+)$/ ) { $method = $1; } elsif ( $action =~ /\/(\w+)$/ ) { $method = $1; } elsif ( $action =~ /^(\w+)$/ ) { $method = $action; } if ( $class && $method && $method !~ /^_/ ) { my $executed = sprintf( "%s->%s", $class, $method ); my @executed = $c->response->headers->header('X-Catalyst-Executed'); push @executed, $executed; $c->response->headers->header( 'X-Catalyst-Executed' => join ', ', @executed ); } return $c->SUPER::execute(@_); } 1; author-live_plugin_loaded.t000600001750001750 171511452456126 22501 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 5; use Catalyst::Test 'TestApp'; my @expected = qw[ Catalyst::Plugin::Test::Errors Catalyst::Plugin::Test::Headers Catalyst::Plugin::Test::Inline Catalyst::Plugin::Test::MangleDollarUnderScore Catalyst::Plugin::Test::Plugin TestApp::Plugin::AddDispatchTypes TestApp::Plugin::FullyQualified ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/dump/request'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/'Catalyst::Request'/, 'Content is a serialized Catalyst::Request' ); is( $response->header('X-Catalyst-Plugins'), $expected, 'Loaded plugins' ); Apache2.pm000600001750001750 272011452456126 22261 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/Enginepackage Catalyst::Engine::Apache2; BEGIN { $Catalyst::Engine::Apache2::AUTHORITY = 'cpan:BOBTFISH'; } BEGIN { $Catalyst::Engine::Apache2::VERSION = '1.16'; } # ABSTRACT: Base class for Apache 1.99x and 2.x Engines use strict; use warnings; use base 'Catalyst::Engine::Apache'; sub finalize_headers { my ( $self, $c ) = @_; $self->SUPER::finalize_headers( $c ); # This handles the case where Apache2 will remove the Content-Length # header on a HEAD request. # http://perl.apache.org/docs/2.0/user/handlers/http.html if ( $self->apache->header_only ) { $self->apache->rflush; } return 0; } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Engine::Apache2 - Base class for Apache 1.99x and 2.x Engines =head1 SYNOPSIS See L. =head1 DESCRIPTION This is a base class for Apache 1.99x and 2.x Engines. =head1 OVERLOADED METHODS This class overloads some methods from C. =over 4 =item finalize_headers =back =head1 SEE ALSO L L. =head1 AUTHORS =over 4 =item * Sebastian Riedel =item * Christian Hansen =item * Andy Grundman =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by The "AUTHORS". 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 TestAppBadlyImmutable.pm000600001750001750 45611452456126 22450 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppBadlyImmutable; use Catalyst qw/+TestPluginWithConstructor/; use Test::More; __PACKAGE__->setup; ok !__PACKAGE__->meta->is_immutable, 'Am not already immutable'; __PACKAGE__->meta->make_immutable( inline_constructor => 0 ); ok __PACKAGE__->meta->is_immutable, 'Am now immutable'; 1; TestAppMatchSingleArg.pm000600001750001750 14011452456126 22373 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppMatchSingleArg; use strict; use warnings; use Catalyst; __PACKAGE__->setup; 1; Foo000711001750001750 011452456126 20735 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/ModelBar.pm000600001750001750 16511452456126 22120 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Model/Foopackage TestApp::Model::Foo::Bar; sub model_foo_bar_method_from_foo_bar { "model_foo_bar_method_from_foo_bar" } 1; Dump000711001750001750 011452456126 20771 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/ViewEnv.pm000600001750001750 27311452456126 22200 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/View/Dumppackage TestApp::View::Dump::Env; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->engine->env ); } 1; RequestBaseBug.pm000600001750001750 27711452456126 22516 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApppackage TestApp::RequestBaseBug; use base 'Catalyst::Request'; sub uri { my $self = shift; # this goes into infinite mutual recursion $self->base; $self->SUPER::uri(@_) } 1; Body.pm000600001750001750 34011452456126 22340 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/View/Dumppackage TestApp::View::Dump::Body; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->request->{_body} ); # FIXME, accessor doesn't work? } 1; mod_perl-non-root.pl000600001750001750 116711452456126 22724 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/optional#!perl # Run all tests against Apache mod_perl # # Note, to get this to run properly, you may need to give it the path to your # httpd.conf: # # perl t/optional/mod_perl-non-root.pl -httpd_conf /etc/apache/httpd.conf # # For debugging, you can start TestApp and leave it running with # perl t/optional/mod_perl.pl -httpd_conf /etc/apache/httpd.conf --start-httpd # # To stop it: # perl t/optional/mod_perl.pl -httpd_conf /etc/apache/httpd.conf --stop-httpd use strict; use warnings; use Apache::Test; use Apache::TestRunPerl (); $ENV{CATALYST_SERVER} = 'http://localhost:8529/deep/path'; Apache::TestRunPerl->new->run(@ARGV); TestAppChainedRecursive.pm000600001750001750 43511452456126 22775 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppChainedRecursive; use strict; use Catalyst qw/ Test::Errors Test::Headers /; use Catalyst::Utils; our $VERSION = '0.01'; TestAppChainedRecursive->config( name => 'TestAppChainedRecursive', root => '/some/dir' ); TestAppChainedRecursive->setup; 1; Controller000711001750001750 011452456126 21275 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppRoot.pm000600001750001750 273111452456126 22720 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Root; use strict; use warnings; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub chain_root_index : Chained('/') PathPart('') Args(0) { } sub zero : Path('0') { my ( $self, $c ) = @_; $c->res->header( 'X-Test-Class' => ref($self) ); $c->response->content_type('text/plain; charset=utf-8'); $c->forward('TestApp::View::Dump::Request'); } sub localregex : LocalRegex('^localregex$') { my ( $self, $c ) = @_; $c->res->header( 'X-Test-Class' => ref($self) ); $c->response->content_type('text/plain; charset=utf-8'); $c->forward('TestApp::View::Dump::Request'); } sub index : Private { my ( $self, $c ) = @_; $c->res->body('root index'); } sub global_action : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub class_forward_test_method :Private { my ( $self, $c ) = @_; $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 ); } sub loop_test : Local { my ( $self, $c ) = @_; for( 1..1001 ) { $c->forward( 'class_forward_test_method' ); } } sub recursion_test : Local { my ( $self, $c ) = @_; $c->forward( 'recursion_test' ); } sub base_href_test : Local { my ( $self, $c ) = @_; my $body = <<"EndOfBody"; EndOfBody $c->response->body($body); } sub end : Private { my ($self,$c) = @_; } 1; Args.pm000600001750001750 42711452456126 22651 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Args; use strict; use base 'Catalyst::Controller'; sub args :Local { my ( $self, $c ) = @_; $c->res->body( join('',@{$c->req->args}) ); } sub params :Local { my ( $self, $c ) = splice @_, 0, 2; $c->res->body( join('',@_) ); } 1; Fork.pm000600001750001750 207611452456126 22700 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller#!/usr/bin/perl # Fork.pm # Copyright (c) 2006 Jonathan Rockway package TestApp::Controller::Fork; use strict; use warnings; use base 'Catalyst::Controller'; eval 'use YAML'; sub system : Local { my ($self, $c, $ls) = @_; my ($result, $code) = (undef, 1); if(!-e $ls || !-x _){ $result = 'skip'; } else { $result = system($ls, $ls, $ls); $result = $! if $result != 0; } $c->response->body(Dump({result => $result})); } sub backticks : Local { my ($self, $c, $ls) = @_; my ($result, $code) = (undef, 1); if(!-e $ls || !-x _){ $result = 'skip'; $code = 0; } else { $result = `$ls $ls $ls` || $!; $code = $?; } $c->response->body(Dump({result => $result, code => $code})); } sub fork : Local { my ($self, $c) = @_; my $pid; my $x = 0; if($pid = fork()){ $x = "ok"; } else { exit(0); } waitpid $pid,0 or die; $c->response->body(Dump({pid => $pid, result => $x})); } 1; Anon.pm000600001750001750 214211452456126 22664 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage Anon::Trait; use Moose::Role -traits => 'MethodAttributes'; # Needed for role composition to work correctly with anon classes. after test => sub { my ($self, $c) = @_; $c->res->header('X-Anon-Trait-Applied', 1); }; no Moose::Role; package TestApp::Controller::Anon; use Moose; use Moose::Util qw/find_meta/; use namespace::clean -except => 'meta'; BEGIN { extends 'Catalyst::Controller' }; sub COMPONENT { # Don't do this yourself, use CatalystX::Component::Traits! my ($class, $app, $args) = @_; my $meta = $class->meta->create_anon_class( superclasses => [ $class->meta->name ], roles => ['Anon::Trait'], cache => 1, ); # Special move as the methodattributes trait has changed our metaclass.. $meta = find_meta($meta->name); $class = $meta->name; $class->new($app, $args); } sub test : Local ActionClass('+TestApp::Action::TestMyAction') { my ($self, $c) = @_; $c->res->header('X-Component-Name-Controller', $self->catalyst_component_name); $c->res->body('It works'); } __PACKAGE__->meta->make_immutable; Dump.pm000600001750001750 133211452456126 22676 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Dump; use strict; use base 'Catalyst::Controller'; sub default : Action { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump'); } sub env : Action Relative { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Env'); } sub request : Action Relative { my ( $self, $c ) = @_; $c->req->params(undef); # Should be a no-op, and be ignored. # Back compat test for 5.7 $c->forward('TestApp::View::Dump::Request'); } sub response : Action Relative { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Response'); } sub body : Action Relative { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Body'); } 1; C000711001750001750 011452456126 21315 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/DeprecatedTestAppRoot.pm000600001750001750 51411452456126 22715 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/DeprecatedTestApp/Cpackage DeprecatedTestApp::C::Root; use strict; use warnings; use base qw/Catalyst::Controller/; __PACKAGE__->config->{namespace} = ''; sub index : Private { my ( $self, $c ) = @_; $c->res->body('root index'); } sub req_user : Local { my ( $self, $c ) = @_; $c->res->body('REMOTE_USER = ' . $c->req->user); } 1; Moose.pm000600001750001750 151011452456126 23051 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Moose; use Moose; use namespace::clean -except => 'meta'; BEGIN { extends qw/Catalyst::Controller/; } use MooseX::MethodAttributes; # FIXME - You need to say this if you have # modifiers so that you get the correct # method metaclass, why does the modifier # on MODIFY_CODE_ATTRIBUTES not work. has attribute => ( is => 'ro', default => 42, ); sub get_attribute : Local { my ($self, $c) = @_; $c->response->body($self->attribute); } sub with_local_modifier : Local { my ($self, $c) = @_; $c->forward('get_attribute'); } before with_local_modifier => sub { my ($self, $c) = @_; $c->response->header( 'X-Catalyst-Test-Before' => 'before called' ); }; 1; Index.pm000600001750001750 25611452456126 23024 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Index; use strict; use base 'Catalyst::Controller'; sub index : Private { my ( $self, $c ) = @_; $c->res->body( 'Index index' ); } 1; Generating.pm000600001750001750 56211452456126 22755 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Modelpackage TestApp::Model::Generating; use Moose; extends 'Catalyst::Model'; sub BUILD { Class::MOP::Class->create( 'TestApp::Model::Generated' => ( methods => { foo => sub { 'foo' } } ) ); } sub expand_modules { return ('TestApp::Model::Generated'); } __PACKAGE__->meta->make_immutable; no Moose; 1; Script000711001750001750 011452456126 21603 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ScriptTestAppFoo.pm000600001750001750 20411452456126 22777 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ScriptTestApp/Scriptpackage ScriptTestApp::Script::Foo; use Moose; use namespace::autoclean; with 'Catalyst::ScriptRole'; sub run { __PACKAGE__ } 1; Bar.pm000600001750001750 20411452456126 22760 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ScriptTestApp/Scriptpackage ScriptTestApp::Script::Bar; use Moose; use namespace::autoclean; with 'Catalyst::ScriptRole'; sub run { __PACKAGE__ } 1; Apache000711001750001750 011452456126 21501 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/EngineMP13.pm000600001750001750 607111452456126 22662 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/Engine/Apachepackage Catalyst::Engine::Apache::MP13; BEGIN { $Catalyst::Engine::Apache::MP13::AUTHORITY = 'cpan:BOBTFISH'; } BEGIN { $Catalyst::Engine::Apache::MP13::VERSION = '1.16'; } # ABSTRACT: Catalyst Apache mod_perl 1.3x Engine use strict; use warnings; use base 'Catalyst::Engine::Apache'; use Apache (); use Apache::Constants qw(OK); use Apache::File (); use Apache::Util (); sub finalize_headers { my ( $self, $c ) = @_; $self->SUPER::finalize_headers( $c ); $self->apache->send_http_header; return 0; } sub ok_constant { Apache::Constants::OK } sub unescape_uri { my $self = shift; # Unlike in mod_perl 2, this method also unescapes '+' to space return Apache::Util::unescape_uri_info(@_); } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Engine::Apache::MP13 - Catalyst Apache mod_perl 1.3x Engine =head1 SYNOPSIS # Set up your Catalyst app as a mod_perl 1.3x application in httpd.conf use lib qw( /var/www/MyApp/lib ); # Preload your entire application PerlModule MyApp ServerName myapp.hostname.com DocumentRoot /var/www/MyApp/root SetHandler perl-script PerlHandler MyApp # you can also run your app in any non-root location SetHandler perl-script PerlHandler MyApp # Make sure to let Apache handle your static files # (And remember to remove the Static::Simple plugin in production) SetHandler default-handler =head1 DESCRIPTION This is the Catalyst engine specialized for Apache mod_perl version 1.3x. =head1 Apache::Registry While this method is not recommended, you can also run your Catalyst application via an Apache::Registry script. httpd.conf: PerlModule Apache::Registry Alias / /var/www/MyApp/script/myapp_registry.pl/ Options +ExecCGI SetHandler perl-script PerlHandler Apache::Registry script/myapp_registry.pl (you will need to create this): #!/usr/bin/perl use strict; use warnings; use MyApp; MyApp->handle_request( Apache->request ); =head1 METHODS =head2 ok_constant =head1 OVERLOADED METHODS This class overloads some methods from C. =head2 $c->engine->finalize_headers =head1 SEE ALSO L, L, L. =head1 AUTHORS =over 4 =item * Sebastian Riedel =item * Christian Hansen =item * Andy Grundman =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by The "AUTHORS". 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 TestAppNonMooseController.pm000600001750001750 14211452456126 23346 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppNonMooseController; use base qw/Catalyst/; use Catalyst; __PACKAGE__->setup; 1; TestPluginWithConstructor.pm000600001750001750 41311452456126 23445 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib# See t/plugin_new_method_backcompat.t package Class::Accessor::Fast; use strict; use warnings; sub new { my $class = shift; return bless $_[0], $class; } package TestPluginWithConstructor; use strict; use warnings; use base qw/Class::Accessor::Fast/; 1; Action.pm000600001750001750 61311452456126 23167 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Action; use strict; use base 'Catalyst::Controller'; sub begin : Private { my ( $self, $c ) = @_; $c->res->header( 'X-Test-Class' => ref($self) ); $c->response->content_type('text/plain; charset=utf-8'); } sub default : Private { my ( $self, $c ) = @_; $c->res->output("Error - TestApp::Controller::Action\n"); $c->res->status(404); } 1; Action000711001750001750 011452456126 20367 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppTestBefore.pm000600001750001750 41511452456126 23106 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Actionpackage TestApp::Action::TestBefore; use strict; use warnings; use base qw/Catalyst::Action/; sub execute { my $self = shift; my ( $controller, $c, $test ) = @_; $c->res->header( 'X-TestAppActionTestBefore', $test ); $self->next::method( @_ ); } 1; Request.pm000600001750001750 27211452456126 23077 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/View/Dumppackage TestApp::View::Dump::Request; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->request ); } 1; Action000711001750001750 011452456126 20573 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/CatalystTestAfter.pm000600001750001750 42011452456126 23145 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Actionpackage Catalyst::Action::TestAfter; use strict; use warnings; use base qw/Catalyst::Action/; sub execute { my $self = shift; my ( $controller, $c ) = @_; $self->next::method( @_ ); $c->res->header( 'X-Action-After', $c->stash->{after_message} ); } 1; View000711001750001750 011452456126 21361 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOneViewDummy.pm000600001750001750 23411452456126 23130 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOneView/Viewpackage TestAppOneView::View::Dummy; use base 'Catalyst::View'; sub COMPONENT { bless {}, 'AClass' } package AClass; use base 'Catalyst::View'; 1; author-live_engine_request_uri.t000600001750001750 1146211452456126 23607 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 49; use Catalyst::Test 'TestApp'; use Catalyst::Request; my $creq; # test that the path can be changed { ok( my $response = request('http://localhost/engine/request/uri/change_path'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); like( $creq->uri, qr{/my/app/lives/here$}, 'URI contains new path' ); } # test that path properly removes the base location { ok( my $response = request('http://localhost/engine/request/uri/change_base'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); like( $creq->base, qr{/new/location}, 'Base URI contains new location' ); is( $creq->path, 'engine/request/uri/change_base', 'URI contains correct path' ); } # test that base + path is correct { ok( my $response = request('http://localhost/engine/request/uri'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->base . $creq->path, $creq->uri, 'Base + Path ok' ); } # test base is correct for HTTPS URLs SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 5; } local $ENV{HTTPS} = 'on'; ok( my $response = request('https://localhost/engine/request/uri'), 'HTTPS Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->base, 'https://localhost/', 'HTTPS base ok' ); is( $creq->uri, 'https://localhost/engine/request/uri', 'HTTPS uri ok' ); } # test that we can use semi-colons as separators { my $parameters = { a => [ qw/1 2/ ], b => 3, }; ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'a=1;a=2;b=3', 'Query string ok' ); is_deeply( $creq->{parameters}, $parameters, 'Parameters ok' ); } # test that query params are unescaped properly { ok( my $response = request('http://localhost/engine/request/uri?text=Catalyst%20Rocks'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' ); is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); } # test that uri_with adds params { ok( my $response = request('http://localhost/engine/request/uri/uri_with'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( !defined $response->header( 'X-Catalyst-Param-a' ), 'param "a" ok' ); is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' ); } # test that uri_with adds params (and preserves) { ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' ); is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' ); } # test that uri_with replaces params (and preserves) { ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' ); is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' ); } # test that uri_with replaces params (and preserves) { ok( my $response = request('http://localhost/engine/request/uri/uri_with_object'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); like( $response->header( 'X-Catalyst-Param-a' ), qr(https?://localhost[^/]*/), 'param "a" ok' ); } # test that uri_with is utf8 safe { ok( my $response = request("http://localhost/engine/request/uri/uri_with_utf8"), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); like( $response->header( 'X-Catalyst-uri-with' ), qr/%E2%98%A0$/, 'uri_with ok' ); } # test with undef -- no warnings should be thrown { ok( my $response = request("http://localhost/engine/request/uri/uri_with_undef"), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' ); } Apache2000711001750001750 011452456126 21563 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/EngineMP19.pm000600001750001750 735211452456126 22755 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/Engine/Apache2package Catalyst::Engine::Apache2::MP19; BEGIN { $Catalyst::Engine::Apache2::MP19::AUTHORITY = 'cpan:BOBTFISH'; } BEGIN { $Catalyst::Engine::Apache2::MP19::VERSION = '1.16'; } # ABSTRACT: Catalyst Apache2 mod_perl 1.99x Engine use strict; use warnings; use base 'Catalyst::Engine::Apache2'; use Apache2 (); use Apache::Connection (); use Apache::Const -compile => qw(OK); use Apache::RequestIO (); use Apache::RequestRec (); use Apache::RequestUtil (); use Apache::Response (); use Apache::URI (); use APR::Table (); sub ok_constant { Apache::OK } sub unescape_uri { my ( $self, $str ) = @_; $str =~ s/\+/ /g; return Apache::URI::unescape_url($str); } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Engine::Apache2::MP19 - Catalyst Apache2 mod_perl 1.99x Engine =head1 SYNOPSIS # Set up your Catalyst app as a mod_perl 1.99x application in httpd.conf PerlSwitches -I/var/www/MyApp/lib # Preload your entire application PerlModule MyApp ServerName myapp.hostname.com DocumentRoot /var/www/MyApp/root SetHandler modperl PerlResponseHandler MyApp # you can also run your app in any non-root location SetHandler perl-script PerlResponseHandler MyApp # Make sure to let Apache handle your static files # (It is not necessary to remove the Static::Simple plugin # in production; Apache will bypass Static::Simple if # configured in this way) SetHandler default-handler # If not running at a root location in a VirtualHost, # you'll probably need to set an Alias to the location # of your static files, and allow access to this location: Alias /myapp/static /filesystem/path/to/MyApp/root/static allow from all SetHandler default-handler =head1 DESCRIPTION This is the Catalyst engine specialized for Apache2 mod_perl version 1.99x. =head1 WARNING mod_perl 1.99 was the beta version for mod_perl 2.0. Upgrading to 2.0 is strongly recommended. =head1 CGI ISSUES In order to run Catalyst under mod_perl 1.99 you will need to downgrade L to version 3.07, as it has dropped support for 1.99 in later versions. =head1 ModPerl::Registry While this method is not recommended, you can also run your Catalyst application via a ModPerl::Registry script. httpd.conf: PerlModule ModPerl::Registry Alias / /var/www/MyApp/script/myapp_registry.pl/ Options +ExecCGI SetHandler perl-script PerlResponseHandler ModPerl::Registry script/myapp_registry.pl (you will need to create this): #!/usr/bin/perl use strict; use warnings; use MyApp; MyApp->handle_request( Apache::RequestUtil->request ); =head1 METHODS =head2 ok_constant =head1 SEE ALSO L, L, L. =head1 AUTHORS =over 4 =item * Sebastian Riedel =item * Christian Hansen =item * Andy Grundman =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by The "AUTHORS". 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 MP20.pm000600001750001750 744311452456126 22746 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/lib/Catalyst/Engine/Apache2package Catalyst::Engine::Apache2::MP20; BEGIN { $Catalyst::Engine::Apache2::MP20::AUTHORITY = 'cpan:BOBTFISH'; } BEGIN { $Catalyst::Engine::Apache2::MP20::VERSION = '1.16'; } # ABSTRACT: Catalyst Apache2 mod_perl 2.x Engine use strict; use warnings; use base 'Catalyst::Engine::Apache2'; use Apache2::Connection (); use Apache2::Const -compile => qw(OK); use Apache2::RequestIO (); use Apache2::RequestRec (); use Apache2::RequestUtil (); use Apache2::Response (); use Apache2::URI (); use APR::Table (); # We can use Apache2::ModSSL to better detect if we're running in SSL mode eval { require Apache2::ModSSL }; sub ok_constant { Apache2::Const::OK } sub unescape_uri { my ( $self, $str ) = @_; $str =~ s/\+/ /g; return Apache2::URI::unescape_url($str); } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Engine::Apache2::MP20 - Catalyst Apache2 mod_perl 2.x Engine =head1 SYNOPSIS # Set up your Catalyst app as a mod_perl 2.x application in httpd.conf PerlSwitches -I/var/www/MyApp/lib # Preload your entire application PerlModule MyApp ServerName myapp.hostname.com DocumentRoot /var/www/MyApp/root SetHandler modperl PerlResponseHandler MyApp # you can also run your app in any non-root location SetHandler perl-script PerlResponseHandler MyApp # Make sure to let Apache handle your static files # (It is not necessary to remove the Static::Simple plugin # in production; Apache will bypass Static::Simple if # configured in this way) SetHandler default-handler # If not running at a root location in a VirtualHost, # you'll probably need to set an Alias to the location # of your static files, and allow access to this location: Alias /myapp/static /filesystem/path/to/MyApp/root/static allow from all SetHandler default-handler =head1 DESCRIPTION This is the Catalyst engine specialized for Apache2 mod_perl version 2.x. =head1 ModPerl::Registry While this method is not recommended, you can also run your Catalyst application via a ModPerl::Registry script. httpd.conf: PerlModule ModPerl::Registry Alias / /var/www/MyApp/script/myapp_registry.pl/ Options +ExecCGI SetHandler perl-script PerlResponseHandler ModPerl::Registry script/myapp_registry.pl (you will need to create this): #!/usr/bin/perl use strict; use warnings; use MyApp; MyApp->handle_request( Apache2::RequestUtil->request ); =head1 METHODS =head2 ok_constant =head1 OVERLOADED METHODS This class overloads some methods from C. =over 4 =item unescape_uri =back =head1 OVERLOADED METHODS This class overloads some methods from C. =over 4 =item unescape_uri =back =head1 SEE ALSO L, L, L. =head1 AUTHORS =over 4 =item * Sebastian Riedel =item * Christian Hansen =item * Andy Grundman =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by The "AUTHORS". 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 TestAppShowInternalActions.pm000600001750001750 65311452456126 23512 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppShowInternalActions; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ -Debug /; # Debug must remain on for # t/live_show_internal_actions_warnings.t extends 'Catalyst'; __PACKAGE__->config( name => 'TestAppShowInternalActions', disable_component_resolution_regex_fallback => 1, show_internal_actions => 1, ); __PACKAGE__->setup(); 1; Controller000711001750001750 011452456126 21615 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ACLTestAppRoot.pm000600001750001750 45411452456126 23220 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ACLTestApp/Controllerpackage ACLTestApp::Controller::Root; use Test::More; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub foobar : Private { die $Catalyst::DETACH; } sub gorch : Local { my ( $self, $c, $frozjob ) = @_; is $frozjob, 'wozzle'; $c->res->body("gorch"); } 1; Keyword.pm000600001750001750 100511452456126 23412 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Keyword; use strict; use base 'Catalyst::Controller'; # # Due to 'actions' being used as an attribute up to cat 5.80003 using this name # for an action causes a weird error, as this would be called during BUILD time # of the Catalyst::Controller class # sub actions : Local { my ( $self, $c ) = @_; die("Call to controller action method without context! Probably naming clash") unless $c; $c->res->output("Test case for using 'actions' as a catalyst action name\n"); } 1; Response.pm000600001750001750 27411452456126 23247 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/View/Dumppackage TestApp::View::Dump::Response; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->response ); } 1; TestBefore.pm000600001750001750 35511452456126 23315 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Actionpackage Catalyst::Action::TestBefore; use strict; use warnings; use base qw/Catalyst::Action/; sub execute { my $self = shift; my ( $controller, $c ) = @_; $c->stash->{test} = 'works'; $self->next::method( @_ ); } 1; author-live_engine_setup_basics.t000600001750001750 72211452456126 23661 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 1; use Catalyst::Test 'TestApp'; SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 1; } # Allow overriding automatic root. is( TestApp->config->{root}, '/some/dir' ); } author-live_engine_request_body.t000600001750001750 431511452456126 23724 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; use Catalyst::Request; use HTTP::Headers; use HTTP::Request::Common; { my $creq; my $request = POST( 'http://localhost/dump/request/', 'Content-Type' => 'text/plain', 'Content' => 'Hello Catalyst' ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/'Catalyst::Request'/, 'Content is a serialized Catalyst::Request' ); { no strict 'refs'; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); } isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' ); is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' ); } { my $creq; my $request = POST( 'http://localhost/dump/request/', 'Content-Type' => 'text/plain', 'Content' => 'x' x 100_000 ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); { no strict 'refs'; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); } isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' ); is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' ); } TestMyAction.pm000600001750001750 76711452456126 23441 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Actionpackage TestApp::Action::TestMyAction; use strict; use warnings; use base qw/Catalyst::Action/; sub execute { my $self = shift; my ( $controller, $c, $test ) = @_; $c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' ); $c->res->header( 'X-Component-Name-Action', $controller->catalyst_component_name); $c->res->header( 'X-Component-Instance-Name-Action', ref($controller)); $c->res->header( 'X-Class-In-Action', $self->class); $self->next::method(@_); } 1; Test000711001750001750 011452456126 21533 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/PluginPlugin.pm000600001750001750 137711452456126 23476 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Plugin/Testpackage Catalyst::Plugin::Test::Plugin; use strict; use warnings; use MRO::Compat; use base qw/Class::Data::Inheritable/; __PACKAGE__->mk_classdata('ran_setup'); sub setup { my $c = shift; $c->ran_setup('1'); } sub prepare { my $class = shift; my $c = $class->next::method(@_); $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup ); return $c; } # Note: Catalyst::Plugin::Server forces the body to # be parsed, by calling the $c->req->body method in prepare_action. # We need to test this, as this was broken by 5.80. See also # t/aggregate/live_engine_request_body.t. sub prepare_action { my $c = shift; $c->res->header('X-Have-Request-Body', 1) if $c->req->body; $c->next::method(@_); } 1; Errors.pm000600001750001750 114511452456126 23505 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Plugin/Testpackage Catalyst::Plugin::Test::Errors; use strict; use MRO::Compat; sub error { my $c = shift; unless ( $_[0] ) { return $c->next::method(@_); } if ( $_[0] =~ /^(Unknown resource|No default action defined)/ ) { $c->response->status(404); } if ( $_[0] =~ /^Couldn\'t forward/ ) { $c->response->status(404); } if ( $_[0] =~ /^Caught exception/ ) { $c->response->status(500); } my $error = $_[0]; $error =~ s/\n/, /g; $c->response->headers->push_header( 'X-Catalyst-Error' => $error ); $c->next::method(@_); } 1; CompileTest.pm000600001750001750 45311452456126 23531 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Scriptpackage Catalyst::Script::CompileTest; use Moose; use namespace::autoclean; use Test::More; with 'Catalyst::ScriptRole'; sub run { __PACKAGE__ } after new_with_options => sub { my ($self, %args) = @_; is_deeply \%args, { application_name => 'ScriptTestApp' }, 'App name correct'; }; 1; mod_perl-locationmatch.pl000711001750001750 127311452456126 23777 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/optional#!perl # Run all tests against Apache mod_perl using a LocationMatch regex block # # Note, to get this to run properly, you may need to give it the path to your # httpd.conf: # # perl t/optional/mod_perl-locationmatch.pl -httpd_conf /etc/apache/httpd.conf # # For debugging, you can start TestApp and leave it running with # perl t/optional/mod_perl-locationmatch.pl -httpd_conf /etc/apache/httpd.conf --start-httpd # # To stop it: # perl t/optional/mod_perl-locationmatch.pl -httpd_conf /etc/apache/httpd.conf --stop-httpd use strict; use warnings; use Apache::Test; use Apache::TestRunPerl (); $ENV{CATALYST_SERVER} = 'http://localhost:8529/match/that'; Apache::TestRunPerl->new->run(@ARGV); author-live_engine_setup_plugins.t000600001750001750 74411452456126 24102 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 2; use Catalyst::Test 'TestApp'; { # Allow overriding automatic root. ok( my $response = request('http://localhost/engine/response/headers/one'), 'Request' ); is( $response->header('X-Catalyst-Plugin-Setup'), '1' ); } TestAppPluginWithConstructor.pm000600001750001750 71011452456126 24106 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib# See t/plugin_new_method_backcompat.t package TestAppPluginWithConstructor; use Test::More; use Test::Exception; use Catalyst qw/+TestPluginWithConstructor/; use Moose; extends qw/Catalyst/; __PACKAGE__->setup; our $MODIFIER_FIRED = 0; lives_ok { before 'dispatch' => sub { $MODIFIER_FIRED = 1 } } 'Can apply method modifier'; no Moose; our $IS_IMMUTABLE_YET = __PACKAGE__->meta->is_immutable; ok !$IS_IMMUTABLE_YET, 'I am not immutable yet'; 1; Immutable.pm000600001750001750 21111452456126 23663 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Immutable; use Moose; BEGIN { extends 'Catalyst::Controller' } no Moose; __PACKAGE__->meta->make_immutable; Action000711001750001750 011452456126 22512 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/ControllerGo.pm000600001750001750 375011452456126 23561 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Go; use strict; use base 'TestApp::Controller::Action'; sub one : Local { my ( $self, $c ) = @_; $c->go('two'); } sub two : Private { my ( $self, $c ) = @_; $c->go('three'); } sub three : Local { my ( $self, $c ) = @_; $c->go( $self, 'four' ); } sub four : Private { my ( $self, $c ) = @_; $c->go('/action/go/five'); } sub five : Local { my ( $self, $c ) = @_; $c->forward('View::Dump::Request'); } sub inheritance : Local { my ( $self, $c ) = @_; $c->go('/action/inheritance/a/b/default'); } sub global : Local { my ( $self, $c ) = @_; $c->go('/global_action'); } sub with_args : Local { my ( $self, $c, $arg ) = @_; $c->go( 'args', [$arg] ); } sub with_method_and_args : Local { my ( $self, $c, $arg ) = @_; $c->go( qw/TestApp::Controller::Action::Go args/, [$arg] ); } sub args : Local { my ( $self, $c, $val ) = @_; die "passed argument does not match args" unless $val eq $c->req->args->[0]; $c->res->body($val); } sub go_die : Local { my ( $self, $c, $val ) = @_; eval { $c->go( 'args', [qq/new/] ) }; $c->res->body( $@ ? $@ : "go() did not die" ); die $Catalyst::GO; } sub go_chained : Local { my ( $self, $c, $val ) = @_; $c->go('/action/chained/foo/spoon', ['captureme'], [qw/arg1 arg2/]); } sub view : Local { my ( $self, $c, $val ) = @_; eval { $c->go('View::Dump') }; $c->res->body( $@ ? $@ : "go() did not die" ); } sub model : Local { my ( $self, $c, $val ) = @_; eval { $c->go('Model::Foo') }; $c->res->body( $@ ? $@ : "go() did not die" ); } sub args_embed_relative : Local { my ( $self, $c ) = @_; $c->go('embed/ok'); } sub args_embed_absolute : Local { my ( $self, $c ) = @_; $c->go('/action/go/embed/ok'); } sub embed : Local { my ( $self, $c, $ok ) = @_; $ok ||= 'not ok'; $c->res->body($ok); } sub class_go_test_action : Local { my ( $self, $c ) = @_; $c->go(qw/TestApp/); } 1; Headers.pm000600001750001750 137011452456126 23604 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Plugin/Testpackage Catalyst::Plugin::Test::Headers; use strict; use MRO::Compat; sub prepare { my $class = shift; my $c = $class->next::method(@_); $c->response->header( 'X-Catalyst-Engine' => $c->engine ); $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 ); { my $components = join( ', ', sort keys %{ $c->components } ); $c->response->header( 'X-Catalyst-Components' => $components ); } { no strict 'refs'; my $plugins = join ', ', $class->registered_plugins; $c->response->header( 'X-Catalyst-Plugins' => $plugins ); } return $c; } sub prepare_action { my $c = shift; $c->next::method(@_); $c->res->header( 'X-Catalyst-Action' => $c->req->action ); } 1; Controller000711001750001750 011452456126 22314 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppStatsRoot.pm000600001750001750 56311452456126 23720 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppStats/Controllerpackage TestAppStats::Controller::Root; use strict; use warnings; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; # Return log messages from previous request sub default : Private { my ( $self, $c ) = @_; $c->stats->profile("test"); $c->res->body(join("\n", @TestAppStats::log_messages)); @TestAppStats::log_messages = (); } 1; author-live_engine_response_large.t000600001750001750 142311452456126 24224 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 6; use Catalyst::Test 'TestApp'; # phaylon noticed that refactored was truncating output on large images. # This test tests 100K and 1M output content. my $expected = { one => 'x' x (100 * 1024), two => 'y' x (1024 * 1024), }; for my $action ( keys %{$expected} ) { ok( my $response = request('http://localhost/engine/response/large/' . $action ), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( length( $response->content ), length( $expected->{$action} ), 'Length OK' ); } Controller000711001750001750 011452456126 22454 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/PluginTestAppRoot.pm000600001750001750 303111452456126 24071 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/PluginTestApp/Controllerpackage PluginTestApp::Controller::Root; use Test::More; use base 'Catalyst::Controller'; #use Catalyst qw( # Test::Plugin # +TestApp::Plugin::FullyQualified # ); __PACKAGE__->config->{namespace} = ''; sub compile_time_plugins : Local { my ( $self, $c ) = @_; isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; isa_ok $c, 'TestApp::Plugin::FullyQualified'; can_ok $c, 'registered_plugins'; $c->_test_plugins; $c->res->body("ok"); } sub run_time_plugins : Local { my ( $self, $c ) = @_; $c->_test_plugins; my $faux_plugin = 'Faux::Plugin'; # Trick perl into thinking the plugin is already loaded $INC{'Faux/Plugin.pm'} = 1; ref($c)->plugin( faux => $faux_plugin ); isa_ok $c, 'Catalyst::Plugin::Test::Plugin'; # applied parameterized role if (eval { require MooseX::Role::Parameterized; 1 }) { can_ok $c, 'affe'; is $c->affe, 'birne', 'right method created by parameterized role'; } isa_ok $c, 'TestApp::Plugin::FullyQualified'; ok !$c->isa($faux_plugin), '... and it should not inherit from the instant plugin'; can_ok $c, 'faux'; is $c->faux->count, 1, '... and it should behave correctly'; is_deeply [ $c->registered_plugins ], [ qw/Catalyst::Plugin::Test::Plugin Faux::Plugin TestApp::Plugin::FullyQualified/ ], 'registered_plugins() should report all plugins'; ok $c->registered_plugins('Faux::Plugin'), '... and even the specific instant plugin'; $c->res->body("ok"); } 1; Plugin000711001750001750 011452456126 20410 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppFullyQualified.pm000600001750001750 23511452456126 24004 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Pluginpackage TestApp::Plugin::FullyQualified; use strict; sub fully_qualified { my $c = shift; $c->stash->{fully_qualified} = 1; return $c; } 1; Attributes.pm000600001750001750 61611452456126 24103 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controlleruse strict; use warnings; package My::AttributesBaseClass; use base qw( Catalyst::Controller ); sub fetch : Chained('/') PathPrefix CaptureArgs(1) { } sub view : PathPart Chained('fetch') Args(0) { } sub foo { # no attributes } package TestApp::Controller::Attributes; use base qw(My::AttributesBaseClass); sub view { # override attributes to "hide" url } sub foo : Local { } 1; Priorities.pm000600001750001750 372311452456126 24130 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::Priorities; use strict; use base 'Catalyst::Controller'; # # Regex vs. Local # sub re_vs_loc_re :Regex('/priorities/re_vs_loc') { $_[1]->res->body( 'regex' ) } sub re_vs_loc :Local { $_[1]->res->body( 'local' ) } # # Regex vs. LocalRegex # sub re_vs_locre_locre :LocalRegex('re_vs_(locre)') { $_[1]->res->body( 'local_regex' ) } sub re_vs_locre_re :Regex('/priorities/re_vs_locre') { $_[1]->res->body( 'regex' ) } # # Regex vs. Path # sub re_vs_path_path :Path('/priorities/re_vs_path') { $_[1]->res->body( 'path' ) } sub re_vs_path_re :Regex('/priorities/re_vs_path') { $_[1]->res->body( 'regex' ) } # # Local vs. LocalRegex # sub loc_vs_locre_locre :LocalRegex('loc_vs_locre') { $_[1]->res->body( 'local_regex' ) } sub loc_vs_locre :Local { $_[1]->res->body( 'local' ) } # # Local vs. Path (depends on definition order) # sub loc_vs_path1_loc :Path('/priorities/loc_vs_path1') { $_[1]->res->body( 'path' ) } sub loc_vs_path1 :Local { $_[1]->res->body( 'local' ) } sub loc_vs_path2 :Local { $_[1]->res->body( 'local' ) } sub loc_vs_path2_loc :Path('/priorities/loc_vs_path2') { $_[1]->res->body( 'path' ) } # # Path vs. LocalRegex # sub path_vs_locre_locre :LocalRegex('path_vs_(locre)') { $_[1]->res->body( 'local_regex' ) } sub path_vs_locre_path :Path('/priorities/path_vs_locre') { $_[1]->res->body( 'path' ) } # # Regex vs. index (has sub controller) # sub re_vs_idx :Regex('/priorities/re_vs_index') { $_[1]->res->body( 'regex' ) } # # Local vs. index (has sub controller) # sub loc_vs_index :Local { $_[1]->res->body( 'local' ) } # # LocalRegex vs. index (has sub controller) # sub locre_vs_idx :LocalRegex('locre_vs_index') { $_[1]->res->body( 'local_regex' ) } # # Path vs. index (has sub controller) # sub path_vs_idx :Path('/priorities/path_vs_index') { $_[1]->res->body( 'path' ) } 1; End.pm000600001750001750 37411452456126 23701 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::End; use strict; use base 'TestApp::Controller::Action'; sub end : Private { my ( $self, $c ) = @_; } sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; author-live_engine_request_uploads.t000600001750001750 1761211452456126 24462 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More; use Catalyst::Test 'TestApp'; use Catalyst::Request; use Catalyst::Request::Upload; use HTTP::Headers; use HTTP::Headers::Util 'split_header_words'; use HTTP::Request::Common; { my $creq; my $request = POST( 'http://localhost/dump/request/', 'Content-Type' => 'form-data', 'Content' => [ 'author-live_engine_request_cookies.t' => ["$FindBin::Bin/author-live_engine_request_cookies.t"], 'author-live_engine_request_headers.t' => ["$FindBin::Bin/author-live_engine_request_headers.t"], 'author-live_engine_request_uploads.t' => ["$FindBin::Bin/author-live_engine_request_uploads.t"], ] ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); { no strict 'refs'; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); } isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is( $creq->content_type, 'multipart/form-data', 'Catalyst::Request Content-Type' ); is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' ); for my $part ( $request->parts ) { my $disposition = $part->header('Content-Disposition'); my %parameters = @{ ( split_header_words($disposition) )[0] }; my $upload = $creq->{uploads}->{ $parameters{filename} }; isa_ok( $upload, 'Catalyst::Request::Upload' ); is( $upload->type, $part->content_type, 'Upload Content-Type' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); # make sure upload is accessible via legacy params->{$file} is( $creq->{parameters}->{ $upload->filename }, $upload->filename, 'legacy param method ok' ); ok( !-e $upload->tempname, 'Upload temp file was deleted' ); } } { my $creq; my $request = POST( 'http://localhost/dump/request/', 'Content-Type' => 'multipart/form-data', 'Content' => [ 'testfile' => ["$FindBin::Bin/author-live_engine_request_cookies.t"], 'testfile' => ["$FindBin::Bin/author-live_engine_request_headers.t"], 'testfile' => ["$FindBin::Bin/author-live_engine_request_uploads.t"], ] ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); { no strict 'refs'; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); } isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is( $creq->content_type, 'multipart/form-data', 'Catalyst::Request Content-Type' ); is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' ); my @parts = $request->parts; for ( my $i = 0 ; $i < @parts ; $i++ ) { my $part = $parts[$i]; my $disposition = $part->header('Content-Disposition'); my %parameters = @{ ( split_header_words($disposition) )[0] }; my $upload = $creq->{uploads}->{ $parameters{name} }->[$i]; isa_ok( $upload, 'Catalyst::Request::Upload' ); is( $upload->type, $part->content_type, 'Upload Content-Type' ); is( $upload->filename, $parameters{filename}, 'Upload filename' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); ok( !-e $upload->tempname, 'Upload temp file was deleted' ); } } { my $creq; my $request = POST( 'http://localhost/engine/request/uploads/slurp', 'Content-Type' => 'multipart/form-data', 'Content' => [ 'slurp' => ["$FindBin::Bin/author-live_engine_request_uploads.t"], ] ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, ( $request->parts )[0]->content, 'Content' ); } { my $request = POST( 'http://localhost/dump/request', 'Content-Type' => 'multipart/form-data', 'Content' => [ 'file' => ["$FindBin::Bin/catalyst_130pix.gif"], ] ); # LWP will auto-correct Content-Length when using a remote server SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 2; } # Sending wrong Content-Length here and see if subequent requests fail $request->header('Content-Length' => $request->header('Content-Length') + 1); ok( my $response = request($request), 'Request' ); ok( !$response->is_success, 'Response Error' ); } $request = POST( 'http://localhost/dump/request', 'Content-Type' => 'multipart/form-data', 'Content' => [ 'file1' => ["$FindBin::Bin/catalyst_130pix.gif"], 'file2' => ["$FindBin::Bin/catalyst_130pix.gif"], ] ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/file1 => bless/, 'Upload with name file1'); like( $response->content, qr/file2 => bless/, 'Upload with name file2'); } { my $creq; my $request = POST( 'http://localhost/dump/request/', 'Content-Type' => 'form-data', 'Content' => [ 'testfile' => 'textfield value', 'testfile' => ["$FindBin::Bin/catalyst_130pix.gif"], ] ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); { no strict 'refs'; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); } isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is( $creq->content_type, 'multipart/form-data', 'Catalyst::Request Content-Type' ); is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' ); my $param = $creq->{parameters}->{testfile}; ok( @$param == 2, '2 values' ); is( $param->[0], 'textfield value', 'correct value' ); like( $param->[1], qr/\Qcatalyst_130pix.gif/, 'filename' ); for my $part ( $request->parts ) { my $disposition = $part->header('Content-Disposition'); my %parameters = @{ ( split_header_words($disposition) )[0] }; next unless exists $parameters{filename}; my $upload = $creq->{uploads}->{ $parameters{name} }; isa_ok( $upload, 'Catalyst::Request::Upload' ); is( $upload->type, $part->content_type, 'Upload Content-Type' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); is( $upload->filename, 'catalyst_130pix.gif' ); } } done_testing; author-live_engine_request_headers.t000600001750001750 533411452456126 24404 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 17; use Catalyst::Test 'TestApp'; use Catalyst::Request; use HTTP::Headers; use HTTP::Request::Common; { my $creq; my $request = GET( 'http://localhost/dump/request', 'User-Agent' => 'MyAgen/1.0', 'X-Whats-Cool' => 'Catalyst', 'X-Multiple' => [ 1 .. 5 ], 'X-Forwarded-Host' => 'frontend.server.com', 'X-Forwarded-For' => '192.168.1.1, 1.2.3.4', ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); isa_ok( $creq, 'Catalyst::Request' ); isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' ); is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' ); { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18 my $excpected = '1, 2, 3, 4, 5'; my $got = $creq->header('X-Multiple'); # HTTP::Headers is context sensitive, "force" scalar context is( $got, $excpected, 'Multiple message-headers are joined as a comma-separated list' ); } is( $creq->header('User-Agent'), $request->header('User-Agent'), 'Catalyst::Request->header User-Agent' ); my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port ); is( $creq->header('Host'), $host, 'Catalyst::Request->header Host' ); SKIP: { if ( $ENV{CATALYST_SERVER} && $ENV{CATALYST_SERVER} !~ /127.0.0.1|localhost/ ) { skip "Using remote server", 2; } is( $creq->base->host, 'frontend.server.com', 'Catalyst::Request proxied base' ); is( $creq->address, '1.2.3.4', 'Catalyst::Request proxied address' ); } SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 4; } # test that we can ignore the proxy support TestApp->config->{ignore_frontend_proxy} = 1; ok( $response = request($request), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->base, 'http://localhost/', 'Catalyst::Request non-proxied base' ); is( $creq->address, '127.0.0.1', 'Catalyst::Request non-proxied address' ); } } author-live_engine_request_cookies.t000600001750001750 307611452456126 24426 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 13; use Catalyst::Test 'TestApp'; use Catalyst::Request; use CGI::Simple::Cookie; use HTTP::Headers; use HTTP::Request::Common; use URI; { my $creq; my $request = GET( 'http://localhost/dump/request', 'Cookie' => 'Catalyst=Cool; Cool=Catalyst', ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/'Catalyst::Request'/, 'Content is a serialized Catalyst::Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); isa_ok( $creq, 'Catalyst::Request' ); isa_ok( $creq->cookies->{Catalyst}, 'CGI::Simple::Cookie', 'Cookie Catalyst' ); is( $creq->cookies->{Catalyst}->name, 'Catalyst', 'Cookie Catalyst name' ); is( $creq->cookies->{Catalyst}->value, 'Cool', 'Cookie Catalyst value' ); isa_ok( $creq->cookies->{Cool}, 'CGI::Simple::Cookie', 'Cookie Cool' ); is( $creq->cookies->{Cool}->name, 'Cool', 'Cookie Cool name' ); is( $creq->cookies->{Cool}->value, 'Catalyst', 'Cookie Cool value' ); my $cookies = { Catalyst => $creq->cookies->{Catalyst}, Cool => $creq->cookies->{Cool} }; is_deeply( $creq->cookies, $cookies, 'Cookies' ); } author-live_engine_response_status.t000600001750001750 466411452456126 24467 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 30; use Catalyst::Test 'TestApp'; { ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->code, 200, 'Response Code' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' ); like( $response->content, qr/^200/, 'Response Content' ); } { ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' ); ok( $response->is_error, 'Response Client Error 4xx' ); is( $response->code, 400, 'Response Code' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' ); like( $response->content, qr/^400/, 'Response Content' ); } { ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' ); ok( $response->is_error, 'Response Client Error 4xx' ); is( $response->code, 403, 'Response Code' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' ); like( $response->content, qr/^403/, 'Response Content' ); } { ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' ); ok( $response->is_error, 'Response Client Error 4xx' ); is( $response->code, 404, 'Response Code' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' ); like( $response->content, qr/^404/, 'Response Content' ); } { ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' ); like( $response->content, qr/^500/, 'Response Content' ); } author-live_engine_response_errors.t000600001750001750 361111452456126 24447 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; close STDERR; # i'm naughty :) { ok( my $response = request('http://localhost/engine/response/errors/one'), 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/errors/one', 'Test Action' ); like( $response->header('X-Catalyst-Error'), qr/^Caught exception/, 'Catalyst Error' ); } { ok( my $response = request('http://localhost/engine/response/errors/two'), 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/errors/two', 'Test Action' ); like( $response->header('X-Catalyst-Error'), qr/^Couldn't forward to/, 'Catalyst Error' ); } { ok( my $response = request('http://localhost/engine/response/errors/three'), 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/errors/three', 'Test Action' ); like( $response->header('X-Catalyst-Error'), qr/I'm going to die!/, 'Catalyst Error' ); } TestAppChainedAbsolutePathPart.pm000600001750001750 51311452456126 24245 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppChainedAbsolutePathPart; use strict; use Catalyst qw/ Test::Errors Test::Headers /; use Catalyst::Utils; our $VERSION = '0.01'; TestAppChainedAbsolutePathPart ->config( name => 'TestAppChainedAbsolutePathPart', root => '/some/dir' ); TestAppChainedAbsolutePathPart->setup; 1; Path.pm000600001750001750 166711452456126 24115 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Path; use strict; use base 'TestApp::Controller::Action'; __PACKAGE__->config( actions => { 'one' => { 'Path' => [ 'a path with spaces' ] }, 'two' => { 'Path' => "åäö" }, 'six' => { 'Local' => undef }, }, ); sub one : Action Path("this_will_be_overriden") { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub two : Action { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub three :Path { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub four : Path( 'spaces_near_parens_singleq' ) { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub five : Path( "spaces_near_parens_doubleq" ) { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub six { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Auto.pm000600001750001750 50711452456126 24101 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Auto; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 1; } sub default : Private { my ( $self, $c ) = @_; $c->res->body( 'default' ); } sub one : Local { my ( $self, $c ) = @_; $c->res->body( 'one' ); } 1; ClosuresInConfig.pm000600001750001750 56111452456126 24105 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Modelpackage TestApp::Model::ClosuresInConfig; use Moose; use namespace::clean -except => 'meta'; extends 'TestApp::Model'; # Note - don't call ->config in here until the constructor calls it to # retrieve config, so that we get the 'copy from parent' path, # and ergo break due to the closure if dclone is used there.. __PACKAGE__->meta->make_immutable; Controller000711001750001750 011452456126 22572 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOneViewRoot.pm000600001750001750 113411452456126 24211 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOneView/Controllerpackage TestAppOneView::Controller::Root; use base 'Catalyst::Controller'; use Scalar::Util (); __PACKAGE__->config->{namespace} = ''; sub view_no_args : Local { my ( $self, $c ) = @_; my $v = $c->view; $c->res->body(Scalar::Util::blessed($v)); } sub view_by_name : Local { my ( $self, $c ) = @_; my $v = $c->view($c->req->param('view')); $c->res->body(Scalar::Util::blessed($v)); } sub view_by_regex : Local { my ( $self, $c ) = @_; my $v_name = $c->req->param('view'); my ($v) = $c->view(qr/$v_name/); $c->res->body(Scalar::Util::blessed($v)); } 1; author-live_engine_response_headers.t000600001750001750 402211452456126 24543 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; use HTTP::Request::Common; my $content_length; foreach my $method qw(HEAD GET) { my $expected = join( ', ', 1 .. 10 ); my $request = HTTP::Request::Common->can($method) ->( 'http://localhost/engine/response/headers/one' ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->code, 200, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/headers/one', 'Test Action' ); is( $response->header('X-Header-Catalyst'), 'Cool', 'Response Header X-Header-Catalyst' ); is( $response->header('X-Header-Cool'), 'Catalyst', 'Response Header X-Header-Cool' ); is( $response->header('X-Header-Numbers'), $expected, 'Response Header X-Header-Numbers' ); use bytes; if ( $method eq 'HEAD' ) { $content_length = $response->header('Content-Length'); ok( $content_length > 0, 'Response Header Content-Length' ); is( length($response->content), 0, 'HEAD method content is empty' ); } elsif ( $method eq 'GET' ) { # method name is echo'd back in content-body, which # accounts for difference in content length. In normal # cases the Content-Length should be the same regardless # of if its a GET or HEAD request. SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 2; } is( $response->header('Content-Length'), $content_length - 1, 'Response Header Content-Length' ); is( length($response->content), $response->header('Content-Length'), 'GET method content' ); } } } author-live_engine_response_cookies.t000600001750001750 446411452456126 24576 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 15; use Catalyst::Test 'TestApp'; use HTTP::Headers::Util 'split_header_words'; my $expected = { catalyst => [qw|catalyst cool path /bah|], cool => [qw|cool catalyst path /|] }; { ok( my $response = request('http://localhost/engine/response/cookies/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/cookies/one', 'Test Action' ); my $cookies = {}; for my $string ( $response->header('Set-Cookie') ) { my $cookie = [ split_header_words $string]; $cookies->{ $cookie->[0]->[0] } = $cookie->[0]; } is_deeply( $cookies, $expected, 'Response Cookies' ); } { ok( my $response = request('http://localhost/engine/response/cookies/two'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); is( $response->code, 302, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/cookies/two', 'Test Action' ); my $cookies = {}; for my $string ( $response->header('Set-Cookie') ) { my $cookie = [ split_header_words $string]; $cookies->{ $cookie->[0]->[0] } = $cookie->[0]; } is_deeply( $cookies, $expected, 'Response Cookies' ); } { ok( my $response = request('http://localhost/engine/response/cookies/three'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'engine/response/cookies/three', 'Test Action' ); my $cookies = {}; for my $string ( $response->header('Set-Cookie') ) { my $cookie = [ split_header_words $string]; $cookies->{ $cookie->[0]->[0] } = $cookie->[0]; } is_deeply( $cookies, { hash => [ qw(hash a&b&c path /) ], this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object" }, 'Response Cookies' ); } TestAppClassExceptionSimpleTest.pm000600001750001750 61611452456126 24511 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage TestAppClassExceptionSimpleTest::Exception; use strict; use warnings; sub throw {} ######### package TestAppClassExceptionSimpleTest; use strict; use warnings; use Catalyst::Utils; #< some of the scripts use Catalyst::Utils before MyApp.pm BEGIN { $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'TestAppClassExceptionSimpleTest::Exception'; } use Catalyst; __PACKAGE__->setup; 1; AddDispatchTypes.pm000600001750001750 124111452456126 24300 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Pluginpackage TestApp::Plugin::AddDispatchTypes; use strict; use warnings; use MRO::Compat; sub setup_dispatcher { my $class = shift; ### Load custom DispatchTypes, as done by Catalyst::Plugin::Server # There should be a waaay less ugly method for doing this, # FIXME in 5.9 $class->next::method( @_ ); $class->dispatcher->preload_dispatch_types( @{$class->dispatcher->preload_dispatch_types}, qw/ +TestApp::DispatchType::CustomPreLoad / ); $class->dispatcher->postload_dispatch_types( @{$class->dispatcher->postload_dispatch_types}, qw/ +TestApp::DispatchType::CustomPostLoad / ); return $class; } 1; Local.pm000600001750001750 123411452456126 24241 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Local; use strict; use base 'TestApp::Controller::Action'; sub one : Action Relative { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub two : Action Local Args(2) { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub three : Action Path('three') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub four : Action Path('four/five/six') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub five : Action Local Args(1) { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Begin.pm000600001750001750 43511452456126 24215 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Begin; use strict; use base 'TestApp::Controller::Action'; sub begin : Private { my ( $self, $c ) = @_; $self->SUPER::begin($c); } sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Index.pm000600001750001750 30411452456126 24233 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Index; use strict; use base 'TestApp::Controller::Action'; sub index : Private { my ( $self, $c ) = @_; $c->res->body( 'Action-Index index' ); } 1; Visit.pm000600001750001750 451211452456126 24307 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Visit; use strict; use base 'TestApp::Controller::Action'; sub one : Local { my ( $self, $c ) = @_; $c->visit('two'); } sub two : Private { my ( $self, $c ) = @_; $c->visit('three'); } sub three : Local { my ( $self, $c ) = @_; $c->visit( $self, 'four' ); } sub four : Private { my ( $self, $c ) = @_; $c->visit('/action/visit/five'); } sub five : Local { my ( $self, $c ) = @_; $c->forward('View::Dump::Request'); } sub inheritance : Local { my ( $self, $c ) = @_; $c->visit('/action/inheritance/a/b/default'); } sub global : Local { my ( $self, $c ) = @_; $c->visit('/global_action'); } sub with_args : Local { my ( $self, $c, $arg ) = @_; $c->visit( 'args', [$arg] ); } sub with_method_and_args : Local { my ( $self, $c, $arg ) = @_; $c->visit( qw/TestApp::Controller::Action::Visit args/, [$arg] ); } sub args : Local { my ( $self, $c, $val ) = @_; die "passed argument does not match args" unless $val eq $c->req->args->[0]; $c->res->body($val); } sub visit_die : Local { my ( $self, $c, $val ) = @_; eval { $c->visit( 'args', [qq/new/] ) }; $c->res->body( $@ ? $@ : "visit() doesn't die" ); } sub visit_chained : Local { my ( $self, $c, $val, $capture, @args ) = @_; my @cap_and_args = ([$capture], [@args]); $val eq 1 ? $c->visit( '/action/chained/foo/spoon', @cap_and_args) : $val eq 2 ? $c->visit( qw/ Action::Chained::Foo spoon /, @cap_and_args) : $c->visit( $c->controller('Action::Chained::Foo')->action_for('spoon'), @cap_and_args) } sub view : Local { my ( $self, $c, $val ) = @_; eval { $c->visit('View::Dump') }; $c->res->body( $@ ? $@ : "visit() did not die" ); } sub model : Local { my ( $self, $c, $val ) = @_; eval { $c->visit('Model::Foo') }; $c->res->body( $@ ? $@ : "visit() did not die" ); } sub args_embed_relative : Local { my ( $self, $c ) = @_; $c->visit('embed/ok'); } sub args_embed_absolute : Local { my ( $self, $c ) = @_; $c->visit('/action/visit/embed/ok'); } sub embed : Local { my ( $self, $c, $ok ) = @_; $ok ||= 'not ok'; $c->res->body($ok); } sub class_visit_test_action : Local { my ( $self, $c ) = @_; $c->visit(qw/TestApp/); } 1; Deprecated.pm000600001750001750 66711452456126 24261 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Plugin/Testpackage Catalyst::Plugin::Test::Deprecated; use strict; use warnings; sub prepare { my $class = shift; # Note: This use of NEXT is deliberately left here (without a use NEXT) # to ensure back compat, as NEXT always used to be loaded, but # is now replaced by Class::C3::Adopt::NEXT. my $c = $class->NEXT::prepare(@_); $c->response->header( 'X-Catalyst-Plugin-Deprecated' => 1 ); return $c; } 1; Controller000711001750001750 011452456126 22703 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOnDemandBody.pm000600001750001750 137411452456126 24302 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppOnDemand/Controllerpackage TestAppOnDemand::Controller::Body; use strict; use base 'Catalyst::Controller'; use Data::Dump (); sub body_params : Local { my ( $self, $c ) = @_; $c->res->body( Data::Dump::dump( $c->req->body_parameters ) ); } sub query_params : Local { my ( $self, $c ) = @_; $c->res->body( Data::Dump::dump( $c->req->query_parameters ) ); } sub params : Local { my ( $self, $c ) = @_; $c->res->body( Data::Dump::dump( $c->req->parameters ) ); } sub read : Local { my ( $self, $c ) = @_; # read some data my @chunks; while ( my $data = $c->read( 10_000 ) ) { push @chunks, $data; } $c->res->content_type( 'text/plain'); $c->res->body( join ( '|', map { length $_ } @chunks ) ); } 1; Controller000711001750001750 011452456126 22744 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppEncodingRoot.pm000600001750001750 231711452456126 24367 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppEncoding/Controllerpackage TestAppEncoding::Controller::Root; use strict; use warnings; use base 'Catalyst::Controller'; use Test::More; __PACKAGE__->config->{namespace} = ''; sub binary : Local { my ($self, $c) = @_; $c->res->body(do { open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; binmode($fh); local $/ = undef; <$fh>; }); } sub binary_utf8 : Local { my ($self, $c) = @_; $c->forward('binary'); my $str = $c->res->body; utf8::upgrade($str); ok utf8::is_utf8($str), 'Body is variable width encoded string'; $c->res->body($str); } # called by t/aggregate/catalyst_test_utf8.t sub utf8_non_ascii_content : Local { use utf8; my ($self, $c) = @_; my $str = 'ʇsʎlɐʇɐɔ'; # 'catalyst' flipped at http://www.revfad.com/flip.html ok utf8::is_utf8($str), '$str is in UTF8 internally'; # encode $str into a sequence of octets and turn off the UTF-8 flag, so that # we don't get the 'Wide character in syswrite' error in Catalyst::Engine utf8::encode($str); ok !utf8::is_utf8($str), '$str is a sequence of octets (byte string)'; $c->res->body($str); } sub end : Private { my ($self,$c) = @_; } 1; Controller000711001750001750 011452456126 22740 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppWithMetaRoot.pm000600001750001750 61011452456126 24335 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppWithMeta/Controllerpackage TestAppWithMeta::Controller::Root; use base qw/Catalyst::Controller/; # N.B. Do not convert to Moose, so we do not # have a metaclass instance! __PACKAGE__->config( namespace => '' ); no warnings 'redefine'; sub meta { 'fnar' } use warnings 'redefine'; sub default : Private { my ($self, $c) = @_; $c->res->body($self->meta); } 1; author-live_engine_response_redirect.t000600001750001750 451211452456126 24735 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 26; use Catalyst::Test 'TestApp'; { ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); is( $response->code, 302, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' ); is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' ); ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' ); ok( $response->content, '302 Redirect contains a response body' ); } { ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); is( $response->code, 302, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' ); is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); } { ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); is( $response->code, 301, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' ); is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' ); ok( $response->content, '301 Redirect contains a response body' ); } { ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); is( $response->code, 307, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' ); is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' ); ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' ); ok( $response->content, '307 Redirect contains a response body' ); } ParameterizedRole.pm000600001750001750 44711452456126 24510 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Pluginpackage TestApp::Plugin::ParameterizedRole; use MooseX::Role::Parameterized; use namespace::autoclean; parameter method_name => ( isa => 'Str', required => 1, ); role { my $p = shift; my $method_name = $p->method_name; method $method_name => sub { 'birne' }; }; 1; Regexp.pm000600001750001750 162211452456126 24442 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Regexp; use strict; use base 'TestApp::Controller::Action'; sub one : Action Regex('^action/regexp/(\w+)/(\d+)$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub two : Action LocalRegexp('^(\d+)/(\w+)$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub three : Action LocalRegex('^(mandatory)(/optional)?$'){ my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub four : Action Regex('^action/regexp/redirect/(\w+)/universe/(\d+)/everything$') { my ( $self, $c ) = @_; $c->res->redirect( $c->uri_for($c->action, $c->req->captures, @{$c->req->arguments}, $c->req->params ) ); } sub one_backslashes : Action Regex('^action/regexp/(\w+)/(\d+)\.html$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Detach.pm000600001750001750 172511452456126 24404 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Detach; use strict; use base 'TestApp::Controller::Action'; sub one : Local { my ( $self, $c ) = @_; $c->detach('two'); $c->forward('error'); } sub two : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub error : Local { my ( $self, $c ) = @_; $c->res->output('error'); } sub path : Local { my ( $self, $c ) = @_; $c->detach('/action/detach/two'); $c->forward('error'); } sub with_args : Local { my ( $self, $c, $orig ) = @_; $c->detach( 'args', [qq/new/] ); } sub with_method_and_args : Local { my ( $self, $c, $orig ) = @_; $c->detach( qw/TestApp::Controller::Action::Detach args/, [qq/new/] ); } sub args : Local { my ( $self, $c, $val ) = @_; die "Expected argument 'new', got '$val'" unless $val eq 'new'; die "passed argument does not match args" unless $val eq $c->req->args->[0]; $c->res->body( $c->req->args->[0] ); } 1; Action.pm000600001750001750 276011452456126 24431 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Action; use strict; use base 'TestApp::Controller::Action'; __PACKAGE__->config( actions => { action_action_five => { ActionClass => '+Catalyst::Action::TestBefore' }, }, action_args => { '*' => { extra_arg => 42 }, action_action_seven => { another_extra_arg => 23 }, }, ); sub action_action_one : Global : ActionClass('TestBefore') { my ( $self, $c ) = @_; $c->res->header( 'X-Action', $c->stash->{test} ); $c->forward('TestApp::View::Dump::Request'); } sub action_action_two : Global : ActionClass('TestAfter') { my ( $self, $c ) = @_; $c->stash->{after_message} = 'awesome'; $c->forward('TestApp::View::Dump::Request'); } sub action_action_three : Global : ActionClass('+TestApp::Action::TestBefore') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub action_action_four : Global : MyAction('TestMyAction') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub action_action_five : Global { my ( $self, $c ) = @_; $c->res->header( 'X-Action', $c->stash->{test} ); $c->forward('TestApp::View::Dump::Request'); } sub action_action_six : Global : ActionClass('~TestMyAction') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub action_action_seven : Global : ActionClass('~TestExtraArgsAction') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Global.pm000600001750001750 74511452456126 24375 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Global; use strict; use base 'TestApp::Controller::Action'; sub action_global_one : Action Absolute { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub action_global_two : Action Global { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub action_global_three : Action Path('/action_global_three') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; CompileTest.pm000600001750001750 15711452456126 24513 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ScriptTestApp/Scriptpackage ScriptTestApp::Script::CompileTest; use Moose; use namespace::autoclean; die("Does not compile"); 1; author-live_engine_request_parameters.t000600001750001750 1037611452456126 25156 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 35; use Catalyst::Test 'TestApp'; use Catalyst::Request; use HTTP::Headers; use HTTP::Request::Common; { my $creq; my $parameters = { 'a' => [qw(A b C d E f G)], }; my $query = join( '&', map { 'a=' . $_ } @{ $parameters->{a} } ); ok( my $response = request("http://localhost/dump/request?$query"), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'GET', 'Catalyst::Request method' ); is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' ); } { my $creq; ok( my $response = request("http://localhost/dump/request?q=foo%2bbar"), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); ok( eval '$creq = ' . $response->content ); is $creq->{parameters}->{q}, 'foo+bar', '%2b not double decoded'; } { my $creq; my $parameters = { 'a' => [qw(A b C d E f G)], '%' => [ '%', '"', '& - &' ], 'blank' => '', }; my $request = POST( 'http://localhost/dump/request/a/b?a=1&a=2&a=3', 'Content' => $parameters, 'Content-Type' => 'application/x-www-form-urlencoded' ); unshift( @{ $parameters->{a} }, 1, 2, 3 ); ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); isa_ok( $creq, 'Catalyst::Request' ); is( $creq->method, 'POST', 'Catalyst::Request method' ); is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' ); is_deeply( $creq->arguments, [qw(a b)], 'Catalyst::Request arguments' ); is_deeply( $creq->{uploads}, {}, 'Catalyst::Request uploads' ); is_deeply( $creq->cookies, {}, 'Catalyst::Request cookie' ); } # http://dev.catalyst.perl.org/ticket/37 # multipart/form-data parameters that contain 'http://' # was an HTTP::Message bug, but HTTP::Body handles it properly now { my $creq; my $parameters = { 'url' => 'http://www.google.com', 'blank' => '', }; my $request = POST( 'http://localhost/dump/request', 'Content-Type' => 'multipart/form-data', 'Content' => $parameters, ); ok( my $response = request($request), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' ); } # raw query string support { my $creq; my $parameters = { a => 1, blank => '', }; my $request = POST( 'http://localhost/dump/request/a/b?query+string', 'Content' => $parameters, 'Content-Type' => 'application/x-www-form-urlencoded' ); ok( my $response = request($request), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'query+string', 'Catalyst::Request POST query_string' ); is( $creq->query_keywords, 'query string', 'Catalyst::Request query_keywords' ); is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' ); ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' ); } author-live_component_controller_args.t000600001750001750 453511452456126 25157 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use URI::Escape; our @paths; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; # add special paths to test here @paths = ( # all reserved in uri's qw~ : / ? [ ] @ ! $ & ' ( ) * + ; = ~, ',' , '#', # unreserved 'a'..'z','A'..'Z',0..9,qw( - . _ ~ ), " ", # just to test %2F/% [ qw~ / / ~ ], # testing %25/%25 [ qw~ % % ~ ], ); } use Test::More tests => 6*@paths * $iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); # new dispatcher: # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157) # old dispatcher (r1486): # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145) } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { run_test_for($_) for @paths; } sub run_test_for { my $test = shift; my $path; if (ref $test) { $path = join "/", map uri_escape($_), @$test; $test = join '', @$test; } else { $path = uri_escape($test); } SKIP: { # Skip %2F, ., [, (, and ) tests on real webservers # Both Apache and lighttpd don't seem to like these if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.|%5B|\(|\))/ ) { skip "Skipping $path tests on remote server", 6; } my $response; ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path"); is( $response->content, $test, "$test as args" ); undef $response; ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path"); is( $response->content, $test, "$test as params" ); undef $response; if( $test =~ m{/} ) { $test =~ s{/}{}g; $path = uri_escape( $test ); } ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path"); is( $response->content, join( ', ', split( //, $test ) ) ."; ", "$test as capture" ); } } Controller000711001750001750 011452456126 23250 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppMetaCompatBase.pm000600001750001750 14111452456126 24573 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppMetaCompat/Controllerpackage TestAppMetaCompat::Controller::Base; use strict; use base qw/Catalyst::Controller/; 1; ContextClosure.pm000600001750001750 123011452456126 24747 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerpackage TestApp::Controller::ContextClosure; use Moose; BEGIN { extends 'Catalyst::Controller'; with 'Catalyst::Component::ContextClosure'; } sub normal_closure : Local { my ($self, $ctx) = @_; $ctx->stash(closure => sub { $ctx->response->body('from normal closure'); }); $ctx->response->body('stashed normal closure'); } sub context_closure : Local { my ($self, $ctx) = @_; $ctx->stash(closure => $self->make_context_closure(sub { my ($ctx) = @_; $ctx->response->body('from context closure'); }, $ctx)); $ctx->response->body('stashed context closure'); } __PACKAGE__->meta->make_immutable; 1; Default.pm000600001750001750 31611452456126 24553 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Default; use strict; use base 'TestApp::Controller::Action'; sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Forward.pm000600001750001750 403111452456126 24611 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Forward; use strict; use base 'TestApp::Controller::Action'; sub one : Local { my ( $self, $c ) = @_; $c->forward('two'); } sub two : Private { my ( $self, $c ) = @_; $c->forward('three'); } sub three : Local { my ( $self, $c ) = @_; $c->forward( $self, 'four' ); } sub four : Private { my ( $self, $c ) = @_; $c->forward('/action/forward/five'); } sub five : Local { my ( $self, $c ) = @_; $c->forward('View::Dump::Request'); } sub jojo : Local { my ( $self, $c ) = @_; $c->forward('one'); $c->forward( $c->controller('Action::Forward'), 'three' ); } sub inheritance : Local { my ( $self, $c ) = @_; $c->forward('/action/inheritance/a/b/default'); $c->forward('five'); } sub global : Local { my ( $self, $c ) = @_; $c->forward('/global_action'); } sub with_args : Local { my ( $self, $c, $orig ) = @_; $c->forward( 'args', [qq/new/] ); $c->res->body( $c->req->args->[0] ); } sub with_method_and_args : Local { my ( $self, $c, $orig ) = @_; $c->forward( qw/TestApp::Controller::Action::Forward args/, [qq/new/] ); $c->res->body( $c->req->args->[0] ); } sub to_action_object : Local { my ( $self, $c ) = @_; $c->forward($self->action_for('embed'), [qw/mtfnpy/]); } sub args : Local { my ( $self, $c, $val ) = @_; die "Expected argument 'new', got '$val'" unless $val eq 'new'; die "passed argument does not match args" unless $val eq $c->req->args->[0]; } sub args_embed_relative : Local { my ( $self, $c ) = @_; $c->forward('embed/ok'); } sub args_embed_absolute : Local { my ( $self, $c ) = @_; $c->forward('/action/forward/embed/ok'); } sub embed : Local { my ( $self, $c, $ok ) = @_; $ok ||= 'not ok'; $c->res->body($ok); } sub class_forward_test_action : Local { my ( $self, $c ) = @_; $c->forward(qw/TestApp class_forward_test_method/); } sub forward_to_uri_check : Local { my ( $self, $c ) = @_; $c->forward( 'Action::ForwardTo', 'uri_check' ); } 1; Private.pm000600001750001750 120411452456126 24616 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Private; use strict; use base 'TestApp::Controller::Action'; sub default : Private { my ( $self, $c ) = @_; $c->res->output('access denied'); } sub one : Private { my ( $self, $c ) = @_; $c->res->output('access allowed'); } sub two : Private { my ( $self, $c ) = @_; $c->res->output('access allowed'); } sub three : Private { my ( $self, $c ) = @_; $c->res->output('access allowed'); } sub four : Private { my ( $self, $c ) = @_; $c->res->output('access allowed'); } sub five : Private { my ( $self, $c ) = @_; $c->res->output('access allowed'); } 1; Chained.pm000600001750001750 1743611452456126 24575 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Chained; use strict; use warnings; use HTML::Entities; use base qw/Catalyst::Controller/; sub begin :Private { } # # TODO # :Chained('') means what? # # # Simple parent/child action test # sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') { my ( $self, $c, @args ) = @_; die "missing argument" unless @args; die "more than 1 argument" if @args > 1; } sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { } # # Parent/child test with two args each # sub foo2 :PathPart('chained/foo2') :CaptureArgs(2) :Chained('/') { } sub endpoint2 :PathPart('end2') :Chained('/action/chained/foo2') :Args(2) { } # # Relative specification of parent action # sub bar :PathPart('chained/bar') :Chained('/') :CaptureArgs(0) { } sub finale :PathPart('') :Chained('bar') :Args { } # # three chain with concurrent endpoints # sub one :PathPart('chained/one') :Chained('/') :CaptureArgs(1) { } sub two :PathPart('two') :Chained('/action/chained/one') :CaptureArgs(2) { } sub three_end :PathPart('three') :Chained('two') :Args(3) { } sub one_end :PathPart('chained/one') :Chained('/') :Args(1) { } sub two_end :PathPart('two') :Chained('one') :Args(2) { } # # Dispatch on number of arguments # sub multi1 :PathPart('chained/multi') :Chained('/') :Args(1) { } sub multi2 :PathPart('chained/multi') :Chained('/') :Args(2) { } # # Roots in an action defined in a higher controller # sub higher_root :PathPart('bar') :Chained('/action/chained/foo/higher_root') :Args(1) { } # # Controller -> subcontroller -> controller # sub pcp1 :PathPart('chained/pcp1') :Chained('/') :CaptureArgs(1) { } sub pcp3 :Chained('/action/chained/foo/pcp2') :Args(1) { } # # Dispatch on capture number # sub multi_cap1 :PathPart('chained/multi_cap') :Chained('/') :CaptureArgs(1) { } sub multi_cap2 :PathPart('chained/multi_cap') :Chained('/') :CaptureArgs(2) { } sub multi_cap_end1 :PathPart('baz') :Chained('multi_cap1') :Args(0) { } sub multi_cap_end2 :PathPart('baz') :Chained('multi_cap2') :Args(0) { } # # Priority: Slurpy args vs. chained actions # sub priority_a1 :PathPart('chained/priority_a') :Chained('/') :Args { } sub priority_a2 :PathPart('chained/priority_a') :Chained('/') :CaptureArgs(1) { } sub priority_a2_end :PathPart('end') :Chained('priority_a2') :Args(1) { } # # Priority: Fixed args vs. chained actions # sub priority_b1 :PathPart('chained/priority_b') :Chained('/') :Args(3) { } sub priority_b2 :PathPart('chained/priority_b') :Chained('/') :CaptureArgs(1) { } sub priority_b2_end :PathPart('end') :Chained('priority_b2') :Args(1) { } # # Priority: With no Args() # sub priority_c1 :PathPart('chained/priority_c') :Chained('/') :CaptureArgs(1) { } sub priority_c2 :PathPart('') :Chained('priority_c1') { } sub priority_c2_xyz :PathPart('xyz') :Chained('priority_c1') { } # # Optional specification of :Args in endpoint # sub opt_args :PathPart('chained/opt_args') :Chained('/') { } # # Optional PathPart test -> /chained/optpp/*/opt_pathpart/* # sub opt_pp_start :Chained('/') :PathPart('chained/optpp') :CaptureArgs(1) { } sub opt_pathpart :Chained('opt_pp_start') :Args(1) { } # # Optional Args *and* PathPart -> /chained/optall/*/oa/... # sub opt_all_start :Chained('/') :PathPart('chained/optall') :CaptureArgs(1) { } sub oa :Chained('opt_all_start') { } # # :Chained is the same as :Chained('/') # sub rootdef :Chained :PathPart('chained/rootdef') :Args(1) { } # # the ParentChain controller chains to this action by # specifying :Chained('.') # sub parentchain :Chained('/') :PathPart('chained/parentchain') :CaptureArgs(1) { } # # This is just for a test that a loose end is not callable # sub loose :Chained :PathPart('chained/loose') CaptureArgs(1) { } # # Forwarding out of the middle of a chain. # sub chain_fw_a :Chained :PathPart('chained/chain_fw') :CaptureArgs(1) { $_[1]->forward( '/action/chained/fw_dt_target' ); } sub chain_fw_b :Chained('chain_fw_a') :PathPart('end') :Args(1) { } # # Detaching out of the middle of a chain. # sub chain_dt_a :Chained :PathPart('chained/chain_dt') :CaptureArgs(1) { $_[1]->detach( '/action/chained/fw_dt_target' ); } sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { } # # Target for former forward and chain tests. # sub fw_dt_target :Private { } # # Test multiple chained actions with no captures # sub empty_chain_a : Chained('/') PathPart('chained/empty') CaptureArgs(0) { } sub empty_chain_b : Chained('empty_chain_a') PathPart('') CaptureArgs(0) { } sub empty_chain_c : Chained('empty_chain_b') PathPart('') CaptureArgs(0) { } sub empty_chain_d : Chained('empty_chain_c') PathPart('') CaptureArgs(1) { } sub empty_chain_e : Chained('empty_chain_d') PathPart('') CaptureArgs(0) { } sub empty_chain_f : Chained('empty_chain_e') PathPart('') Args(1) { } sub mult_nopp_base : Chained('/') PathPart('chained/mult_nopp') CaptureArgs(0) { } sub mult_nopp_all : Chained('mult_nopp_base') PathPart('') Args(0) { } sub mult_nopp_new : Chained('mult_nopp_base') PathPart('new') Args(0) { } sub mult_nopp_id : Chained('mult_nopp_base') PathPart('') CaptureArgs(1) { } sub mult_nopp_idall : Chained('mult_nopp_id') PathPart('') Args(0) { } sub mult_nopp_idnew : Chained('mult_nopp_id') PathPart('new') Args(0) { } # # Test Choice between branches and early return logic # Declaration order is important for $children->{$*}, since this is first match best. # sub cc_base : Chained('/') PathPart('chained/choose_capture') CaptureArgs(0) { } sub cc_link : Chained('cc_base') PathPart('') CaptureArgs(0) { } sub cc_anchor : Chained('cc_link') PathPart('anchor.html') Args(0) { } sub cc_all : Chained('cc_base') PathPart('') Args() { } sub cc_a : Chained('cc_base') PathPart('') CaptureArgs(1) { } sub cc_a_link : Chained('cc_a') PathPart('a') CaptureArgs(0) { } sub cc_a_anchor : Chained('cc_a_link') PathPart('') Args() { } sub cc_b : Chained('cc_base') PathPart('b') CaptureArgs(0) { } sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { } sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { } # # Test static paths vs. captures # sub apan : Chained('/') CaptureArgs(0) PathPrefix { } sub korv : Chained('apan') CaptureArgs(0) PathPart('') { } sub wurst : Chained('apan') CaptureArgs(1) PathPart('') { } sub static_end : Chained('korv') Args(0) { } sub capture_end : Chained('wurst') Args(0) PathPart('') { } # */search vs doc/* sub view : Chained('/') PathPart('chained') CaptureArgs(1) {} sub star_search : Chained('view') PathPart('search') Args(0) { } sub doc_star : Chained('/') PathPart('chained/doc') Args(1) {} sub return_arg : Chained('view') PathPart('return_arg') Args(1) {} sub return_arg_decoded : Chained('/') PathPart('chained/return_arg_decoded') Args(1) { my ($self, $c) = @_; $c->req->args([ map { decode_entities($_) } @{ $c->req->args }]); } sub roundtrip_urifor : Chained('/') PathPart('chained/roundtrip_urifor') CaptureArgs(1) {} sub roundtrip_urifor_end : Chained('roundtrip_urifor') PathPart('') Args(1) { my ($self, $c) = @_; # This should round-trip, always - i.e. the uri you put in should come back out. $c->res->body($c->uri_for($c->action, $c->req->captures, @{$c->req->args}, $c->req->parameters)); $c->stash->{no_end} = 1; } sub end :Private { my ($self, $c) = @_; return if $c->stash->{no_end}; my $out = join('; ', map { join(', ', @$_) } ($c->req->captures, $c->req->args)); $c->res->body($out); } 1; Controller000711001750001750 011452456126 23232 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ChainedActionsAppRoot.pm000600001750001750 337111452456126 24656 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/ChainedActionsApp/Controllerpackage ChainedActionsApp::Controller::Root; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller' } # # Sets the actions in this controller to be registered with no prefix # so they function identically to actions created in MyApp.pm # __PACKAGE__->config(namespace => ''); sub setup : Chained('/') PathPart('') CaptureArgs(0) { my ( $self, $c ) = @_; # Common things here are to check for ACL and setup global contexts } sub home : Chained('setup') PathPart('') Args(0) { my($self,$c) = @_; $c->response->body( "Application Home Page" ); } sub home_base : Chained('setup') PathPart('') CaptureArgs(2) { my($self,$c,$proj_id,$title) = @_; $c->stash({project_id=>$proj_id, project_title=>$title}); } sub hpages : Chained('home_base') PathPart('') Args(0) { my($self,$c) = @_; $c->response->body( "List project " . $c->stash->{project_title} . " pages"); } sub hpage : Chained('home_base') PathPart('') Args(2) { my($self,$c,$page_id, $pagetitle) = @_; $c->response->body( "This is $pagetitle page of " . $c->stash->{project_title} . " project" ); } sub no_account : Chained('setup') PathPart('account') Args(0) { my($self,$c) = @_; $c->response->body( "New account o login" ); } sub account_base : Chained('setup') PathPart('account') CaptureArgs(1) { my($self,$c,$acc_id) = @_; $c->stash({account_id=>$acc_id}); } sub account : Chained('account_base') PathPart('') Args(0) { my($self,$c,$acc) = @_; $c->response->body( "This is account " . $c->stash->{account_id} ); } sub default : Chained('setup') PathPart('') Args() { my ( $self, $c ) = @_; $c->response->body( 'Page not found' ); $c->response->status(404); } sub end : Action {} __PACKAGE__->meta->make_immutable; 1; author-live_engine_request_body_demand.t000600001750001750 344411452456126 25236 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 8; use Catalyst::Test 'TestAppOnDemand'; use Catalyst::Request; use HTTP::Headers; use HTTP::Request::Common; # Test a simple POST request to make sure body parsing # works in on-demand mode. SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 8; } { my $params; my $request = POST( 'http://localhost/body/params', 'Content-Type' => 'application/x-www-form-urlencoded', 'Content' => 'foo=bar&baz=quux' ); my $expected = { foo => 'bar', baz => 'quux' }; ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); { no strict 'refs'; ok( eval '$params = ' . $response->content, 'Unserialize params' ); } is_deeply( $params, $expected, 'Catalyst::Request body parameters' ); } # Test reading chunks of the request body using $c->read { my $creq; my $request = POST( 'http://localhost/body/read', 'Content-Type' => 'text/plain', 'Content' => 'x' x 105_000 ); my $expected = '10000|10000|10000|10000|10000|10000|10000|10000|10000|10000|5000'; ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, $expected, 'Response Content' ); } } DeprecatedActionsInAppClassTestApp.pm000600001750001750 111711452456126 25067 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libpackage DeprecatedActionsInAppClassTestApp; use strict; use warnings; use Catalyst; our $VERSION = '0.01'; __PACKAGE__->config( name => 'DeprecatedActionsInAppClassTestApp', root => '/some/dir' ); __PACKAGE__->log(DeprecatedActionsInAppClassTestApp::Log->new); __PACKAGE__->setup; sub foo : Local { my ($self, $c) = @_; $c->res->body('OK'); } package DeprecatedActionsInAppClassTestApp::Log; use strict; use warnings; use base qw/Catalyst::Log/; our $warnings; sub warn { my ($self, $warning) = @_; $warnings++ if $warning =~ /action methods .+ found defined/i; } 1; Books.pm000600001750001750 20611452456126 25000 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppMetaCompat/Controllerpackage TestAppMetaCompat::Controller::Books; use strict; use base qw/TestAppMetaCompat::Controller::Base/; sub edit : Local {} 1; TestExtraArgsAction.pm000600001750001750 60411452456126 24742 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Actionpackage TestApp::Action::TestExtraArgsAction; use Moose; use namespace::autoclean; extends 'Catalyst::Action'; has [qw/extra_arg another_extra_arg/] => (is => 'ro'); after execute => sub { my ($self, $controller, $ctx) = @_; $ctx->response->header('X-TestExtraArgsAction' => join q{,} => $self->extra_arg, $self->another_extra_arg); }; __PACKAGE__->meta->make_immutable; 1; DispatchType000711001750001750 011452456126 21553 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppCustomPreLoad.pm000600001750001750 24011452456126 24745 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/DispatchTypepackage TestApp::DispatchType::CustomPreLoad; use strict; use warnings; use base qw/Catalyst::DispatchType::Path/; # Never match anything.. sub match { } 1; ForwardTo.pm000600001750001750 32411452456126 25075 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::ForwardTo; use strict; use base 'TestApp::Controller::Action'; sub uri_check : Private { my ( $self, $c ) = @_; $c->res->body( $c->uri_for('foo/bar')->path ); } 1; Streaming.pm000600001750001750 145011452456126 25140 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Streaming; use strict; use base 'TestApp::Controller::Action'; sub streaming : Global { my ( $self, $c ) = @_; for my $line ( split "\n", <<'EOF' ) { foo bar baz EOF $c->res->write("$line\n"); } } sub body : Local { my ( $self, $c ) = @_; my $file = "$FindBin::Bin/lib/TestApp/Controller/Action/Streaming.pm"; my $fh = IO::File->new( $file, 'r' ); if ( defined $fh ) { $c->res->body( $fh ); } else { $c->res->body( "Unable to read $file" ); } } sub body_large : Local { my ($self, $c) = @_; # more than one write with the default chunksize my $size = 128 * 1024; my $data = "\0" x $size; open my $fh, '<', \$data; $c->res->content_length($size); $c->res->body($fh); } 1; Auto000711001750001750 011452456126 23422 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/ActionDeep.pm000600001750001750 52711452456126 24760 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Autopackage TestApp::Controller::Action::Auto::Deep; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 1; } sub default : Private { my ( $self, $c ) = @_; $c->res->body( 'deep default' ); } sub one : Local { my ( $self, $c ) = @_; $c->res->body( 'deep one' ); } 1; CustomPostLoad.pm000600001750001750 24111452456126 25145 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/DispatchTypepackage TestApp::DispatchType::CustomPostLoad; use strict; use warnings; use base qw/Catalyst::DispatchType::Path/; # Never match anything.. sub match { } 1; Controller000711001750001750 011452456126 23641 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppViewWarningsRoot.pm000600001750001750 55111452456126 25242 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppViewWarnings/Controllerpackage TestAppViewWarnings::Controller::Root; use strict; use warnings; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; # Return log messages from previous request sub index :Path Args() {} sub end : Action { my ($self, $c) = @_; $c->view; # Cause view lookup and ergo warning we are testing. $c->res->body('foo'); } 1; Controller000711001750001750 011452456126 23572 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppIndexDefaultRoot.pm000600001750001750 46511452456126 25177 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppIndexDefault/Controllerpackage TestAppIndexDefault::Controller::Root; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub default : Private { my ($self, $c) = @_; $c->res->body('default'); } sub path_one_arg : Path('/') Args(1) { my ($self, $c) = @_; $c->res->body('path_one_arg'); } 1; Abort.pm000600001750001750 70311452456126 25146 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Autopackage TestApp::Controller::Action::Auto::Abort; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 0; } sub default : Private { my ( $self, $c ) = @_; $c->res->body( 'abort default' ); } sub end : Private { my ( $self, $c ) = @_; $c->res->body( 'abort end' ) unless $c->res->body; } sub one : Local { my ( $self, $c ) = @_; $c->res->body( 'abort one' ); } 1; Controller000711001750001750 011452456126 23717 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppDoubleAutoBugRoot.pm000600001750001750 61511452456126 25321 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppDoubleAutoBug/Controllerpackage TestAppDoubleAutoBug::Controller::Root; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub auto : Private { my ( $self, $c ) = @_; ++$c->stash->{auto_count}; return 1; } sub default : Private { my ( $self, $c ) = @_; $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} ); } sub end : Private { my ($self,$c) = @_; } 1; Controller000711001750001750 011452456126 24046 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppMatchSingleArgRoot.pm000600001750001750 65011452456126 25447 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppMatchSingleArg/Controllerpackage TestAppMatchSingleArg::Controller::Root; use strict; use warnings; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub match_single : Path Args(1) { my ($self, $c) = @_; $c->res->body('Path Args(1)'); } sub match_other : Path { my ($self, $c) = @_; $c->res->body('Path'); } sub match_two : Path Args(2) { my ($self, $c) = @_; $c->res->body('Path Args(2)'); } 1; Moose000711001750001750 011452456126 22357 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/ControllerNoAttributes.pm000600001750001750 31411452456126 25455 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Moosepackage TestApp::Controller::Moose::NoAttributes; use Moose; extends qw/Catalyst::Controller/; __PACKAGE__->config( actions => { test => { Local => undef } } ); sub test { } no Moose; 1; Request000711001750001750 011452456126 24132 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/EngineURI.pm000600001750001750 523711452456126 25275 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Requestpackage TestApp::Controller::Engine::Request::URI; use strict; use base 'Catalyst::Controller'; sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub change_path : Local { my ( $self, $c ) = @_; # change the path $c->req->path( '/my/app/lives/here' ); $c->forward('TestApp::View::Dump::Request'); } sub change_base : Local { my ( $self, $c ) = @_; # change the base and uri paths $c->req->base->path( '/new/location' ); $c->req->uri->path( '/new/location/engine/request/uri/change_base' ); $c->forward('TestApp::View::Dump::Request'); } sub uri_with : Local { my ( $self, $c ) = @_; # change the current uri my $uri = $c->req->uri_with( { b => 1, c => undef } ); my %query = $uri->query_form; $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); $c->res->header( 'X-Catalyst-Param-b' => $query{ b } ); $c->res->header( 'X-Catalyst-Param-c' => exists($query{ c }) ? $query{ c } : '--notexists--' ); $c->res->header( 'X-Catalyst-query' => $uri->query); $c->forward('TestApp::View::Dump::Request'); } sub uri_with_object : Local { my ( $self, $c ) = @_; my $uri = $c->req->uri_with( { a => $c->req->base } ); my %query = $uri->query_form; $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); $c->forward('TestApp::View::Dump::Request'); } sub uri_with_utf8 : Local { my ( $self, $c ) = @_; # change the current uri my $uri = $c->req->uri_with( { unicode => "\x{2620}" } ); $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); $c->forward('TestApp::View::Dump::Request'); } sub uri_with_undef : Local { my ( $self, $c ) = @_; my $warnings = 0; local $SIG{__WARN__} = sub { $warnings++ }; # change the current uri my $uri = $c->req->uri_with( { foo => undef } ); $c->res->header( 'X-Catalyst-warnings' => $warnings ); $c->forward('TestApp::View::Dump::Request'); } sub uri_with_undef_only : Local { my ( $self, $c ) = @_; my $uri = $c->req->uri_with( { a => undef } ); $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); $c->forward('TestApp::View::Dump::Request'); } sub uri_with_undef_ignore : Local { my ( $self, $c ) = @_; my $uri = $c->req->uri_with( { a => 1, b => undef } ); my %query = $uri->query_form; $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); $c->res->header( 'X-Catalyst-Param-b' => $query{ b } ); $c->res->header( 'X-Catalyst-Param-c' => $query{ c } ); $c->forward('TestApp::View::Dump::Request'); } 1; Inheritance.pm000600001750001750 264211452456126 25444 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::Inheritance; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 1; } sub begin : Private { my ( $self, $c ) = @_; $self->SUPER::begin($c); } sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub end : Private { my ( $self, $c ) = @_; } package TestApp::Controller::Action::Inheritance::A; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 1; } sub begin : Private { my ( $self, $c ) = @_; $self->SUPER::begin($c); } sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub end : Private { my ( $self, $c ) = @_; } package TestApp::Controller::Action::Inheritance::A::B; use strict; use base 'TestApp::Controller::Action'; sub auto : Private { my ( $self, $c ) = @_; return 1; } sub begin : Private { my ( $self, $c ) = @_; $self->SUPER::begin($c); } sub default : Private { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub end : Private { my ( $self, $c ) = @_; } package TestApp::Controller::Action::Inheritance::B; use strict; use base 'TestApp::Controller::Action'; # check configuration for an inherited action __PACKAGE__->config( action => { begin => {} } ); 1; Chained000711001750001750 011452456126 24045 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/ActionFoo.pm000600001750001750 153611452456126 25272 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::Foo; use strict; use warnings; use base qw/Catalyst::Controller/; # # Child of current namespace # sub spoon :Chained('.') :Args(0) { } # # Root for a action in a "parent" controller # sub higher_root :PathPart('chained/higher_root') :Chained('/') :CaptureArgs(1) { } # # Parent controller -> this subcontroller -> parent controller test # sub pcp2 :Chained('/action/chained/pcp1') :CaptureArgs(1) { } # # Controllers not in parent/child relation. This tests the end. # sub cross2 :PathPart('end') :Chained('/action/chained/bar/cross1') :Args(1) { } # # Create a uri to the root index # sub to_root : Chained('/') PathPart('action/chained/to_root') { my ( $self, $c ) = @_; my $uri = $c->uri_for_action('/chain_root_index'); $c->res->body( "URI:$uri" ); $c->stash->{no_end}++; } 1; Bar.pm000600001750001750 45011452456126 25225 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::Bar; use strict; use warnings; use base qw/Catalyst::Controller/; # # Redispatching between controllers that are not in a parent/child # relation. This is the root. # sub cross1 :PathPart('chained/cross') :CaptureArgs(1) :Chained('/') { } 1; TestRelative.pm000600001750001750 143711452456126 25627 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::TestRelative; use strict; use base 'TestApp::Controller::Action'; __PACKAGE__->config( path => 'action/relative' ); sub relative : Local { my ( $self, $c ) = @_; $c->forward('/action/forward/one'); } sub relative_two : Local { my ( $self, $c ) = @_; $c->forward( 'TestApp::Controller::Action::Forward', 'one' ); } sub relative_go : Local { my ( $self, $c ) = @_; $c->go('/action/go/one'); } sub relative_go_two : Local { my ( $self, $c ) = @_; $c->go( 'TestApp::Controller::Action::Go', 'one' ); } sub relative_visit : Local { my ( $self, $c ) = @_; $c->visit('/action/visit/one'); } sub relative_visit_two : Local { my ( $self, $c ) = @_; $c->visit( 'TestApp::Controller::Action::Visit', 'one' ); } 1; Default.pm000600001750001750 57411452456126 25471 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Autopackage TestApp::Controller::Action::Auto::Default; use strict; use base 'TestApp::Controller::Action'; sub begin : Private { } sub auto : Private { my ( $self, $c ) = @_; $c->stash->{auto_ran}++; return 1; } sub default : Private { my ( $self, $c ) = @_; $c->res->body( sprintf 'default (auto: %d)', $c->stash->{auto_ran} ); } sub end : Private { } 1; Root.pm000600001750001750 45411452456126 25450 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::Root; use strict; use warnings; use base qw( Catalyst::Controller ); __PACKAGE__->config->{namespace} = ''; sub rootsub : PathPart Chained( '/' ) CaptureArgs( 1 ) { } sub endpointsub : PathPart Chained( 'rootsub' ) Args( 1 ) { } 1; Auto.pm000600001750001750 132611452456126 25454 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::Auto; use warnings; use strict; use base qw( Catalyst::Controller ); # # Provided for sub-auto tests. This just always returns true. # sub auto : Private { 1 } # # Simple chains with auto actions returning 1 and 0 # sub foo : Chained PathPart('chained/autochain1') CaptureArgs(1) { } sub bar : Chained PathPart('chained/autochain2') CaptureArgs(1) { } # # Detaching out of an auto action. # sub dt1 : Chained PathPart('chained/auto_detach') CaptureArgs(1) { } # # Forwarding out of an auto action. # sub fw1 : Chained PathPart('chained/auto_forward') CaptureArgs(1) { } # # Target for dispatch and forward tests. # sub fw3 : Private { } 1; Controller000711001750001750 011452456126 24441 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppChainedRecursiveFoo.pm000600001750001750 31611452456126 25641 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppChainedRecursive/Controllerpackage TestAppChainedRecursive::Controller::Foo; use strict; use warnings; use base qw/Catalyst::Controller/; sub foo : Chained('bar') CaptureArgs(1) { } sub bar : Chained('foo') CaptureArgs(1) { } 1; Default.pm000600001750001750 45011452456126 25632 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppIndexDefault/Controllerpackage TestAppIndexDefault::Controller::Default; use base 'Catalyst::Controller'; sub default : Private { my ($self, $c) = @_; $c->res->body('default_default'); } sub path_one_arg : Path('/default/') Args(1) { my ($self, $c) = @_; $c->res->body('default_path_one_arg'); } 1; author-live_component_controller_action_end.t000600001750001750 301511452456126 26316 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 7*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::End->begin TestApp::Controller::Action::End->default TestApp::View::Dump::Request->process TestApp::Controller::Action::End->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/end'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::End', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } } TestMultipath.pm000600001750001750 56611452456126 26005 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Actionpackage TestApp::Controller::Action::TestMultipath; use strict; use base 'TestApp::Controller::Action'; __PACKAGE__->config( namespace => 'action/multipath' ); sub multipath : Local : Global : Path('/multipath1') : Path('multipath2') { my ( $self, $c ) = @_; for my $line ( split "\n", <<'EOF' ) { foo bar baz EOF $c->res->write("$line\n"); } } 1; author-live_component_controller_action_path.t000600001750001750 774211452456126 26517 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 30*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action/path/a%20path%20with%20spaces'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/path/a%20path%20with%20spaces', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Path', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/path/åäö'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/path/%C3%A5%C3%A4%C3%B6', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Path', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/path/'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/path', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Path', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/path/spaces_near_parens_singleq'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/path/spaces_near_parens_singleq', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Path', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/path/spaces_near_parens_doubleq'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/path/spaces_near_parens_doubleq', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Path', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } } author-live_component_controller_action_auto.t000600001750001750 1073711452456126 26551 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 18*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); # new dispatcher: # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157) # old dispatcher (r1486): # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145) } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { # test auto + local method { my @expected = qw[ TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->one TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'one', 'Content OK' ); } # test auto + default { my @expected = qw[ TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->default TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'default', 'Content OK' ); } # test auto + auto + local { my @expected = qw[ TestApp::Controller::Action::Auto::Deep->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->one TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'deep one', 'Content OK' ); } # test auto + auto + default { my @expected = qw[ TestApp::Controller::Action::Auto::Deep->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->default TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'deep default', 'Content OK' ); } # test auto + failing auto + local + end { my @expected = qw[ TestApp::Controller::Action::Auto::Abort->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Abort->auto TestApp::Controller::Action::Auto::Abort->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'abort end', 'Content OK' ); } # test auto + default (bug on invocation of default twice) { my @expected = qw[ TestApp::Controller::Action::Auto::Default->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Default->auto TestApp::Controller::Action::Auto::Default->default TestApp::Controller::Action::Auto::Default->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/auto/default/moose'), 'auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'default (auto: 1)', 'Content OK' ); } } MethodModifiers.pm000600001750001750 36711452456126 26124 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Moosepackage TestApp::Controller::Moose::MethodModifiers; use Moose; BEGIN { extends qw/TestApp::Controller::Moose/; } after get_attribute => sub { my ($self, $c) = @_; $c->response->header( 'X-Catalyst-Test-After' => 'after called' ); }; 1; Response000711001750001750 011452456126 24300 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/EnginePrint.pm000600001750001750 57411452456126 26057 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Print; use strict; use base 'Catalyst::Controller'; sub one :Relative { my ( $self, $c ) = @_; $c->res->print("foo"); } sub two :Relative { my ( $self, $c ) = @_; $c->res->print(qw/foo bar/); } sub three :Relative { my ( $self, $c ) = @_; local $, = ','; $c->res->print(qw/foo bar baz/); } 1; Large.pm000600001750001750 44611452456126 26013 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Large; use strict; use base 'Catalyst::Controller'; sub one : Relative { my ( $self, $c ) = @_; $c->res->output( 'x' x (100 * 1024) ); } sub two : Relative { my ( $self, $c ) = @_; $c->res->output( 'y' x (1024 * 1024) ); } 1; TestAppNonMooseController000711001750001750 011452456126 22674 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/libControllerBase.pm000600001750001750 13311452456126 26264 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppNonMooseControllerpackage TestAppNonMooseController::ControllerBase; use base qw/Catalyst::Controller/; 1; Controller000711001750001750 011452456126 25017 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppNonMooseControllerFoo.pm000600001750001750 16111452456126 26215 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppNonMooseController/Controllerpackage TestAppNonMooseController::Controller::Foo; use base qw/TestAppNonMooseController::ControllerBase/; 1; author-live_component_controller_action_local.t000600001750001750 1026011452456126 26662 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 32*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action/local/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/local/one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Local', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/local/two/1/2'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/local/two', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Local', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/local/two'), 'Request' ); ok( !$response->is_success, 'Request with wrong number of args failed' ); } { ok( my $response = request('http://localhost/action/local/three'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/local/three', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Local', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/local/four/five/six'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/local/four/five/six', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Local', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "tests for %2F on remote server", 6; } ok( my $response = request('http://localhost/action/local/one/foo%2Fbar'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/local/one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Local', 'Test Class' ); like( $response->content, qr~arguments => \[\s*'foo/bar'\s*\]~, "Parameters don't split on %2F" ); } } author-live_component_controller_action_index.t000600001750001750 654311452456126 26670 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 20*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { # test root index { my @expected = qw[ TestApp::Controller::Root->index TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/'), 'root index' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'root index', 'root index ok' ); ok( $response = request('http://localhost'), 'root index no slash' ); is( $response->content, 'root index', 'root index no slash ok' ); } # test first-level controller index { my @expected = qw[ TestApp::Controller::Index->index TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/index/'), 'first-level controller index' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'Index index', 'first-level controller index ok' ); ok( $response = request('http://localhost/index'), 'first-level controller index no slash' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'Index index', 'first-level controller index no slash ok' ); } # test second-level controller index { my @expected = qw[ TestApp::Controller::Action::Index->begin TestApp::Controller::Action::Index->index TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'Action-Index index', 'second-level controller index ok' ); ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' ); } # test controller default when index is present { my @expected = qw[ TestApp::Controller::Action::Index->begin TestApp::Controller::Action::Index->default TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/index/foo'), 'default with index' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' ); } } author-live_component_controller_action_begin.t000600001750001750 275211452456126 26643 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 7*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::Begin->begin TestApp::Controller::Action::Begin->default TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/begin'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Begin', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/'Catalyst::Request'/, 'Content is a serialized Catalyst::Request' ); } } Priorities000711001750001750 011452456126 23426 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controllerre_vs_index.pm000600001750001750 23411452456126 26407 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Prioritiespackage TestApp::Controller::Priorities::re_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; MultiMethod.pm000600001750001750 54511452456126 26342 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Prioritiespackage TestApp::Controller::Priorities::MultiMethod; use strict; use warnings; use base qw/Catalyst::Controller/; sub auto :Private { my ($self, $c) = @_; $c->res->body(join(' ', $c->action->name, @{$c->req->args})); return 1; } sub zero :Path :Args(0) { } sub one :Path :Args(1) { } sub two :Path :Args(2) { } sub not_def : Path { } 1; Uploads.pm000600001750001750 43411452456126 26217 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Requestpackage TestApp::Controller::Engine::Request::Uploads; use strict; use base 'Catalyst::Controller'; sub slurp : Relative { my ( $self, $c ) = @_; $c->response->content_type('text/plain; charset=utf-8'); $c->response->output( $c->request->upload('slurp')->slurp ); } 1; Errors.pm000600001750001750 57611452456126 26241 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Errors; use strict; use base 'Catalyst::Controller'; sub one : Relative { my ( $self, $c ) = @_; my $a = 0; my $b = 0; my $t = $a / $b; } sub two : Relative { my ( $self, $c ) = @_; $c->forward('/non/existing/path'); } sub three : Relative { my ( $self, $c ) = @_; die("I'm going to die!\n"); } 1; Status.pm000600001750001750 145611452456126 26266 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Status; use strict; use base 'Catalyst::Controller'; sub begin : Private { my ( $self, $c ) = @_; $c->response->content_type('text/plain'); return 1; } sub s200 : Relative { my ( $self, $c ) = @_; $c->res->status(200); $c->res->output("200 OK\n"); } sub s400 : Relative { my ( $self, $c ) = @_; $c->res->status(400); $c->res->output("400 Bad Request\n"); } sub s403 : Relative { my ( $self, $c ) = @_; $c->res->status(403); $c->res->output("403 Forbidden\n"); } sub s404 : Relative { my ( $self, $c ) = @_; $c->res->status(404); $c->res->output("404 Not Found\n"); } sub s500 : Relative { my ( $self, $c ) = @_; $c->res->status(500); $c->res->output("500 Internal Server Error\n"); } 1; Immutable000711001750001750 011452456126 23214 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/ControllerHardToReload.pm000600001750001750 144411452456126 26224 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Immutablepackage TestApp::Controller::Immutable::HardToReload::Role; use Moose::Role; # Role metaclass does not have make_immutable.. no Moose::Role; package TestApp::Controller::Immutable::HardToReload; use Moose; BEGIN { extends 'Catalyst::Controller' } no Moose; __PACKAGE__->meta->make_immutable; package # Standard PAUSE hiding technique TestApp::Controller::Immutable::HardToReload::PAUSEHide; use Moose; BEGIN { extends 'Catalyst::Controller' } no Moose; __PACKAGE__->meta->make_immutable; # Not an inner package package TestApp::Controller::Immutable2; use Moose; BEGIN { extends 'Catalyst::Controller' } no Moose; __PACKAGE__->meta->make_immutable; # Not even in the app namespace package Frobnitz; use Moose; BEGIN { extends 'Catalyst::Controller' } no Moose; __PACKAGE__->meta->make_immutable; author-live_component_controller_action_detach.t000600001750001750 576611452456126 27017 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 18*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::Detach->begin TestApp::Controller::Action::Detach->one TestApp::Controller::Action::Detach->two TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); # Test detach to chain of actions. ok( my $response = request('http://localhost/action/detach/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/detach/one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); } { my @expected = qw[ TestApp::Controller::Action::Detach->begin TestApp::Controller::Action::Detach->path TestApp::Controller::Action::Detach->two TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); # Test detach to chain of actions. ok( my $response = request('http://localhost/action/detach/path'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/detach/path', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); } { ok( my $response = request('http://localhost/action/detach/with_args/old'), 'Request with args' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'new' ); } { ok( my $response = request( 'http://localhost/action/detach/with_method_and_args/old'), 'Request with args and method' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'new' ); } } author-live_component_controller_action_regexp.t000600001750001750 675511452456126 27060 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 28*$iters; use Catalyst::Test 'TestApp'; use Catalyst::Request; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action/regexp/10/hello'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), '^action/regexp/(\d+)/(\w+)$', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Regexp', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/regexp/hello/10'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), '^action/regexp/(\w+)/(\d+)$', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Regexp', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/regexp/mandatory'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), '^action/regexp/(mandatory)(/optional)?$', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Regexp', 'Test Class' ); my $content = $response->content; my $req = eval $content; is( scalar @{ $req->captures }, 2, 'number of captures' ); is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' ); ok( !defined $req->captures->[ 1 ], 'optional capture' ); } { ok( my $response = request('http://localhost/action/regexp/mandatory/optional'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), '^action/regexp/(mandatory)(/optional)?$', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Regexp', 'Test Class' ); my $content = $response->content; my $req = eval $content; is( scalar @{ $req->captures }, 2, 'number of captures' ); is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' ); is( $req->captures->[ 1 ], '/optional', 'optional capture' ); } } author-live_component_controller_action_action.t000600001750001750 671611452456126 27040 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 28 * $iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action_action_one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_action_one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Action', 'Test Class' ); is( $response->header('X-Action'), 'works' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action_action_two'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_action_two', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Action', 'Test Class' ); is( $response->header('X-Action-After'), 'awesome' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action_action_three/one/two'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_action_three', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Action', 'Test Class' ); is( $response->header('X-TestAppActionTestBefore'), 'one' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action_action_four'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_action_four', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Action', 'Test Class' ); is( $response->header('X-TestAppActionTestMyAction'), 'MyAction works' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } } author-live_component_controller_action_global.t000600001750001750 476711452456126 27027 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 18*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action_global_one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_global_one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Global', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action_global_two'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_global_two', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Global', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action_global_three'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action_global_three', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Global', 'Test Class' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } } Controller000711001750001750 011452456126 25154 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppShowInternalActionsRoot.pm000600001750001750 51411452456126 26554 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppShowInternalActions/Controllerpackage TestAppShowInternalActions::Controller::Root; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller' } __PACKAGE__->config(namespace => ''); sub index :Path :Args(0) { my ( $self, $c ) = @_; $c->response->body( 'hello world' ); } sub end : Action {} __PACKAGE__->meta->make_immutable; 1; loc_vs_index.pm000600001750001750 23511452456126 26557 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Prioritiespackage TestApp::Controller::Priorities::loc_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; Headers.pm000600001750001750 60011452456126 26324 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Headers; use strict; use base 'Catalyst::Controller'; sub one : Relative { my ( $self, $c ) = @_; $c->res->header( 'X-Header-Catalyst' => 'Cool' ); $c->res->header( 'X-Header-Cool' => 'Catalyst' ); $c->res->header( 'X-Header-Numbers' => join ', ', 1 .. 10 ); $c->forward('TestApp::View::Dump::Request'); } 1; Cookies.pm000600001750001750 161711452456126 26376 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Cookies; use strict; use base 'Catalyst::Controller'; sub one : Local { my ( $self, $c ) = @_; $c->res->cookies->{catalyst} = { value => 'cool', path => '/bah' }; $c->res->cookies->{cool} = { value => 'catalyst', path => '/' }; $c->forward('TestApp::View::Dump::Request'); } sub two : Local { my ( $self, $c ) = @_; $c->res->cookies->{catalyst} = { value => 'cool', path => '/bah' }; $c->res->cookies->{cool} = { value => 'catalyst', path => '/' }; $c->res->redirect('http://www.google.com/'); } sub three : Local { my ( $self, $c ) = @_; $c->res->cookies->{object} = CGI::Simple::Cookie->new( -name => "this_is_the_real_name", -value => [qw/foo bar/], ); $c->res->cookies->{hash} = { value => [qw/a b c/], }; $c->forward('TestApp::View::Dump::Request'); } 1; Auto000711001750001750 011452456126 24755 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/ChainedFoo.pm000600001750001750 51611452456126 26157 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chained/Autopackage TestApp::Controller::Action::Chained::Auto::Foo; use warnings; use strict; use base qw( Catalyst::Controller ); # # Test chain reaction if auto action returns 1. # sub auto : Private { 1 } sub fooend : Chained('.') Args(1) { } sub crossend : Chained('/action/chained/auto/bar/crossloose') Args(1) { } 1; Bar.pm000600001750001750 51511452456126 26137 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chained/Autopackage TestApp::Controller::Action::Chained::Auto::Bar; use warnings; use strict; use base qw( Catalyst::Controller ); # # Test chain reaction if auto action returns 0. # sub auto : Private { 0 } sub barend : Chained('.') Args(1) { } sub crossloose : Chained PathPart('chained/auto_cross') CaptureArgs(1) { } 1; author-live_component_controller_action_chained.t000600001750001750 7050411452456126 27172 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 118*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests($_); } } sub run_tests { my ($run_number) = @_; # # This is a simple test where the parent and child actions are # within the same controller. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->foo TestApp::Controller::Action::Chained->endpoint TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/foo/1/end/2'), 'chained + local endpoint' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # This makes sure the above isn't found if the argument for the # end action isn't supplied. # { my $expected = undef; ok( my $response = request('http://localhost/chained/foo/1/end'), 'chained + local endpoint; missing last argument' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->code, 500, 'Status OK' ); } # # Tests the case when the child action is placed in a subcontroller. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->foo TestApp::Controller::Action::Chained::Foo->spoon TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/foo/1/spoon'), 'chained + subcontroller endpoint' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; ', 'Content OK' ); } # # Tests if the relative specification (e.g.: Chained('bar') ) works # as expected. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->bar TestApp::Controller::Action::Chained->finale TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/bar/1/spoon'), 'chained + relative endpoint' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 1, spoon', 'Content OK' ); } # # Just a test for multiple arguments. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->foo2 TestApp::Controller::Action::Chained->endpoint2 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'), 'chained + local (2 args each)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '10, 20; 15, 25', 'Content OK' ); } # # The first three-chain test tries to call the action with :Args(1) # specification. There's also a one action with a :CaptureArgs(1) # attribute, that should not be dispatched to. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->one_end TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/one/23'), 'three-chain (only first)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 23', 'Content OK' ); } # # This is the second three-chain test, it goes for the action that # handles "/one/$cap/two/$arg1/$arg2" paths. Should be the two action # having :Args(2), not the one having :CaptureArgs(2). # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->one TestApp::Controller::Action::Chained->two_end TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/one/23/two/23/46'), 'three-chain (up to second)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '23; 23, 46', 'Content OK' ); } # # Last of the three-chain tests. Has no concurrent action with :CaptureArgs # and is more thought to simply test the chain as a whole and the 'two' # action specifying :CaptureArgs. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->one TestApp::Controller::Action::Chained->two TestApp::Controller::Action::Chained->three_end TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/one/23/two/23/46/three/1/2/3'), 'three-chain (all three)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '23, 23, 46; 1, 2, 3', 'Content OK' ); } # # Tests dispatching on number of arguments for :Args. This should be # dispatched to the action expecting one argument. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->multi1 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/multi/23'), 'multi-action (one arg)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 23', 'Content OK' ); } # # Belongs to the former test and goes for the action expecting two arguments. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->multi2 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/multi/23/46'), 'multi-action (two args)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 23, 46', 'Content OK' ); } # # Dispatching on argument count again, this time we provide too many # arguments, so dispatching should fail. # { my $expected = undef; ok( my $response = request('http://localhost/chained/multi/23/46/67'), 'multi-action (three args, should lead to error)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->code, 500, 'Status OK' ); } # # This tests the case when an action says it's the child of an action in # a subcontroller. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Foo->higher_root TestApp::Controller::Action::Chained->higher_root TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/higher_root/23/bar/11'), 'root higher than child' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '23; 11', 'Content OK' ); } # # Just a more complex version of the former test. It tests if a controller -> # subcontroller -> controller dispatch works. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->pcp1 TestApp::Controller::Action::Chained::Foo->pcp2 TestApp::Controller::Action::Chained->pcp3 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/pcp1/1/pcp2/2/pcp3/3'), 'parent -> child -> parent' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1, 2; 3', 'Content OK' ); } # # Tests dispatch on capture number. This test is for a one capture action. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->multi_cap1 TestApp::Controller::Action::Chained->multi_cap_end1 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/multi_cap/1/baz'), 'dispatch on capture num 1' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; ', 'Content OK' ); } # # Belongs to the former test. This one goes for the action expecting two # captures. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->multi_cap2 TestApp::Controller::Action::Chained->multi_cap_end2 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/multi_cap/1/2/baz'), 'dispatch on capture num 2' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1, 2; ', 'Content OK' ); } # # Tests the priority of a slurpy arguments action (with :Args) against # two actions chained together. The two actions should win. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->priority_a2 TestApp::Controller::Action::Chained->priority_a2_end TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/priority_a/1/end/2'), 'priority - slurpy args vs. parent/child' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # This belongs to the former test but tests if two chained actions have # priority over an action with the exact arguments. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->priority_b2 TestApp::Controller::Action::Chained->priority_b2_end TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/priority_b/1/end/2'), 'priority - fixed args vs. parent/child' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # This belongs to the former test but tests if two chained actions have # priority over an action with one child action not having the Args() attr set. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->priority_c1 TestApp::Controller::Action::Chained->priority_c2_xyz TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/priority_c/1/xyz/'), 'priority - no Args() order mismatch' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; ', 'Content OK' ); } # # Test dispatching between two controllers that are on the same level and # therefor have no parent/child relationship. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Bar->cross1 TestApp::Controller::Action::Chained::Foo->cross2 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/cross/1/end/2'), 'cross controller w/o par/child relation' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # This is for testing if the arguments got passed to the actions # correctly. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::PassedArgs->first TestApp::Controller::Action::Chained::PassedArgs->second TestApp::Controller::Action::Chained::PassedArgs->third TestApp::Controller::Action::Chained::PassedArgs->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/passedargs/a/1/b/2/c/3'), 'Correct arguments passed to actions' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2; 3', 'Content OK' ); } # # The :Args attribute is optional, we check the action not specifying # it with these tests. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->opt_args TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/opt_args/1/2/3'), 'Optional :Args attribute working' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 1, 2, 3', 'Content OK' ); } # # Tests for optional PathPart attribute. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->opt_pp_start TestApp::Controller::Action::Chained->opt_pathpart TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/optpp/1/opt_pathpart/2'), 'Optional :PathName attribute working' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Tests for optional PathPart *and* Args attributes. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->opt_all_start TestApp::Controller::Action::Chained->oa TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/optall/1/oa/2/3'), 'Optional :PathName *and* :Args attributes working' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2, 3', 'Content OK' ); } # # Test if :Chained is the same as :Chained('/') # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->rootdef TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/rootdef/23'), ":Chained is the same as :Chained('/')" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; 23', 'Content OK' ); } # # Test if :Chained('.') is working # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->parentchain TestApp::Controller::Action::Chained::ParentChain->child TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/parentchain/1/child/2'), ":Chained('.') chains to parent controller action" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test behaviour of auto actions returning '1' for the chain. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Auto->auto TestApp::Controller::Action::Chained::Auto::Foo->auto TestApp::Controller::Action::Chained::Auto->foo TestApp::Controller::Action::Chained::Auto::Foo->fooend TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/autochain1/1/fooend/2'), "Behaviour when auto returns 1 correct" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test behaviour of auto actions returning '0' for the chain. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Auto->auto TestApp::Controller::Action::Chained::Auto::Bar->auto TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/autochain2/1/barend/2'), "Behaviour when auto returns 0 correct" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test what auto actions are run when namespaces are changed # horizontally. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Auto->auto TestApp::Controller::Action::Chained::Auto::Foo->auto TestApp::Controller::Action::Chained::Auto::Bar->crossloose TestApp::Controller::Action::Chained::Auto::Foo->crossend TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/auto_cross/1/crossend/2'), "Correct auto actions are run on cross controller dispatch" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test forwarding from auto action in chain dispatch. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Auto->auto TestApp::Controller::Action::Chained::Auto::Forward->auto TestApp::Controller::Action::Chained::Auto->fw3 TestApp::Controller::Action::Chained::Auto->fw1 TestApp::Controller::Action::Chained::Auto::Forward->forwardend TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/auto_forward/1/forwardend/2'), "Forwarding out of auto in chain" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Detaching out of the auto action of a chain. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::Auto->auto TestApp::Controller::Action::Chained::Auto::Detach->auto TestApp::Controller::Action::Chained::Auto->fw3 TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/auto_detach/1/detachend/2'), "Detaching out of auto in chain" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test forwarding from auto action in chain dispatch. # { my $expected = undef; ok( my $response = request('http://localhost/chained/loose/23'), "Loose end is not callable" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->code, 500, 'Status OK' ); } # # Test forwarding out of a chain. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->chain_fw_a TestApp::Controller::Action::Chained->fw_dt_target TestApp::Controller::Action::Chained->chain_fw_b TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/chain_fw/1/end/2'), "Forwarding out a chain" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Test detaching out of a chain. # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->chain_dt_a TestApp::Controller::Action::Chained->fw_dt_target TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/chain_dt/1/end/2'), "Forwarding out a chain" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '1; 2', 'Content OK' ); } # # Tests that an uri_for to a chained root index action # returns the right value. # { ok( my $response = request( 'http://localhost/action/chained/to_root' ), 'uri_for with chained root action as arg' ); like( $response->content, qr(URI:https?://[^/]+/), 'Correct URI generated' ); } # # Test interception of recursive chains. This test was added because at # one point during the :Chained development, Catalyst used to hang on # recursive chains. # { eval { require 'TestAppChainedRecursive.pm' }; if ($run_number == 1) { ok( ! $@, "Interception of recursive chains" ); } else { pass( "Interception of recursive chains already tested" ) } } # # Test failure of absolute path part arguments. # { eval { require 'TestAppChainedAbsolutePathPart.pm' }; if ($run_number == 1) { like( $@, qr(foo/foo), "Usage of absolute path part argument emits error" ); } else { pass( "Error on absolute path part arguments already tested" ) } } # # Test chained actions in the root controller # { my @expected = qw[ TestApp::Controller::Action::Chained::Root->rootsub TestApp::Controller::Action::Chained::Root->endpointsub TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/rootsub/1/endpointsub/2'), 'chained in root namespace' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '', 'Content OK' ); } # # Complex path with multiple empty pathparts # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->mult_nopp_base TestApp::Controller::Action::Chained->mult_nopp_all TestApp::Controller::Action::Chained->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/chained/mult_nopp'), "Complex path with multiple empty pathparts" ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, '; ', 'Content OK' ); } # # Higher Args() hiding more specific CaptureArgs chains sections # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->cc_base TestApp::Controller::Action::Chained->cc_link TestApp::Controller::Action::Chained->cc_anchor TestApp::Controller::Action::Chained->end ]; my $expected = join ', ', @expected; ok( my $response = request('http://localhost/chained/choose_capture/anchor.html'), 'Choose between an early Args() and a later more ideal chain' ); is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions'); is( $response->content => '; ', 'Content OK' ); } # # Less specific chain not being seen correctly due to earlier looser capture # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->cc_base TestApp::Controller::Action::Chained->cc_b TestApp::Controller::Action::Chained->cc_b_link TestApp::Controller::Action::Chained->cc_b_anchor TestApp::Controller::Action::Chained->end ]; my $expected = join ', ', @expected; ok( my $response = request('http://localhost/chained/choose_capture/b/a/anchor.html'), 'Choose between a more specific chain and an earlier looser one' ); is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions'); is( $response->content => 'a; ', 'Content OK' ); } # # Check we get the looser one when it's the correct match # { my @expected = qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained->cc_base TestApp::Controller::Action::Chained->cc_a TestApp::Controller::Action::Chained->cc_a_link TestApp::Controller::Action::Chained->cc_a_anchor TestApp::Controller::Action::Chained->end ]; my $expected = join ', ', @expected; ok( my $response = request('http://localhost/chained/choose_capture/a/a/anchor.html'), 'Choose between a more specific chain and an earlier looser one' ); is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions'); is( $response->content => 'a; anchor.html', 'Content OK' ); } } author-live_component_controller_action_private.t000600001750001750 532311452456126 27226 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 24*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { ok( my $response = request('http://localhost/action/private/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' ); is( $response->content, 'access denied', 'Access' ); } { ok( my $response = request('http://localhost/action/private/two'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' ); is( $response->content, 'access denied', 'Access' ); } { ok( my $response = request('http://localhost/three'), 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); like( $response->header('X-Catalyst-Error'), qr/^Unknown resource "three"/, 'Catalyst Error' ); } { ok( my $response = request('http://localhost/action/private/four'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' ); is( $response->content, 'access denied', 'Access' ); } { ok( my $response = request('http://localhost/action/private/five'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' ); is( $response->content, 'access denied', 'Access' ); } } author-live_component_controller_action_forward.t000600001750001750 1772211452456126 27246 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 47 * $iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::Forward->begin TestApp::Controller::Action::Forward->one TestApp::Controller::Action::Forward->two TestApp::Controller::Action::Forward->three TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); # Test forward to global private action ok( my $response = request('http://localhost/action/forward/global'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/forward/global', 'Main Class Action' ); # Test forward to chain of actions. ok( $response = request('http://localhost/action/forward/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/forward/one', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { my @expected = qw[ TestApp::Controller::Action::Forward->begin TestApp::Controller::Action::Forward->jojo TestApp::Controller::Action::Forward->one TestApp::Controller::Action::Forward->two TestApp::Controller::Action::Forward->three TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process TestApp::Controller::Action::Forward->three TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/forward/jojo'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/forward/jojo', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Forward', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { ok( my $response = request('http://localhost/action/forward/with_args/old'), 'Request with args' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'old' ); } { ok( my $response = request( 'http://localhost/action/forward/with_method_and_args/old'), 'Request with args and method' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'old' ); } # test forward with embedded args { ok( my $response = request('http://localhost/action/forward/args_embed_relative'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'ok' ); } { ok( my $response = request('http://localhost/action/forward/args_embed_absolute'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content, 'ok' ); } { my @expected = qw[ TestApp::Controller::Action::TestRelative->begin TestApp::Controller::Action::TestRelative->relative TestApp::Controller::Action::Forward->one TestApp::Controller::Action::Forward->two TestApp::Controller::Action::Forward->three TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); # Test forward to chain of actions. ok( my $response = request('http://localhost/action/relative/relative'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/relative/relative', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::TestRelative', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { my @expected = qw[ TestApp::Controller::Action::TestRelative->begin TestApp::Controller::Action::TestRelative->relative_two TestApp::Controller::Action::Forward->one TestApp::Controller::Action::Forward->two TestApp::Controller::Action::Forward->three TestApp::Controller::Action::Forward->four TestApp::Controller::Action::Forward->five TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); # Test forward to chain of actions. ok( my $response = request('http://localhost/action/relative/relative_two'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/relative/relative_two', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::TestRelative', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } # test class forwards { ok( my $response = request( 'http://localhost/action/forward/class_forward_test_action'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header('X-Class-Forward-Test-Method'), 1, 'Test Method' ); } } author-live_component_controller_action_default.t000600001750001750 544411452456126 27204 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 16 * $iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::Default->begin TestApp::Controller::Action::Default->default TestApp::View::Dump::Request->process TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/default'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Default', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); ok( $response = request('http://localhost/foo/bar/action'), 'Request' ); is( $response->code, 500, 'Invalid URI returned 500' ); } # test that args are passed properly to default { my $creq; my $expected = [qw/action default arg1 arg2/]; ok( my $response = request('http://localhost/action/default/arg1/arg2'), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is_deeply( $creq->{arguments}, $expected, 'Arguments ok' ); } # Test that /foo and /foo/ both do the same thing { my @expected = qw[ TestApp::Controller::Action->begin TestApp::Controller::Action->default TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action'), 'Request' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions for /action' ); ok( $response = request('http://localhost/action/'), 'Request' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions for /action/' ); } } path_vs_index.pm000600001750001750 23611452456126 26737 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Prioritiespackage TestApp::Controller::Priorities::path_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; Redirect.pm000600001750001750 117311452456126 26540 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Engine/Responsepackage TestApp::Controller::Engine::Response::Redirect; use strict; use base 'Catalyst::Controller'; sub one : Relative { my ( $self, $c ) = @_; $c->response->redirect('/test/writing/is/boring'); } sub two : Relative { my ( $self, $c ) = @_; $c->response->redirect('http://www.google.com/'); } sub three : Relative { my ( $self, $c ) = @_; $c->response->redirect('http://www.google.com/'); $c->response->status(301); # Moved Permanently } sub four : Relative { my ( $self, $c ) = @_; $c->response->redirect('http://www.google.com/'); $c->response->status(307); # Temporary Redirect } 1; ArgsOrder.pm000600001750001750 163511452456126 26437 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::ArgsOrder; use warnings; use strict; use base qw( Catalyst::Controller ); # # This controller builds a simple chain of three actions that # will output the arguments they got passed to @_ after the # context object. We do this to test if that passing works # as it should. # sub base :Chained('/') PathPart('argsorder') CaptureArgs(0) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'base', $arg; } sub index :Chained('base') PathPart('') Args(0) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'index', $arg; } sub all :Chained('base') PathPart('') Args() { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'all', $arg; } sub end : Private { my ( $self, $c ) = @_; no warnings 'uninitialized'; $c->response->body( join '; ', @{ $c->stash->{ passed_args } } ); } 1; MangleDollarUnderScore.pm000600001750001750 56111452456126 26545 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/Catalyst/Plugin/Testpackage Catalyst::Plugin::Test::MangleDollarUnderScore; use strict; use warnings; our $VERSION = 0.1; # Make is_class_loaded happy # Class::MOP::load_class($_) can hurt you real hard. BEGIN { $_ = q{ mst sayeth, Class::MOP::load_class($_) will ruin your life rafl spokeh "i ♥ my $_"', and verrily forsooth, t0m made tests and yea, there was fail' }; } 1; __END__ IndexPrivate.pm000600001750001750 26311452456126 26652 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppIndexDefault/Controllerpackage TestAppIndexDefault::Controller::IndexPrivate; use base 'Catalyst::Controller'; sub index : Private { my ($self, $c) = @_; $c->res->body('index_private'); } 1; IndexChained.pm000600001750001750 43711452456126 26576 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppIndexDefault/Controllerpackage TestAppIndexDefault::Controller::IndexChained; use base 'Catalyst::Controller'; sub index : Chained('/') PathPart('indexchained') CaptureArgs(0) {} sub index_endpoint : Chained('index') PathPart('') Args(0) { my ($self, $c) = @_; $c->res->body('index_chained'); } 1; Controller000711001750001750 011452456126 25556 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppPluginWithConstructorRoot.pm000600001750001750 31611452456126 27156 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppPluginWithConstructor/Controllerpackage TestAppPluginWithConstructor::Controller::Root; use base 'Catalyst::Controller'; __PACKAGE__->config->{namespace} = ''; sub foo : Local { my ($self, $c) = @_; $c->res->body('foo'); } 1; locre_vs_index.pm000600001750001750 23711452456126 27110 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Prioritiespackage TestApp::Controller::Priorities::locre_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; PassedArgs.pm000600001750001750 157711452456126 26610 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::PassedArgs; use warnings; use strict; use base qw( Catalyst::Controller ); # # This controller builds a simple chain of three actions that # will output the arguments they got passed to @_ after the # context object. We do this to test if that passing works # as it should. # sub first : PathPart('chained/passedargs/a') Chained('/') CaptureArgs(1) { my ( $self, $c, $arg ) = @_; $c->stash->{ passed_args } = [ $arg ]; } sub second : PathPart('b') Chained('first') CaptureArgs(1) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, $arg; } sub third : PathPart('c') Chained('second') Args(1) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, $arg; } sub end : Private { my ( $self, $c ) = @_; $c->response->body( join '; ', @{ $c->stash->{ passed_args } } ); } 1; PathPrefix.pm000600001750001750 44011452456126 26572 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::PathPrefix; use strict; use warnings; use base qw/Catalyst::Controller/; # this is kinda the same thing as: sub instance : Path {} # it should respond to: /action/chained/pathprefix/* sub instance : Chained('/') PathPrefix Args(1) { } 1; author-live_component_controller_action_streaming.t000600001750001750 372511452456126 27551 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 10*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { # test direct streaming { ok( my $response = request('http://localhost/streaming'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 1; } # XXX: Length should be undef here, but HTTP::Request::AsCGI sets it is( $response->content_length, 12, 'Response Content-Length' ); } is( $response->content,, <<'EOF', 'Content is a stream' ); foo bar baz EOF } # test streaming by passing a handle to $c->res->body SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 5; } my $file = "$FindBin::Bin/lib/TestApp/Controller/Action/Streaming.pm"; my $fh = IO::File->new( $file, 'r' ); my $buffer; if ( defined $fh ) { $fh->read( $buffer, 1024 ); $fh->close; } ok( my $response = request('http://localhost/action/streaming/body'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content_length, -s $file, 'Response Content-Length' ); is( $response->content, $buffer, 'Content is read from filehandle' ); } } author-live_component_controller_action_multipath.t000600001750001750 367411452456126 27572 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; my $content = q/foo bar baz /; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 16*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { # Local { ok( my $response = request('http://localhost/action/multipath/multipath'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, $content, 'Content is a stream' ); } # Global { ok( my $response = request('http://localhost/multipath'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, $content, 'Content is a stream' ); } # Path('/multipath1') { ok( my $response = request('http://localhost/multipath1'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, $content, 'Content is a stream' ); } # Path('multipath2') { ok( my $response = request('http://localhost/action/multipath/multipath2'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, $content, 'Content is a stream' ); } } Controller000711001750001750 011452456126 25714 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppChainedAbsolutePathPartFoo.pm000600001750001750 26011452456126 27112 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestAppChainedAbsolutePathPart/Controllerpackage TestAppChainedAbsolutePathPart::Controller::Foo; use strict; use warnings; use base qw/Catalyst::Controller/; sub foo : Chained PathPart('/foo/bar') Args(1) { } 1; CaptureArgs.pm000600001750001750 362011452456126 26763 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::CaptureArgs; use warnings; use strict; use base qw( Catalyst::Controller ); # # This controller build the following patterns of URI: # /captureargs/*/* # /captureargs/*/*/edit # /captureargs/* # /captureargs/*/edit # /captureargs/test/* # It will output the arguments they got passed to @_ after the # context object. # /captureargs/one/edit should not dispatch to /captureargs/*/* # /captureargs/test/one should not dispatch to /captureargs/*/* sub base :Chained('/') PathPart('captureargs') CaptureArgs(0) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'base'; } sub two_args :Chained('base') PathPart('') CaptureArgs(2) { my ( $self, $c, $arg1, $arg2 ) = @_; push @{ $c->stash->{ passed_args } }, 'two_args', $arg1, $arg2; } sub one_arg :Chained('base') ParthPart('') CaptureArgs(1) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'one_arg', $arg; } sub edit_two_args :Chained('two_args') PathPart('edit') Args(0) { my ( $self, $c ) = @_; push @{ $c->stash->{ passed_args } }, 'edit_two_args'; } sub edit_one_arg :Chained('one_arg') PathPart('edit') Args(0) { my ( $self, $c ) = @_; push @{ $c->stash->{ passed_args } }, 'edit_one_arg'; } sub view_two_args :Chained('two_args') PathPart('') Args(0) { my ( $self, $c ) = @_; push @{ $c->stash->{ passed_args } }, 'view_two_args'; } sub view_one_arg :Chained('one_arg') PathPart('') Args(0) { my ( $self, $c ) = @_; push @{ $c->stash->{ passed_args } }, 'view_one_arg'; } sub test_plus_arg :Chained('base') PathPart('test') Args(1) { my ( $self, $c, $arg ) = @_; push @{ $c->stash->{ passed_args } }, 'test_plus_arg', $arg; } sub end : Private { my ( $self, $c ) = @_; no warnings 'uninitialized'; $c->response->body( join '; ', @{ $c->stash->{ passed_args } } ); } 1; ParentChain.pm000600001750001750 107511452456126 26741 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chainedpackage TestApp::Controller::Action::Chained::ParentChain; use warnings; use strict; use base qw/ Catalyst::Controller /; # # Chains to the action /action/chained/parentchain in the # Action::Chained controller. # sub child :Chained('.') :Args(1) { } # Should be at /chained/rootdef/*/chained_rel/*/* sub chained_rel :Chained('../one') Args(2) { } # Should chain to loose in parent namespace - i.e. at /chained/loose/*/loose/*/* sub loose : ChainedParent Args(2) { } # Should be at /chained/cross/*/up_down/* sub up_down : Chained('../bar/cross1') Args(1) { } 1; Detach.pm000600001750001750 57111452456126 26625 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chained/Autopackage TestApp::Controller::Action::Chained::Auto::Detach; use warnings; use strict; use base qw( Catalyst::Controller ); # # For testing behaviour of a detaching auto action in a chain. # sub auto : Private { my ( $self, $c ) = @_; $c->detach( '/action/chained/auto/fw3' ); return 1; } sub detachend : Chained('/action/chained/auto/dt1') Args(1) { } 1; Forward.pm000600001750001750 57511452456126 27045 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chained/Autopackage TestApp::Controller::Action::Chained::Auto::Forward; use warnings; use strict; use base qw( Catalyst::Controller ); # # For testing behaviour of a forwarding auto action in a chain. # sub auto : Private { my ( $self, $c ) = @_; $c->forward( '/action/chained/auto/fw3' ); return 1; } sub forwardend : Chained('/action/chained/auto/fw1') Args(1) { } 1; author-live_component_controller_action_inheritance.t000600001750001750 1003211452456126 30056 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More tests => 21*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); } else { for ( 1 .. $iters ) { run_tests(); } } sub run_tests { { my @expected = qw[ TestApp::Controller::Action::Inheritance->begin TestApp::Controller::Action::Inheritance->auto TestApp::Controller::Action::Inheritance->default TestApp::View::Dump::Request->process TestApp::Controller::Action::Inheritance->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/inheritance'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { my @expected = qw[ TestApp::Controller::Action::Inheritance::A->begin TestApp::Controller::Action::Inheritance->auto TestApp::Controller::Action::Inheritance::A->auto TestApp::Controller::Action::Inheritance::A->default TestApp::View::Dump::Request->process TestApp::Controller::Action::Inheritance::A->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/inheritance/a'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance::A', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } { my @expected = qw[ TestApp::Controller::Action::Inheritance::A::B->begin TestApp::Controller::Action::Inheritance->auto TestApp::Controller::Action::Inheritance::A->auto TestApp::Controller::Action::Inheritance::A::B->auto TestApp::Controller::Action::Inheritance::A::B->default TestApp::View::Dump::Request->process TestApp::Controller::Action::Inheritance::A::B->end ]; my $expected = join( ", ", @expected ); ok( my $response = request('http://localhost/action/inheritance/a/b'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Inheritance::A::B', 'Test Class' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' ); } } ParentChain000711001750001750 011452456126 26241 5ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/ChainedRelative.pm000600001750001750 35211452456126 30471 0ustar00raflrafl000000000000Catalyst-Engine-Apache-1.16/t/lib/TestApp/Controller/Action/Chained/ParentChainpackage TestApp::Controller::Action::Chained::ParentChain::Relative; use warnings; use strict; use base qw/ Catalyst::Controller /; # using ../ to go up more than one level sub chained_rel_two : Chained('../../one') Args(2) { } 1;