| Catalyst-Controller-Resources documentation | Contained in the Catalyst-Controller-Resources distribution. |
Catalyst::Helper::Controller::Resources - Helper for Controller::Resources
script/create.pl controller <ControllerName> Resources [ BelongsToName ]
Makes a Resources Controller class.
Makes a Resources Controller test.
NAKAGAWA Masaki <masaki@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Controller-Resources documentation | Contained in the Catalyst-Controller-Resources distribution. |
package Catalyst::Helper::Controller::Resources; use strict; use warnings; sub mk_compclass { my ($self, $helper, $belongs_to) = @_; $helper->{belongs_to} = $belongs_to if $belongs_to; $helper->render_file('compclass', $helper->{file}); }; sub mk_comptest { my ($self, $helper) = @_; $helper->render_file('test', $helper->{test}); };
1; __DATA__ __compclass__ package [% class %]; use strict; use warnings; use base 'Catalyst::Controller::Resources'; [% IF belongs_to -%] __PACKAGE__->config(belongs_to => '[% belongs_to %]'); [% END -%]
sub list { my ($self, $c[% IF belongs_to %], $parent_id[% END %]) = @_; }
sub create { my ($self, $c[% IF belongs_to %], $parent_id[% END %]) = @_; }
sub show { my ($self, $c[% IF belongs_to %], $parent_id[% END %], $id) = @_; }
sub update { my ($self, $c[% IF belongs_to %], $parent_id[% END %], $id) = @_; }
sub destroy { my ($self, $c[% IF belongs_to %], $parent_id[% END %], $id) = @_; }
sub post { my ($self, $c[% IF belongs_to %], $parent_id[% END %]) = @_; }
sub edit { my ($self, $c[% IF belongs_to %], $parent_id[% END %], $id) = @_; }
1; __test__ use strict; use Test::More tests => 1; use_ok('[% class %]'); __END__