Catalyst-Controller-ActionRole-0.15000711001750001750 011435314020 16415 5ustar00raflrafl000000000000README000644001750001750 47511435314020 17353 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15 This archive contains the distribution Catalyst-Controller-ActionRole, version 0.15: Apply roles to action instances This software is copyright (c) 2010 by Florian Ragwitz. 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 420511435314020 17771 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.150.15 Thu, 26 Aug 2010 00:22:42 +0200 * Improvements to documentation (William King, Tomas Doran) * Don't apply roles to special internal catalyst actions (Alex J. G. Burzyński) * Honour action_args configuration to allow setting role attributes (John Napiorkowski) 0.14 Sun, 02 May 2010 00:58:39 +0200 * Add repository metadata (Tomas Doran). 0.13 Sat, 20 Mar 2010 12:23:14 +0100 * Make the reader methods for _action_roles and _action_role_args not be context-sensitive and always return a plain list. 0.12 Sat, 18 Jul 2009 00:41:15 +0100 * More correct method for getting the app class. Can't test this yet, as the canonical example ($self being an anon class) doesn't work in core Catalyst yet :( * Do not need an _action_role_prefix method, so that in future it is easier to pull the code out into a role. * Add tests for compatibility when used with Action::REST 0.11 Sun, 24 May 2009 17:57:15 +0200 * Retain compatibility with latest Catalyst-Runtime (NAKAGAWA Masaki). 0.10 Fri, 10 Apr 2009 01:46:36 +0200 * No changes since 0.09, except for actually including the changelog entries. 0.09 Fri, 10 Apr 2009 01:45:48 +0200 * Change the default role search path from ::Action::Role:: to ::ActionRole::. 0.08 Thu, 02 Apr 2009 12:00:59 -0700 * Minor POD tweaks (hdp) 0.07 Wed, 01 Apr 2009 12:18:43 -0700 * Make empty prefix ('Foo') search MyApp::Action::Role before falling back to Catalyst::Action::Role (hdp) 0.06 Wed, 01 Apr 2009 16:29:37 +0200 * Don't depend on parent.pm for the tests. 0.05 Tue, 31 Mar 2009 00:27:54 +0200 * Replace BUILDARGS hack that also doesn't work with Catalyst-Runtime 5.71001 (hdp) 0.04_01 Sun, 29 Mar 2009 13:28:24 +0200 * Remove moose component backward-compatibility hacks. Depend on Catalyst 5.71001 instead, which should provide sufficient backward-compat now. 0.03 Sat, 28 Mar 2009 04:12:49 +0100 * Don't screw up ActionClass attributes. - Add tests for this (Jason Kohles). 0.02 Sat, 21 Feb 2009 02:08:40 +0100 * Don't rely on parent being installed for the test suite. 0.01 Fri, 20 Feb 2009 13:43:10 +0100 * Initial release. LICENSE000644001750001750 4352511435314020 17543 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15This software is copyright (c) 2010 by Florian Ragwitz. 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 Florian Ragwitz. 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 Florian Ragwitz. 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 102711435314020 20141 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15name = Catalyst-Controller-ActionRole version = 0.15 author = Florian Ragwitz author = Hans Dieter Pearcey author = Alex J. G. Burzyński author = John Napiorkowski author = William King author = Tomas Doran license = Perl_5 copyright_holder = Florian Ragwitz [@FLORA] dist = Catalyst-Controller-ActionRole repository_at = github [Prereqs] Catalyst::Runtime = 5.80025 ; $controller->action_class META.yml000644001750001750 1124311435314020 17777 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15--- abstract: 'Apply roles to action instances' author: - 'Florian Ragwitz ' - 'Hans Dieter Pearcey ' - 'Alex J. G. Burzyński ' - 'John Napiorkowski ' - 'William King ' - 'Tomas Doran ' build_requires: Catalyst: 0 Catalyst::Action: 0 Catalyst::Action::REST: 0 Catalyst::Test: 0 FindBin: 0 Moose::Role: 0 Test::More: 0 parent: 0 configure_requires: ExtUtils::MakeMaker: 6.31 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.102340, CPAN::Meta::Converter version 2.102160' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Catalyst-Controller-ActionRole requires: Catalyst::Controller: 0 Catalyst::Runtime: 5.80025 Catalyst::Utils: 0 Class::MOP: 0 List::Util: 0 Moose: 0 Moose::Meta::Class: 0 MooseX::Types::Moose: 0 String::RewritePrefix: 0.004 namespace::clean: 0 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Controller-ActionRole homepage: http://search.cpan.org/dist/Catalyst-Controller-ActionRole repository: git://github.com/rafl/catalyst-controller-actionrole.git version: 0.15 x_Dist_Zilla: plugins: - class: Dist::Zilla::Plugin::GatherDir name: '@FLORA/@Basic/GatherDir' version: 4.102340 - class: Dist::Zilla::Plugin::PruneCruft name: '@FLORA/@Basic/PruneCruft' version: 4.102340 - class: Dist::Zilla::Plugin::ManifestSkip name: '@FLORA/@Basic/ManifestSkip' version: 4.102340 - class: Dist::Zilla::Plugin::MetaYAML name: '@FLORA/@Basic/MetaYAML' version: 4.102340 - class: Dist::Zilla::Plugin::License name: '@FLORA/@Basic/License' version: 4.102340 - class: Dist::Zilla::Plugin::Readme name: '@FLORA/@Basic/Readme' version: 4.102340 - class: Dist::Zilla::Plugin::ExtraTests name: '@FLORA/@Basic/ExtraTests' version: 4.102340 - class: Dist::Zilla::Plugin::ExecDir name: '@FLORA/@Basic/ExecDir' version: 4.102340 - class: Dist::Zilla::Plugin::ShareDir name: '@FLORA/@Basic/ShareDir' version: 4.102340 - class: Dist::Zilla::Plugin::MakeMaker name: '@FLORA/@Basic/MakeMaker' version: 4.102340 - class: Dist::Zilla::Plugin::Manifest name: '@FLORA/@Basic/Manifest' version: 4.102340 - class: Dist::Zilla::Plugin::TestRelease name: '@FLORA/@Basic/TestRelease' version: 4.102340 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@FLORA/@Basic/ConfirmRelease' version: 4.102340 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@FLORA/@Basic/UploadToCPAN' version: 4.102340 - class: Dist::Zilla::Plugin::MetaConfig name: '@FLORA/MetaConfig' version: 4.102340 - class: Dist::Zilla::Plugin::MetaJSON name: '@FLORA/MetaJSON' version: 4.102340 - class: Dist::Zilla::Plugin::PkgVersion name: '@FLORA/PkgVersion' version: 4.102340 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@FLORA/PodSyntaxTests' version: 4.102340 - class: Dist::Zilla::Plugin::NoTabsTests name: '@FLORA/NoTabsTests' version: 0.01 - class: Dist::Zilla::Plugin::PodCoverageTests name: '@FLORA/PodCoverageTests' version: 4.102340 - class: Dist::Zilla::Plugin::MetaResources name: '@FLORA/MetaResources' version: 4.102340 - class: Dist::Zilla::Plugin::Authority name: '@FLORA/Authority' version: 1.000 - class: Dist::Zilla::Plugin::EOLTests name: '@FLORA/EOLTests' version: 0.02 - class: Dist::Zilla::Plugin::PodWeaver name: '@FLORA/PodWeaver' version: 3.101640 - class: Dist::Zilla::Plugin::AutoPrereq name: '@FLORA/AutoPrereq' version: 4.102340 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: 4.102340 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 4.102340 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 4.102340 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 4.102340 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 4.102340 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 4.102340 x_authority: cpan:FLORA MANIFEST000644001750001750 165711435314020 17647 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Catalyst/Controller/ActionRole.pm t/action-class.t t/basic.t t/basic_rest.t t/execution-via-config.t t/execution-via-does.t t/lib/Catalyst/Action/TestActionClass.pm t/lib/Catalyst/ActionRole/Moo.pm t/lib/Catalyst/ActionRole/Zoo.pm t/lib/Moo.pm t/lib/TestApp.pm t/lib/TestApp/ActionRole/Boo.pm t/lib/TestApp/ActionRole/First.pm t/lib/TestApp/ActionRole/Kooh.pm t/lib/TestApp/ActionRole/Moo.pm t/lib/TestApp/ActionRole/Second.pm t/lib/TestApp/ActionRole/Shared.pm t/lib/TestApp/Controller/ActionClass.pm t/lib/TestApp/Controller/Bar.pm t/lib/TestApp/Controller/Boo.pm t/lib/TestApp/Controller/ExecutionViaConfig.pm t/lib/TestApp/Controller/ExecutionViaDoes.pm t/lib/TestApp/Controller/Foo.pm t/lib/TestAppREST.pm t/lib/TestAppREST/ActionRole/Moo.pm t/lib/TestAppREST/Controller/Foo.pm t/release-eol.t t/release-no-tabs.t t/release-pod-coverage.t t/release-pod-syntax.t t000711001750001750 011435314020 16601 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15basic.t000600001750001750 104111435314020 20202 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tuse strict; use warnings; use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestApp'; my %roles = ( foo => 'TestApp::ActionRole::Moo', bar => 'TestApp::ActionRole::Moo', baz => 'Moo', quux => 'Catalyst::ActionRole::Zoo', ); while (my ($path, $role) = each %roles) { for my $controller (qw(foo bar)) { my $resp = request("/${controller}/${path}"); ok($resp->is_success); is($resp->content, $role); is($resp->header('X-Affe'), 'Tiger'); } } done_testing; META.json000644001750001750 1623511435314020 20155 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15{ "abstract" : "Apply roles to action instances", "author" : [ "Florian Ragwitz ", "Hans Dieter Pearcey ", "Alex J. G. Burzy\u00c5\u0084ski ", "John Napiorkowski ", "William King ", "Tomas Doran " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.102340, CPAN::Meta::Converter version 2.102160", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Catalyst-Controller-ActionRole", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.31" } }, "runtime" : { "requires" : { "Catalyst::Controller" : 0, "Catalyst::Runtime" : "5.80025", "Catalyst::Utils" : 0, "Class::MOP" : 0, "List::Util" : 0, "Moose" : 0, "Moose::Meta::Class" : 0, "MooseX::Types::Moose" : 0, "String::RewritePrefix" : "0.004", "namespace::clean" : 0 } }, "test" : { "requires" : { "Catalyst" : 0, "Catalyst::Action" : 0, "Catalyst::Action::REST" : 0, "Catalyst::Test" : 0, "FindBin" : 0, "Moose::Role" : 0, "Test::More" : 0, "parent" : 0 } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-Catalyst-Controller-ActionRole@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Controller-ActionRole" }, "homepage" : "http://search.cpan.org/dist/Catalyst-Controller-ActionRole", "repository" : { "type" : "git", "url" : "git://github.com/rafl/catalyst-controller-actionrole.git", "web" : "http://github.com/rafl/catalyst-controller-actionrole" } }, "version" : "0.15", "x_Dist_Zilla" : { "plugins" : [ { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@FLORA/@Basic/GatherDir", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@FLORA/@Basic/PruneCruft", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@FLORA/@Basic/ManifestSkip", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@FLORA/@Basic/MetaYAML", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@FLORA/@Basic/License", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@FLORA/@Basic/Readme", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@FLORA/@Basic/ExtraTests", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@FLORA/@Basic/ExecDir", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@FLORA/@Basic/ShareDir", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@FLORA/@Basic/MakeMaker", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@FLORA/@Basic/Manifest", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@FLORA/@Basic/TestRelease", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@FLORA/@Basic/ConfirmRelease", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@FLORA/@Basic/UploadToCPAN", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@FLORA/MetaConfig", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@FLORA/MetaJSON", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@FLORA/PkgVersion", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@FLORA/PodSyntaxTests", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "name" : "@FLORA/NoTabsTests", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@FLORA/PodCoverageTests", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@FLORA/MetaResources", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@FLORA/Authority", "version" : "1.000" }, { "class" : "Dist::Zilla::Plugin::EOLTests", "name" : "@FLORA/EOLTests", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "name" : "@FLORA/PodWeaver", "version" : "3.101640" }, { "class" : "Dist::Zilla::Plugin::AutoPrereq", "name" : "@FLORA/AutoPrereq", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "4.102340" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "4.102340" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "4.102340" } }, "x_authority" : "cpan:FLORA" } Makefile.PL000644001750001750 327711435314020 20470 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15 use strict; use warnings; use ExtUtils::MakeMaker 6.31; my %WriteMakefileArgs = ( 'ABSTRACT' => 'Apply roles to action instances', 'AUTHOR' => 'Florian Ragwitz , Hans Dieter Pearcey , Alex J. G. Burzyński , John Napiorkowski , William King , Tomas Doran ', 'BUILD_REQUIRES' => { 'Catalyst' => '0', 'Catalyst::Action' => '0', 'Catalyst::Action::REST' => '0', 'Catalyst::Test' => '0', 'FindBin' => '0', 'Moose::Role' => '0', 'Test::More' => '0', 'parent' => '0' }, 'CONFIGURE_REQUIRES' => { 'ExtUtils::MakeMaker' => '6.31' }, 'DISTNAME' => 'Catalyst-Controller-ActionRole', 'EXE_FILES' => [], 'LICENSE' => 'perl', 'NAME' => 'Catalyst::Controller::ActionRole', 'PREREQ_PM' => { 'Catalyst::Controller' => '0', 'Catalyst::Runtime' => '5.80025', 'Catalyst::Utils' => '0', 'Class::MOP' => '0', 'List::Util' => '0', 'Moose' => '0', 'Moose::Meta::Class' => '0', 'MooseX::Types::Moose' => '0', 'String::RewritePrefix' => '0.004', 'namespace::clean' => '0' }, 'VERSION' => '0.15', '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); lib000711001750001750 011435314020 17347 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tMoo.pm000600001750001750 26211435314020 20556 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/libpackage Moo; use Moose::Role; use namespace::clean -except => 'meta'; after execute => sub { my ($self, $controller, $c) = @_; $c->response->body(__PACKAGE__); }; 1; basic_rest.t000600001750001750 107111435314020 21242 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tuse strict; use warnings; use Test::More; BEGIN { if (!eval {require Catalyst::Action::REST; Catalyst::Action::REST->VERSION(0.74)}) { plan skip_all => 'This test needs Catalyst::Action::REST >=0.74'; } plan tests => 3; } use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestAppREST'; my %roles = ( foo => 'TestAppREST::ActionRole::Moo', ); while (my ($path, $role) = each %roles) { my $resp = request("/foo/${path}"); ok($resp->is_success); is($resp->content, $role); is($resp->header('X-Affe'), 'Tiger'); } release-eol.t000644001750001750 47611435314020 21321 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/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::EOL'; plan skip_all => 'Test::EOL required' if $@; all_perl_files_ok({ trailing_whitespace => 1 }); action-class.t000600001750001750 57311435314020 21472 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tuse strict; use warnings; use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestApp'; { my $resp = request( "/actionclass/one" ); ok( $resp->is_success ); is( $resp->content, 'Catalyst::Action::TestActionClass' ); } { my $resp = request("/boo/foo"); ok( $resp->is_success ); is( $resp->content, 'hello' ); } done_testing; TestApp.pm000600001750001750 16411435314020 21405 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/libpackage TestApp; use Moose; use namespace::clean -except => 'meta'; extends 'Catalyst'; __PACKAGE__->setup; 1; release-no-tabs.t000644001750001750 45011435314020 22075 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/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(); TestAppREST.pm000600001750001750 17011435314020 22100 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/libpackage TestAppREST; use Moose; use namespace::clean -except => 'meta'; extends 'Catalyst'; __PACKAGE__->setup; 1; execution-via-does.t000600001750001750 122311435314020 22633 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tuse strict; use warnings; use Test::More tests => 6; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestApp'; my %actions = ( one => [qw( TestApp::ActionRole::First )], two => [qw( TestApp::ActionRole::First TestApp::ActionRole::Second )] ); while (my ($path, $roles) = each %actions) { my $resp = request("/executionviadoes/${path}"); ok($resp->is_success, "request to /$path is succesful" ); is($resp->content, join(',', sort @$roles), "all roles applied" ); is($resp->header('X-Executed-Times'), scalar @$roles, "...and called once only" ); } release-pod-syntax.t000644001750001750 45011435314020 22640 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/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(); execution-via-config.t000600001750001750 133711435314020 23154 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/tuse strict; use warnings; use Test::More tests => 6; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestApp'; my %actions = ( two => [qw( TestApp::ActionRole::Shared TestApp::ActionRole::First )], three => [qw( TestApp::ActionRole::Shared TestApp::ActionRole::First TestApp::ActionRole::Second )] ); while (my ($path, $roles) = each %actions) { my $resp = request("/executionviaconfig/${path}"); ok($resp->is_success, "request to /$path is succesful" ); is($resp->content, join(',', sort @$roles), "all roles applied" ); is($resp->header('X-Executed-Times'), scalar @$roles, "...and called once only" ); } release-pod-coverage.t000644001750001750 76511435314020 23116 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/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::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); ActionRole000711001750001750 011435314020 22766 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppBoo.pm000600001750001750 44211435314020 24162 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::Boo; use Moose::Role; has boo => ( is => 'ro', required => 1, ); around execute => sub { my ($orig, $self, $controller, $ctx, @rest) = @_; $ctx->stash(action_boo => $self->boo); return $self->$orig($controller, $ctx, @rest); }; 1; Moo.pm000600001750001750 23611435314020 24176 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::Moo; use Moose::Role; after execute => sub { my ($self, $controller, $c) = @_; $c->response->body(__PACKAGE__); }; 1; Controller000711001750001750 011435314020 23052 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppFoo.pm000600001750001750 44311435314020 24253 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::Foo; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole'; } __PACKAGE__->config( action_roles => ['~Kooh'] ); sub foo : Local Does('Moo') {} sub bar : Local Does('~Moo') {} sub baz : Local Does('+Moo') {} sub quux : Local Does('Zoo') {} 1; Boo.pm000600001750001750 50611435314020 24247 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::Boo; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole'; } __PACKAGE__->config( action_args => { foo => { boo => 'hello' }, }, ); sub foo : Local Does('Boo') { my ($self, $ctx) = @_; my $boo = $ctx->stash->{action_boo}; $ctx->response->body($boo); } 1; Bar.pm000600001750001750 42011435314020 24227 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::Bar; use parent 'Catalyst::Controller::ActionRole'; __PACKAGE__->config( action_roles => ['~Kooh'] ); sub foo : Local Does('Moo') {} sub bar : Local Does('~Moo') {} sub baz : Local Does('+Moo') {} sub quux : Local Does('Zoo') {} 1; Kooh.pm000600001750001750 32211435314020 24340 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::Kooh; use Moose::Role; use namespace::clean -except => 'meta'; after execute => sub { my ($self, $controller, $c) = @_; $c->response->header('X-Affe' => 'Tiger'); }; 1; ActionRole000711001750001750 011435314020 23172 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/CatalystZoo.pm000600001750001750 31011435314020 24410 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/Catalyst/ActionRolepackage Catalyst::ActionRole::Zoo; use Moose::Role; use namespace::clean -except => 'meta'; after execute => sub { my ($self, $controller, $c) = @_; $c->response->body(__PACKAGE__); }; 1; Moo.pm000600001750001750 31011435314020 24373 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/Catalyst/ActionRolepackage Catalyst::ActionRole::Moo; use Moose::Role; use namespace::clean -except => 'meta'; after execute => sub { my ($self, $controller, $c) = @_; $c->response->body(__PACKAGE__); }; 1; First.pm000600001750001750 70311435314020 24532 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::First; use Moose::Role; after execute => sub { my ($self, $controller, $c) = @_; my @current_body = $c->response->body ? split(/,/, $c->response->body) : (); push @current_body, __PACKAGE__; $c->response->body( join(',', sort @current_body) ); my $times_executed = $c->response->header('X-Executed-Times') || 0; $c->response->header( 'X-Executed-Times' => ++$times_executed ); }; 1; Second.pm000600001750001750 70411435314020 24657 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::Second; use Moose::Role; after execute => sub { my ($self, $controller, $c) = @_; my @current_body = $c->response->body ? split(/,/, $c->response->body) : (); push @current_body, __PACKAGE__; $c->response->body( join(',', sort @current_body) ); my $times_executed = $c->response->header('X-Executed-Times') || 0; $c->response->header( 'X-Executed-Times' => ++$times_executed ); }; 1; Shared.pm000600001750001750 70411435314020 24652 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/ActionRolepackage TestApp::ActionRole::Shared; use Moose::Role; after execute => sub { my ($self, $controller, $c) = @_; my @current_body = $c->response->body ? split(/,/, $c->response->body) : (); push @current_body, __PACKAGE__; $c->response->body( join(',', sort @current_body) ); my $times_executed = $c->response->header('X-Executed-Times') || 0; $c->response->header( 'X-Executed-Times' => ++$times_executed ); }; 1; ActionRole000711001750001750 011435314020 23464 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppRESTMoo.pm000600001750001750 32111435314020 24667 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppREST/ActionRolepackage TestAppREST::ActionRole::Moo; use Moose::Role; after execute => sub { my ($self, $controller, $c) = @_; $c->response->header('X-Affe' => 'Tiger'); $c->response->body(__PACKAGE__); }; 1; Controller000711001750001750 011435314020 23550 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppRESTFoo.pm000600001750001750 33111435314020 24745 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestAppREST/Controllerpackage TestAppREST::Controller::Foo; use Moose; use namespace::clean -except => 'meta'; BEGIN { extends 'Catalyst::Controller::ActionRole'; } sub foo : Local Does('Moo') ActionClass('REST') {} sub foo_GET {} 1; Controller000711001750001750 011435314020 23013 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/lib/CatalystActionRole.pm000600001750001750 1643611435314020 25601 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/lib/Catalyst/Controllerpackage Catalyst::Controller::ActionRole; BEGIN { $Catalyst::Controller::ActionRole::AUTHORITY = 'cpan:FLORA'; } BEGIN { $Catalyst::Controller::ActionRole::VERSION = '0.15'; } # ABSTRACT: Apply roles to action instances use Moose; use Class::MOP; use Catalyst::Utils; use Moose::Meta::Class; use String::RewritePrefix 0.004; use MooseX::Types::Moose qw/ArrayRef Str RoleName/; use List::Util qw(first); use namespace::clean -except => 'meta'; extends 'Catalyst::Controller'; __PACKAGE__->mk_classdata(qw/_action_role_prefix/); __PACKAGE__->_action_role_prefix([ 'Catalyst::ActionRole::' ]); has _action_role_args => ( traits => [qw(Array)], isa => ArrayRef[Str], init_arg => 'action_roles', default => sub { [] }, handles => { _action_role_args => 'elements', }, ); has _action_roles => ( traits => [qw(Array)], isa => ArrayRef[RoleName], init_arg => undef, lazy_build => 1, handles => { _action_roles => 'elements', }, ); sub _build__action_roles { my $self = shift; my @roles = $self->_expand_role_shortname($self->_action_role_args); Class::MOP::load_class($_) for @roles; return \@roles; } sub BUILD { my $self = shift; # force this to run at object creation time $self->_action_roles; } around create_action => sub { my ($orig, $self, %args) = @_; return $self->$orig(%args) if $args{name} =~ /^_(DISPATCH|BEGIN|AUTO|ACTION|END)$/; my @roles = $self->gather_action_roles(%args); return $self->$orig(%args) unless @roles; Class::MOP::load_class($_) for @roles; my $action_class = $self->_build_action_subclass( $self->action_class(%args), @roles, ); my $action_args = $self->config->{action_args}; my %extra_args = ( %{ $action_args->{'*'} || {} }, %{ $action_args->{ $args{name} } || {} }, ); return $action_class->new({ %extra_args, %args }); }; sub gather_action_roles { my ($self, %args) = @_; return ( $self->_action_roles, @{ $args{attributes}->{Does} || [] }, ); } sub _build_action_subclass { my ($self, $action_class, @roles) = @_; my $meta = Moose::Meta::Class->initialize($action_class)->create_anon_class( superclasses => [$action_class], roles => \@roles, cache => 1, ); $meta->add_method(meta => sub { $meta }); return $meta->name; } sub _expand_role_shortname { my ($self, @shortnames) = @_; my $app = $self->_application; my $prefix = $self->can('_action_role_prefix') ? $self->_action_role_prefix : ['Catalyst::ActionRole::']; my @prefixes = (qq{${app}::ActionRole::}, @$prefix); return String::RewritePrefix->rewrite( { '' => sub { my $loaded = Class::MOP::load_first_existing_class( map { "$_$_[0]" } @prefixes ); return first { $loaded =~ /^$_/ } sort { length $b <=> length $a } @prefixes; }, '~' => $prefixes[0], '+' => '', }, @shortnames, ); } sub _parse_Does_attr { my ($self, $app, $name, $value) = @_; return Does => $self->_expand_role_shortname($value); } 1; __END__ =pod =encoding utf-8 =head1 NAME Catalyst::Controller::ActionRole - Apply roles to action instances =head1 SYNOPSIS package MyApp::Controller::Foo; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller::ActionRole' } sub bar : Local Does('Moo') { ... } =head1 DESCRIPTION This module allows to apply Ls to the Cs for different controller methods. For that a C attribute is provided. That attribute takes an argument, that determines the role, which is going to be applied. If that argument is prefixed with C<+>, it is assumed to be the full name of the role. If it's prefixed with C<~>, the name of your application followed by C<::ActionRole::> is prepended. If it isn't prefixed with C<+> or C<~>, the role name will be searched for in C<@INC> according to the rules for L. It's possible to to apply roles to B actions of a controller without specifying the C keyword in every action definition: package MyApp::Controller::Bar use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller::ActionRole' } __PACKAGE__->config( action_roles => ['Foo', '~Bar'], ); # Has Catalyst::ActionRole::Foo and MyApp::ActionRole::Bar applied. # # If MyApp::ActionRole::Foo exists and is loadable, it will take # precedence over Catalyst::ActionRole::Foo. # # If MyApp::ActionRole::Bar exists and is loadable, it will be loaded, # but even if it doesn't exist Catalyst::ActionRole::Bar will not be loaded. sub moo : Local { ... } Additionally, roles can be applied to selected actions without specifying C using L and configured with L: package MyApp::Controller::Baz; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller::ActionRole' } __PACKAGE__->config( action_roles => [qw( Foo )], action => { some_action => { Does => [qw( ~Bar )] }, another_action => { Does => [qw( +MyActionRole::Baz )] }, }, action_args => { another_action => { customarg => 'arg1' }, } ); # has Catalyst::ActionRole::Foo and MyApp::ActionRole::Bar applied sub some_action : Local { ... } # has Catalyst::ActionRole::Foo and MyActionRole::Baz applied # and associated action class would get additional arguments passed sub another_action : Local { ... } =head1 ATTRIBUTES =head2 _action_role_prefix This class attribute stores an array reference of role prefixes to search for role names in if they aren't prefixed with C<+> or C<~>. It defaults to C<[ 'Catalyst::ActionRole::' ]>. See L. =head2 _action_roles This attribute stores an array reference of role names that will be applied to every action of this controller. It can be set by passing a C argument to the constructor. The same expansions as for C will be performed. =head1 METHODS =head2 gather_action_roles(\%action_args) Gathers the list of roles to apply to an action with the given C<%action_args>. =head1 ROLE PREFIX SEARCHING Roles specified with no prefix are looked up under a set of role prefixes. The first prefix is always C (with C replaced as appropriate for your application); the following prefixes are taken from the C<_action_role_prefix> attribute. =for Pod::Coverage BUILD =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Hans Dieter Pearcey =item * Alex J. G. Burzyński =item * John Napiorkowski =item * William King =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Florian Ragwitz. 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 ActionClass.pm000600001750001750 27411435314020 25735 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::ActionClass; use strict; use warnings; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole'; } sub one : Local ActionClass('TestActionClass') {} 1; Action000711001750001750 011435314020 22350 5ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/CatalystTestActionClass.pm000600001750001750 40311435314020 26065 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/Catalyst/Actionpackage Catalyst::Action::TestActionClass; use Moose; use namespace::clean -except => 'meta'; extends 'Catalyst::Action'; sub execute { my ( $self, $controller, $c ) = @_; $c->response->body(__PACKAGE__); }; __PACKAGE__->meta->make_immutable; 1; ExecutionViaDoes.pm000600001750001750 31211435314020 26741 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::ExecutionViaDoes; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole'; } sub one : Local Does('First') {} sub two : Local Does('First') Does('Second') {} 1; ExecutionViaConfig.pm000600001750001750 40611435314020 27260 0ustar00raflrafl000000000000Catalyst-Controller-ActionRole-0.15/t/lib/TestApp/Controllerpackage TestApp::Controller::ExecutionViaConfig; use Moose; BEGIN { extends 'Catalyst::Controller::ActionRole'; } __PACKAGE__->config( action_roles => ['Shared'] ); sub two : Local Does('First') {} sub three : Local Does('First') Does('Second') {} 1;