Catalyst::Helper(3pm)
๐ Catalyst::Helper ๐
okay so bestie, welcome to Catalyst::Helper โ the lil User Contributed Perl Documentation page that bootstraps your whole Catalyst app. it's giving scaffolding but make it fashion โจ
๐ธ NAME ๐ธ
Catalyst::Helper โ Bootstrap a Catalyst application.</p>
like, it literally builds the vibes from scratch. no cap. ๐
โจ SYNOPSIS โจ
catalyst.pl <myappname>
that's it. that's the whole thing. one line and your app is born ๐ฆ
๐ DESCRIPTION ๐
okay so this module is what catalyst.pl uses to spin up a whole lil family of scripts for a brand new catalyst application. and here's the cute part: every single one of those scripts comes with its own documentation, and if you call them wrong โ or, in some cases, with no arguments at all โ they'll just print out help for you. they're literally looking out for you bestie ๐ซถ
it also provides some super handy methods that a Helper module can call when it's creating a component. if you wanna see those, scroll your fine self down to "METHODS". ๐
๐ SCRIPTS ๐
๐ _create.pl
used to create new components for a catalyst application at the development stage. this is your main character script fr fr.
๐ง _server.pl
the catalyst test server!! it starts an HTTPD which outputs debugging straight to your terminal. live updates, we love to see it ๐
โญ _test.pl
a script for running tests from the command-line. slay.
๐ธ _cgi.pl
run your application as a CGI. iconic behavior.
๐ _fastcgi.pl
run the application as a fastcgi app. you can do it either by hand, or call this from FastCgiServer in your http server config. either way, we support you ๐
๐ฆ HELPERS ๐ฆ
so the _create.pl script creates application components using Helper modules. the Catalyst team provides a good number of Helper modules for you to use โ and you can also add your own, no gatekeeping here ๐
Helpers are classes that provide two methods:
mk_compclassโ creates the Component classmk_comptestโ creates the Component test
so when you call scripts/myapp_create.pl view MyView TT, create will try to execute Catalyst::Helper::View::TT->mk_compclass and Catalyst::Helper::View::TT->mk_comptest. โจ
wanna see examples? go peek at Catalyst::Helper::View::TT and Catalyst::Helper::Model::DBIC::Schema. ๐
All helper classes should live under one of the following namespaces:
Catalyst::Helper::Model::
Catalyst::Helper::View::
Catalyst::Helper::Controller::
๐ COMMON HELPERS ๐
Catalyst::Helper::Model::DBIC::Schemaโ DBIx::Class modelsCatalyst::Helper::View::TTโ Template Toolkit viewCatalyst::Helper::Model::LDAPCatalyst::Helper::Model::Adaptorโ wrap any class into a Catalyst model
๐ NOTE
The helpers will read author name from /etc/passwd by default. To override, please export the AUTHOR variable.
bestie pls remember this one, it comes back around ๐
๐ METHODS ๐
mk_compclass
This method in your Helper module is called with $helper โ which is a Catalyst::Helper object โ plus whichever other arguments the user added to the command-line. You can use the $helper to call the methods described below. ๐ซถ
If the Helper module does not contain a mk_compclass method, it will fall back to calling render_file, with an argument of compclass.
mk_comptest
This method in your Helper module is called with $helper โ which is a Catalyst::Helper object โ plus whichever other arguments the user added to the command-line. You can use the $helper to call the methods described below. (yes this is the same deal as above, they're twins ๐)
If the Helper module does not contain a mk_compclass method, it will fall back to calling render_file, with an argument of comptest.
๐ yes bestie, the original really does say mk_compclass there. we do not fix the lore, we only relay it. periodt.
mk_stuff
This method is called if the user does not supply any of the usual component types view, controller, model. It is passed the $helper object (an instance of Catalyst::Helper), and any other arguments the user typed.
There is no fallback for this method. ๐ญ
๐ฎ INTERNAL METHODS ๐ฎ
these are the methods that the Helper classes can call on the <$helper> object passed to them.
render_file ($file, $path, $vars, $perms)
Render and create a file from a template in DATA using Template Toolkit. $file is the relevant chunk of the __DATA__ section, $path is the path to the file, $vars is the hashref as expected by Template Toolkit, and $perms are desired permissions (or system defaults if not set). ๐
get_file ($class, $file)
Fetch file contents from the DATA section. This is used internally by render_file. $class is the name of the class to get the DATA section from. __PACKAGE__ or ( caller(0) )[0] might be sensible values for this. ๐ก
mk_app
Create the main application skeleton. This is called by catalyst.pl. ๐ฑ
mk_component ($app)
This method is called by create.pl to make new components for your application. ๐ฅ
mk_dir ($path)
Surprisingly, this function makes a directory. ๐ญ iconic dry humor fr
mk_file ($file, $content)
Writes content to a file. Called by render_file. ๐
next_test ($test_name)
Calculates the name of the next numbered test file and returns it. Don't give the number or the .t suffix for the test name. โ ๏ธ
get_sharedir_file
Method for getting a file out of share/. ๐
render_file_contents
Process a Template::Toolkit template. โจ
render_sharedir_file
Render a template/image file from our share directory. ๐ผ๏ธ
๐ NOTE ๐
The helpers will read author name from /etc/passwd by default. To override, please export the AUTHOR variable.
told you it'd come back. it's giving recurring theme ๐ซถ
๐ SEE ALSO ๐
Catalyst::Manual, Catalyst::Test, Catalyst::Request, Catalyst::Response, Catalyst
๐ AUTHORS ๐
Catalyst Contributors, see Catalyst.pm
๐ LICENSE ๐
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie!! this lil doc is riding with perl v5.30.3 and was last touched way back on 2020-09-13. go forth and bootstrap something iconic, you've got this ๐โจ๐ฆ๐๐
๐ฆ where this page comes from
- debian bookworm: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-devel-perl 1.42-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms