Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Dev

PATCH - Multiple ActionClass attributes

 

 

Catalyst dev RSS feed   Index | Next | Previous | View Threaded


jonas.alves at gmail

Feb 28, 2007, 6:42 AM

Post #1 of 13 (4317 views)
Permalink
PATCH - Multiple ActionClass attributes

Hi,

I wrote a patch that permits to use multiple ActionClass attributes in a
controller action.
Here is the synopsys:

=head1 USING MULTIPLE ACTIONS

To use multiple actions you just need to had more ActionClass
attributes:

sub Hello :Local :ActionClass('SayBefore') ActionClass('SayAfter') {
$c->res->output( 'Hello '.$c->stash->{what} );
}

Attention that if you are using multiple actions you probably want to
use Class::C3 dispatch order. With NEXT just the first ActionClass will
be called. Here you have an example:

package Catalyst::Action::SayBefore;
use Class::C3;
use base 'Catalyst::Action';

sub execute {
my $self = shift;
my ( $controller, $c, $test ) = @_;
$c->stash->{what} = 'world';
$self->next::method( @_ );
};

1;

package Catalyst::Action::SayAfter;
use Class::C3;
use base 'Catalyst::Action';

sub execute {
my $self = shift;
my ( $controller, $c, $test ) = @_;
$self->next::method( @_ );
$c->res->output( 'Bye '.$c->stash->{what} );
};

1;

Patch with tests and docs attached.
Attachments: catalyst_multiple_action_classes.diff (3.25 KB)
  documentation.diff (1.31 KB)


jonas.alves at gmail

Mar 11, 2007, 3:55 PM

Post #2 of 13 (4103 views)
Permalink
Re: PATCH - Multiple ActionClass attributes [In reply to]

On 28/02/07, Jonas Alves <jonas.alves [at] gmail> wrote:
>
> Hi,
>
> I wrote a patch that permits to use multiple ActionClass attributes in a
> controller action.
> Here is the synopsys:
>
> =head1 USING MULTIPLE ACTIONS
>
> To use multiple actions you just need to had more ActionClass
> attributes:
>
> sub Hello :Local :ActionClass('SayBefore') ActionClass('SayAfter') {
> $c->res->output( 'Hello '.$c->stash->{what} );
> }
>
> Attention that if you are using multiple actions you probably want to
> use Class::C3 dispatch order. With NEXT just the first ActionClass will
> be called. Here you have an example:
>
> package Catalyst::Action::SayBefore;
> use Class::C3;
> use base 'Catalyst::Action';
>
> sub execute {
> my $self = shift;
> my ( $controller, $c, $test ) = @_;
> $c->stash->{what} = 'world';
> $self->next::method( @_ );
> };
>
> 1;
>
> package Catalyst::Action::SayAfter;
> use Class::C3;
> use base 'Catalyst::Action';
>
> sub execute {
> my $self = shift;
> my ( $controller, $c, $test ) = @_;
> $self->next::method( @_ );
> $c->res->output( 'Bye '.$c->stash->{what} );
> };
>
> 1;
>
> Patch with tests and docs attached.
>
>
It appears that no one is interested in having this in core. I can rewrote
it as a plugin or as a base controller. What do you guys think is more sane?

Cheers,
--
Jonas Alves


adam at stalecoffee

Mar 11, 2007, 4:38 PM

Post #3 of 13 (4091 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [In reply to]

On Mar 11, 2007, at 3:55 PM, Jonas Alves wrote:
>
> It appears that no one is interested in having this in core. I can
> rewrote it as a plugin or as a base controller. What do you guys
> think is more sane?

A base controller.

Adam



_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


dbix-class at trout

May 8, 2007, 10:36 AM

Post #4 of 13 (3984 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [In reply to]

On Sun, Mar 11, 2007 at 10:55:20PM +0000, Jonas Alves wrote:
> It appears that no one is interested in having this in core. I can rewrote
> it as a plugin or as a base controller. What do you guys think is more sane?

Neither. Instead, help us get -current converted to Moose so we can do
this with runtime role application - the massively better elegance of this
solution is the reason the last couple patches like yours have been rejected.

Next time, RFC modifications like this before you get started - it'll save
you a lot of wasted effort :)

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


jjn1056 at yahoo

May 8, 2007, 2:09 PM

Post #5 of 13 (3995 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

--- Matt S Trout <dbix-class [at] trout> wrote:

> On Sun, Mar 11, 2007 at 10:55:20PM +0000, Jonas
> Alves wrote:
> > It appears that no one is interested in having
> this in core. I can rewrote
> > it as a plugin or as a base controller. What do
> you guys think is more sane?
>
> Neither. Instead, help us get -current converted to
> Moose so we can do
> this with runtime role application - the massively
> better elegance of this
> solution is the reason the last couple patches like
> yours have been rejected.
>
> Next time, RFC modifications like this before you
> get started - it'll save
> you a lot of wasted effort :)

Migrating the Catalyst codebase to Moose sounds
fantastic yet almost seems like a rewrite. Is there
the rumblings of a TODO list for this anywhere since
I'd like to be involved, after catching up on some of
the other things I'm committed to.

--john

--john

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


email at jasonkohles

May 8, 2007, 2:25 PM

Post #6 of 13 (3998 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

On May 8, 2007, at 5:09 PM, John Napiorkowski wrote:

>
> --- Matt S Trout <dbix-class [at] trout> wrote:
>
>> On Sun, Mar 11, 2007 at 10:55:20PM +0000, Jonas
>> Alves wrote:
>>> It appears that no one is interested in having
>> this in core. I can rewrote
>>> it as a plugin or as a base controller. What do
>> you guys think is more sane?
>>
>> Neither. Instead, help us get -current converted to
>> Moose so we can do
>> this with runtime role application - the massively
>> better elegance of this
>> solution is the reason the last couple patches like
>> yours have been rejected.
>>
>> Next time, RFC modifications like this before you
>> get started - it'll save
>> you a lot of wasted effort :)
>
> Migrating the Catalyst codebase to Moose sounds
> fantastic yet almost seems like a rewrite. Is there
> the rumblings of a TODO list for this anywhere since
> I'd like to be involved, after catching up on some of
> the other things I'm committed to.
>
Is there seriously effort being put into converting Catalyst to
Moose? Is there a list of people who are interested in forking
rather than going that route? Moose is the main reason I gave up on
trying to do anything with Reaction.

--
Jason Kohles
email [at] jasonkohles
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire



_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


dbix-class at trout

May 9, 2007, 7:02 AM

Post #7 of 13 (3978 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

On Tue, May 08, 2007 at 05:25:35PM -0400, Jason Kohles wrote:
> Is there seriously effort being put into converting Catalyst to
> Moose? Is there a list of people who are interested in forking
> rather than going that route? Moose is the main reason I gave up on
> trying to do anything with Reaction.

Why?

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


dbix-class at trout

May 9, 2007, 7:05 AM

Post #8 of 13 (3992 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

On Tue, May 08, 2007 at 02:09:42PM -0700, John Napiorkowski wrote:
> Migrating the Catalyst codebase to Moose sounds
> fantastic yet almost seems like a rewrite. Is there
> the rumblings of a TODO list for this anywhere since
> I'd like to be involved, after catching up on some of
> the other things I'm committed to.

Not really, the trick will be providing things like mk_accessors in terms
of Moose so everything works basically unchanged and both we and the users
can migrate at will (or just pretend it's still Class::Accessor::Fast, with
immutable in place performance is basically equivalent). Marcus did this in
a branch during the 5.70 dev push but we decided then the performance and
maturity weren't sufficient; it's about time somebody tried it again.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


dbix-class at trout

May 10, 2007, 10:45 PM

Post #9 of 13 (3984 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

On Tue, May 08, 2007 at 05:25:35PM -0400, Jason Kohles wrote:
> Is there seriously effort being put into converting Catalyst to
> Moose? Is there a list of people who are interested in forking
> rather than going that route? Moose is the main reason I gave up on
> trying to do anything with Reaction.

Seriously. Please can you explain why you'd feel so strongly about
Catalyst converting to Moose that you'd want to fork the project?

Making an assertion like that and then not explaining why - especially
when we've got a substantial number of users who've come out in favour of
Moose - seems to me to be a little unfair.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


email at jasonkohles

May 14, 2007, 7:22 AM

Post #10 of 13 (3954 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [OT] [In reply to]

On May 11, 2007, at 1:45 AM, Matt S Trout wrote:

> On Tue, May 08, 2007 at 05:25:35PM -0400, Jason Kohles wrote:
>> Is there seriously effort being put into converting Catalyst to
>> Moose? Is there a list of people who are interested in forking
>> rather than going that route? Moose is the main reason I gave up on
>> trying to do anything with Reaction.
>
> Seriously. Please can you explain why you'd feel so strongly about
> Catalyst converting to Moose that you'd want to fork the project?
>
> Making an assertion like that and then not explaining why -
> especially
> when we've got a substantial number of users who've come out in
> favour of
> Moose - seems to me to be a little unfair.
>
Sorry, I didn't mean to troll and run, I have been working on writing
up some of my
thoughts on this subject, but my wife ended up in the emergency room
on Thursday
and needed surgery on Friday, so I've been a little tied up...

In fairness though, I may be having a change of heart. When I went
back and started
organizing my thoughts on the subject in preparation for sharing them
I found that the
list of things that I considered to be Moose related issues wasn't as
large as I thought
it was, and the list of things that could simply be attributed to the
early-development
nature of Reaction was larger than I thought it was, so I probably
just got off on the
wrong foot by tackling Reaction and Moose together... I've been re-
reviewing the
Moose documentation and I can definitely see potential for some very
useful features
that it could bring to Catalyst (and to DBIx::Class, which I've seen
is also slated for
Moosification at some point). In particular, the Cat app I'm working
on right now has
acquired a hodge-podge of controller base classes to add various
features to my
controller classes in various combinations and the Moose role support
could make
that whole process a whole lot smoother.

I am still planning to finish the writeup I started though, some of
the things that
bothered me initially about Moose may just be my lack of
understanding, and some
may be things that actually need some careful thought, but my comment
about
forking was probably overly dramatic.

--
Jason Kohles
email [at] jasonkohles
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire



_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


jonas.alves at gmail

Nov 6, 2007, 10:33 AM

Post #11 of 13 (3308 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [In reply to]

On 08/05/2007, Matt S Trout <dbix-class [at] trout> wrote:
> On Sun, Mar 11, 2007 at 10:55:20PM +0000, Jonas Alves wrote:
> > It appears that no one is interested in having this in core. I can rewrote
> > it as a plugin or as a base controller. What do you guys think is more sane?
>
> Neither. Instead, help us get -current converted to Moose so we can do
> this with runtime role application - the massively better elegance of this
> solution is the reason the last couple patches like yours have been rejected.
>
> Next time, RFC modifications like this before you get started - it'll save
> you a lot of wasted effort :)
>

Hi Matt,
Sorry for taking so long to answer.
How is that migration to Moose going? Can I ask a TPF grant to make this happen?

Cheers,
--
Jonas

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


jon at jrock

Nov 6, 2007, 11:58 AM

Post #12 of 13 (3316 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [In reply to]

Jonas Alves wrote:
> How is that migration to Moose going? Can I ask a TPF grant to make this happen?
>

Hi Jonas,

Right now, most of the planning for the moose migration is happening on
IRC (and in person actually) between myself, mst, stevan, and
nothingmuch. There is a moose-experiment branch in svn, but it isn't
that exciting at the moment.

Come chat with us so that we can give you an idea of what we're
thinking. That will give you a better foundation for your grant proposal.

Regards,
Jonathan Rockway
Attachments: signature.asc (0.36 KB)


jonas.alves at gmail

Nov 6, 2007, 12:29 PM

Post #13 of 13 (3310 views)
Permalink
Re: Re: PATCH - Multiple ActionClass attributes [In reply to]

On 06/11/2007, Jonathan Rockway <jon [at] jrock> wrote:
> Jonas Alves wrote:
> > How is that migration to Moose going? Can I ask a TPF grant to make this happen?
> >
>
> Hi Jonas,
>
> Right now, most of the planning for the moose migration is happening on
> IRC (and in person actually) between myself, mst, stevan, and
> nothingmuch. There is a moose-experiment branch in svn, but it isn't
> that exciting at the moment.
>
> Come chat with us so that we can give you an idea of what we're
> thinking. That will give you a better foundation for your grant proposal.
>
> Regards,
> Jonathan Rockway
>

Hi Jonathan,
I usually don't use irc, but I will jump there for some chat. :)

--
Jonas

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev

Catalyst dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.