1Catalyst::Helper(3) User Contributed Perl Documentation Catalyst::Helper(3)
2
3
4
6 Catalyst::Helper - Bootstrap a Catalyst application
7
9 catalyst.pl <myappname>
10
12 This module is used by catalyst.pl to create a set of scripts for a new
13 catalyst application. The scripts each contain documentation and will
14 output help on how to use them if called incorrectly or in some cases,
15 with no arguments.
16
17 It also provides some useful methods for a Helper module to call when
18 creating a component. See "METHODS".
19
21 _create.pl
22 Used to create new components for a catalyst application at the
23 development stage.
24
25 _server.pl
26 The catalyst test server, starts an HTTPD which outputs debugging to
27 the terminal.
28
29 _test.pl
30 A script for running tests from the command-line.
31
32 _cgi.pl
33 Run your application as a CGI.
34
35 _fastcgi.pl
36 Run the application as a fastcgi app. Either by hand, or call this from
37 FastCgiServer in your http server config.
38
40 The "_create.pl" script creates application components using Helper
41 modules. The Catalyst team provides a good number of Helper modules for
42 you to use. You can also add your own.
43
44 Helpers are classes that provide two methods.
45
46 * mk_compclass - creates the Component class
47 * mk_comptest - creates the Component test
48
49 So when you call "scripts/myapp_create.pl view MyView TT", create will
50 try to execute Catalyst::Helper::View::TT->mk_compclass and
51 Catalyst::Helper::View::TT->mk_comptest.
52
53 See Catalyst::Helper::View::TT and
54 Catalyst::Helper::Model::DBIC::Schema for examples.
55
56 All helper classes should be under one of the following namespaces.
57
58 Catalyst::Helper::Model::
59 Catalyst::Helper::View::
60 Catalyst::Helper::Controller::
61
62 COMMON HELPERS
63 · Catalyst::Helper::Model::DBIC::Schema - DBIx::Class models
64
65 · Catalyst::Helper::View::TT - Template Toolkit view
66
67 · Catalyst::Helper::Model::LDAP
68
69 · Catalyst::Helper::Model::Adaptor - wrap any class into a Catalyst
70 model
71
72 NOTE
73
74 The helpers will read author name from /etc/passwd by default. To
75 override, please export the AUTHOR variable.
76
78 mk_compclass
79 This method in your Helper module is called with $helper which is a
80 Catalyst::Helper object, and whichever other arguments the user added
81 to the command-line. You can use the $helper to call methods described
82 below.
83
84 If the Helper module does not contain a "mk_compclass" method, it will
85 fall back to calling "render_file", with an argument of "compclass".
86
87 mk_comptest
88 This method in your Helper module is called with $helper which is a
89 Catalyst::Helper object, and whichever other arguments the user added
90 to the command-line. You can use the $helper to call methods described
91 below.
92
93 If the Helper module does not contain a "mk_compclass" method, it will
94 fall back to calling "render_file", with an argument of "comptest".
95
96 mk_stuff
97 This method is called if the user does not supply any of the usual
98 component types "view", "controller", "model". It is passed the $helper
99 object (an instance of Catalyst::Helper), and any other arguments the
100 user typed.
101
102 There is no fallback for this method.
103
105 These are the methods that the Helper classes can call on the <$helper>
106 object passed to them.
107
108 render_file ($file, $path, $vars)
109 Render and create a file from a template in DATA using Template
110 Toolkit. $file is the relevent chunk of the __DATA__ section, $path is
111 the path to the file and $vars is the hashref as expected by Template
112 Toolkit.
113
114 get_file ($class, $file)
115 Fetch file contents from the DATA section. This is used internally by
116 "render_file". $class is the name of the class to get the DATA section
117 from. __PACKAGE__ or ( caller(0) )[0] might be sensible values for
118 this.
119
120 mk_app
121 Create the main application skeleton. This is called by catalyst.pl.
122
123 mk_component ($app)
124 This method is called by create.pl to make new components for your
125 application.
126
127 mk_dir ($path)
128 Surprisingly, this function makes a directory.
129
130 mk_file ($file, $content)
131 Writes content to a file. Called by "render_file".
132
133 next_test ($test_name)
134 Calculates the name of the next numbered test file and returns it.
135 Don't give the number or the .t suffix for the test name.
136
137 get_sharedir_file
138 Method for getting a file out of share/
139
140 render_file_contents
141 Process a Template::Toolkit template.
142
143 render_sharedir_file
144 Render a template/image file from our share directory
145
147 The helpers will read author name from /etc/passwd by default. To
148 override, please export the AUTHOR variable.
149
151 Catalyst::Manual, Catalyst::Test, Catalyst::Request,
152 Catalyst::Response, Catalyst
153
155 Catalyst Contributors, see Catalyst.pm
156
158 This library is free software. You can redistribute it and/or modify it
159 under the same terms as Perl itself.
160
161
162
163perl v5.12.0 2010-01-06 Catalyst::Helper(3)