Check this out: <a href="http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/ExtendingCatalyst.pod#Attributes">http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/ExtendingCatalyst.pod#Attributes</a> and <a href="http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/ExtendingCatalyst.pod#Action_classes">http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/ExtendingCatalyst.pod#Action_classes</a><br>
<br><br><div class="gmail_quote">On Mon, Jul 13, 2009 at 12:27 AM, Toby Corkindale <span dir="ltr"><<a href="mailto:toby.corkindale@strategicdata.com.au">toby.corkindale@strategicdata.com.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Toby Corkindale wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
I wondered if anyone could point me towards a working example of creating custom action attribute handlers for Catalyst?<br>
<br>
eg. The contents of Catalyst::Controller::SecretAgent in the example below:<br>
<br>
<br>
package MyApp::Controller::M;<br>
use parent 'Catalyst::Controller::SecretAgent';<br>
# Provides Vehicle() and Gimmick() actions.<br>
<br>
sub bond : Vehicle('Aston Martin') {<br>
my ($self, $c) = @_;<br>
# ...<br>
}<br>
<br>
sub maxwell_smart : Gimmick('Shoe-phone') {<br>
My ($self, $c) = @_;<br>
#...<br>
}<br>
<br>
1;<br>
</blockquote>
<br>
<br></div>
I should clarify what I'm after..<br>
I'd still like to be able to specify regular DispatchType attributes against the routines (eg. Local, Chained, etc), but I'd also like to have my own methods called against the other attributes I've specified.<br>
<br>
The first method I tried was:<br>
package Catalyst::Controller::SecretAgent;<br>
use strict / use warnings<br>
use parent 'Catalyst::Controller';<br>
use attributes __PACKAGE__ => \&set_vehicle, "Vehicle";<br>
sub set_vehicle { # do something }<br>
...<br>
<br>
but I think that messes up catalyst's own handling of attributes.<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Devin Austin<br><a href="http://www.codedright.net">http://www.codedright.net</a><br><a href="http://www.dreamhost.com/r.cgi?326568/hosting.html">http://www.dreamhost.com/r.cgi?326568/hosting.html</a> - Host with DreamHost!<br>