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, $perms)
109 Render and create a file from a template in DATA using Template
110 Toolkit. $file is the relevant chunk of the __DATA__ section, $path is
111 the path to the file, $vars is the hashref as expected by Template
112 Toolkit and $perms are desired permissions (or system defaults if not
113 set).
114
115 get_file ($class, $file)
116 Fetch file contents from the DATA section. This is used internally by
117 "render_file". $class is the name of the class to get the DATA section
118 from. __PACKAGE__ or ( caller(0) )[0] might be sensible values for
119 this.
120
121 mk_app
122 Create the main application skeleton. This is called by catalyst.pl.
123
124 mk_component ($app)
125 This method is called by create.pl to make new components for your
126 application.
127
128 mk_dir ($path)
129 Surprisingly, this function makes a directory.
130
131 mk_file ($file, $content)
132 Writes content to a file. Called by "render_file".
133
134 next_test ($test_name)
135 Calculates the name of the next numbered test file and returns it.
136 Don't give the number or the .t suffix for the test name.
137
138 get_sharedir_file
139 Method for getting a file out of share/
140
141 render_file_contents
142 Process a Template::Toolkit template.
143
144 render_sharedir_file
145 Render a template/image file from our share directory
146
148 The helpers will read author name from /etc/passwd by default. To
149 override, please export the AUTHOR variable.
150
152 Catalyst::Manual, Catalyst::Test, Catalyst::Request,
153 Catalyst::Response, Catalyst
154
156 Catalyst Contributors, see Catalyst.pm
157
159 This library is free software. You can redistribute it and/or modify it
160 under the same terms as Perl itself.
161
162
163
164perl v5.38.0 2023-07-20 Catalyst::Helper(3)