[Catalyst] Help System - Can a controller's index capture the
remainder of the path as a series of arguments?
Kyle Hall
kyle.m.hall at gmail.com
Thu Mar 31 17:02:55 GMT 2011
Thanks to Bill and David the info. I'm still learning how to use
Catalyst, it's almost overwhelming when compared to CakePHP ( which is
what I started with as my first framework ) here is what I've got:
My button: <a href="[% c.uri_for('/help', c.action ) %]"
class="button" id="menu-help">Help</a>
My Help controller:
sub index : Chained('/') PathPart('help') Args {
my ( $self, $c, @path ) = @_;
my $path = join('/', @path);
$c->stash->{template} = "help/$path.tt";
}
Seems to work fine. Any suggestions for improvements?
Kyle
http://www.kylehall.info
Mill Run Technology Solutions ( http://millruntech.com )
Crawford County Federated Library System ( http://www.ccfls.org )
Meadville Public Library ( http://www.meadvillelibrary.org )
On Thu, Mar 31, 2011 at 12:32 PM, David Schmidt <davewood at gmx.at> wrote:
> On Thu, Mar 31, 2011 at 6:22 PM, Bill Crawford
> <billcrawford1970 at gmail.com> wrote:
>> On 31 March 2011 17:21, Bill Crawford <billcrawford1970 at gmail.com> wrote:
>>> sub help : Chained('/') Args {
>>> my ( $self, $c, @path ) = @_;
>>>
>>> my $path = join('/', @path);
>>> ...
>>> }
>>
>> Uh, : Chained('/') PathPart('help') Args { ...
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
> And use
>
> http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80032/lib/Catalyst/Request.pm#$req-%3Epath
>
> for creating the link of the help button
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list