[Catalyst-commits] r14202 -
trunk/examples/CatalystAdvent/root/2011/pen
lukast at dev.catalyst.perl.org
lukast at dev.catalyst.perl.org
Fri Dec 9 14:37:45 GMT 2011
Author: lukast
Date: 2011-12-09 14:37:45 +0000 (Fri, 09 Dec 2011)
New Revision: 14202
Modified:
trunk/examples/CatalystAdvent/root/2011/pen/controllerrole_chainaction_massascre_1.pod
Log:
updated controllerroles
Modified: trunk/examples/CatalystAdvent/root/2011/pen/controllerrole_chainaction_massascre_1.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2011/pen/controllerrole_chainaction_massascre_1.pod 2011-12-09 14:00:23 UTC (rev 14201)
+++ trunk/examples/CatalystAdvent/root/2011/pen/controllerrole_chainaction_massascre_1.pod 2011-12-09 14:37:45 UTC (rev 14202)
@@ -176,7 +176,7 @@
To make the "get_item" action more reusable, move it to a role as shown in the following example:
- package CatalystX::ControllerRole::MyGetItem;
+ package CatalystX::TraitFor::Controller::MyGetItem;
use MooseX::MethodAttributes::Role;
@@ -211,7 +211,7 @@
For Foo:
- package CatalystX::ControllerRole::MyFoo;
+ package CatalystX::TraitFor::Controller::MyFoo;
use MooseX::MethodAttributes::Role;
@@ -229,7 +229,7 @@
and for Bar:
- package CatalystX::ControllerRole::MyBar;
+ package CatalystX::TraitFor::Controller::MyBar;
use MooseX::MethodAttributes::Role;
@@ -254,8 +254,8 @@
use Moose;
extends "Catalyst::Controller";
with qw/
- CatalystX::ControllerRole::MyGetItem
- CatalystX::ControllerRole::MyFoo
+ CatalystX::TraitFor::Controller::MyGetItem
+ CatalystX::TraitFor::Controller::MyFoo
/;
__PACKAGE__->config(
@@ -275,7 +275,7 @@
use Moose;
extends "Catalyst::Controller";
with qw/
- CatalystX::ControllerRole::MyGetItem
+ CatalystX::TraitFor::Controller::MyGetItem
/;
sub foo :Chained('get_item') :Args(0){
@@ -299,8 +299,8 @@
use Moose;
extends "Catalyst::Controller";
with qw/
- CatalystX::ControllerRole::MyGetItem
- CatalystX::ControllerRole::MyFoo
+ CatalystX::TraitFor::Controller::MyGetItem
+ CatalystX::TraitFor::Controller::MyFoo
/;
sub prepare :Chained('/') :PathPart("") :CaptureArgs(0){
@@ -325,8 +325,8 @@
use Moose;
extends "Catalyst::Controller";
with qw/
- CatalystX::ControllerRole::MyGetItem
- CatalystX::ControllerRole::MyFoo
+ CatalystX::TraitFor::Controller::MyGetItem
+ CatalystX::TraitFor::Controller::MyFoo
/;
__PACKAGE__->config(
@@ -358,7 +358,7 @@
One problem in the previous example is that the "get_item" action does more than getting one item. It can only be used by actions which
require exactly one item in the stash. By splitting "get_item" into three atomic parts, the code gets even more reusable:
- package CatalystX::ControllerRole::MyGetItem;
+ package CatalystX::TraitFor::Controller::MyGetItem;
use MooseX::MethodAttributes::Role;
@@ -411,13 +411,13 @@
The "reunion-role":
- package CatalystX::ControllerRole::ModelActions;
+ package CatalystX::TraitFor::Controller::ModelActions;
use Moose::Role;
with qw/
- CatalystX::ControllerRole::MyGetModel
- CatalystX::ControllerRole::MyGetRS
- CatalystX::ControllerRole::MyGetItem
+ CatalystX::TraitFor::Controller::MyGetModel
+ CatalystX::TraitFor::Controller::MyGetRS
+ CatalystX::TraitFor::Controller::MyGetItem
/;
no Moose::Role;
@@ -429,7 +429,7 @@
use Moose;
extends "Catalyst::Controller";
- with "CatalystX::ControllerRole::ModelActions";
+ with "CatalystX::TraitFor::Controller::ModelActions";
__PACKAGE__->meta->make_immutable;
@@ -443,8 +443,8 @@
use Moose;
extends "Catalyst::Controller";
with qw/
- CatalystX::ControllerRole::MyGetRS
- CatalystX::ControllerRole::MyGetItem
+ CatalystX::TraitFor::Controller::MyGetRS
+ CatalystX::TraitFor::Controller::MyGetItem
/;
sub get_model :Chained("/") :CaptureArgs(0) :PathPart(""){ ... }
@@ -466,7 +466,7 @@
Using attributes to store these information makes your roles configurable and much more
reusable:
- package CatalystX::ControllerRole::MyGetModel;
+ package CatalystX::TraitFor::Controller::MyGetModel;
use MooseX::MethodAttributes::Role;
@@ -499,7 +499,7 @@
use Moose;
extends "Catalyst::Controller";
- with "CatalystX::ControllerRole::ModelActions";
+ with "CatalystX::TraitFor::Controller::ModelActions";
...
@@ -518,7 +518,7 @@
This may result in conflicting names, overwritten values in the stash and a lot of trouble. Avoid this by making the
stash-keys configurable aswell. The default values can even be created dynamically:
- package CatalystX::ControllerRole::MyGetModel;
+ package CatalystX::TraitFor::Controller::MyGetModel;
use MooseX::MethodAttributes::Role;
@@ -553,7 +553,7 @@
You will have to modify your "get_resultset" action aswell:
- package CatalystX::ControllerRole::MyGetResultSet;
+ package CatalystX::TraitFor::Controller::MyGetResultSet;
use MooseX::MethodAttributes::Role;
@@ -597,7 +597,7 @@
use Moose;
extends "Catalyst::Controller";
- with "CatalystX::ControllerRole::MyRole";
+ with "CatalystX::TraitFor::Controller::MyRole";
__PACKAGE__->meta->make_immutable;
no Moose;
@@ -611,7 +611,7 @@
use Moose;
extends "Catalyst::Controller";
- with "CatalystX::ControllerRole::ChainedCRUD";
+ with "CatalystX::TraitFor::Controller::ChainedCRUD";
__PACKAGE__->meta->make_immutable;
no Moose;
More information about the Catalyst-commits
mailing list