initial import of catalyst.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Manual / Cookbook.pod
CommitLineData
fc7ec1d9 1=head1 NAME
2
3Catalyst::Manual::Cookbook - Cooking with Catalyst
4
5=head1 DESCRIPTION
6
7Yummy!
8
9=head1 RECIPES
10
11=head2 Force debug screen
12
13You can force Catalyst to display the debug screen at the end of the request by
14placing a die() call in the _end action.
15
16 __PACKAGE__->action(
17 '!end' => sub {
18 my ( $self, $c ) = @_;
19 die "testing";
20 }
21 );
22
23=head2 Disable statistics
24
25Just add this line to your application class if you don't want those nifty
26statistics in your debug messages.
27
28 sub Catalyst::Log::info { }
29
30=head2 Scaffolding
31
32Scaffolding is very simple with Catalyst.
33Just use Catalyst::Model::CDBI::CRUD as baseclass.
34
35 # lib/MyApp/Model/CDBI.pm
36 package MyApp::Model::CDBI;
37
38 use strict;
39 use base 'Catalyst::Model::CDBI::CRUD';
40
41 __PACKAGE__->config(
42 dsn => 'dbi:SQLite:/tmp/myapp.db',
43 relationships => 1
44 );
45
46 1;
47
48 # lib/MyApp.pm
49 package MyApp;
50
51 use Catalyst 'FormValidator';
52
53 __PACKAGE__->config(
54 name => 'My Application',
55 root => '/home/joeuser/myapp/root'
56 );
57
58 __PACKAGE__->action(
59 'table' => sub {
60 my ( $self, $c ) = @_;
61 $c->form( optional => [ MyApp::Model::CDBI::Table->columns ] );
62 $c->forward('MyApp::Model::CDBI::Table');
63 }
64 );
65
66 1;
67
68Modify the $c->form() parameters to match your needs, and don't forget to copy
69the templates. ;)
70
71=head1 AUTHOR
72
73Sebastian Riedel, C<sri@oook.de>
74
75=head1 COPYRIGHT
76
77This program is free software, you can redistribute it and/or modify it under
78the same terms as Perl itself.