CGI::Ap...Starter(3)

πŸ“¦ version 0.015, in fedora 43, fedora 44

✨ CGI::Ap...Starter(3) ✨

hiii bestie πŸ’– so this is a page from the User Contributed Perl Documentation, and it's literally about a little module starter that slays. buckle up, we're doing this together 🫢


🌸 NAME 🌸

CGI::Application::Structured::Tools::Starter β€” a template based module starter for CGI::Application::Structured apps. it's giving scaffolding, it's giving "here's your whole skeleton already done" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Module::Starter qw(
    Module::Starter::Simple
    Module::Starter::Plugin::Template
    CGI::Application::Structured::Tools::Starter
);

Module::Starter->create_distro(%args);

πŸ¦‹ ABSTRACT πŸ¦‹

okay so the preferred way to use this module? bestie, don't even come at it directly. go through the cas-starter.pl in scripts script. that's the move. periodt.


⭐ VERSION ⭐

Version 0.015. that's the one. πŸ‘‘


🌈 DESCRIPTION 🌈

so this is a plugin for Module::Starter πŸ’– what it does is build you a skeleton CGI::Application::Structured module, plus all the extra little files you need to actually package it up for CPAN. no cap, it also generates:

  • an CGI::Application::Structured controller base class for your modules
  • a customized CGI::Application::Dispatch subclass
  • a preconfigured development config file
  • a server.pl that runs out of the box
  • helper scripts to generate Controller modules subclasses
  • a helper script to generate DBIx::Class schema and result classes.

and like, credit where it's due β€” this module is inspired by Module::Starter::Plugin::CGIApp by Jaldhar H. Vyas. iconic behavior, we love an homage 🫢


πŸ’œ METHODS πŸ’œ

πŸ’– new ( %args ) πŸ’–

this method calls the new supermethod from Module::Starter::Plugin::Template and then initializes the template store and renderer. (see templates and renderer below, bestie, they're literally right there.)

πŸ’– create_distro ( %args ) πŸ’–

this method works as advertised in Module::Starter. no notes. it does what it says on the tin ✨

πŸ’– create_t( @modules ) πŸ’–

this method creates a bunch of *.t files. @modules is a list of all modules in the distribution. test files go brrr 🌸

πŸ’– render( $template, \%options ) πŸ’–

this method is subclassed from Module::Starter::Plugin::Template.

it is given an HTML::Template and options and returns the resulting document.

here's the cute part: data in the Module::Starter object which represents a reference to an array @foo is transformed into an array of hashes with one key called $foo_item in order to make it usable in an HTML::Template TMPL_LOOP. for example:

$data = ['a'. 'b', 'c'];

would become:

$data = [
    { data_item => 'a' },
    { data_item => 'b' },
    { data_item => 'c' },
];

so that in the template you could say:

<tmpl_loop data>
    <tmpl_var data_item>
</tmpl_loop>

the way that transformation works?? obsessed. πŸ’…

πŸ’– renderer () πŸ’–

this method is subclassed from Module::Starter::Plugin::Template but doesn't do anything, because the actual template is created by render in this implementation. it's the friend who shows up to the group hang and contributes ✨vibes✨ only. and honestly? valid.

πŸ’– templates () πŸ’–

this method is subclassed from Module::Starter::Plugin::Template.

it reads in the template files and populates the object's templates attribute. the module template directory is found by checking the MODULE_TEMPLATE_DIR environment variable and then the config option template_dir. yes bestie, in that order β€” env var first, config option second. iykyk πŸ¦‹

πŸ’– create_MANIFEST_SKIP() πŸ’–

this method creates a MANIFEST.SKIP file in the distribution's directory so that unneeded files can be skipped from inclusion in the distribution. bye bye, clutter πŸ‘‹

πŸ’– create_perlcriticrc () πŸ’–

this method creates a perlcriticrc in the distribution's test directory so that the behavior of perl-critic.t can be modified. tune it how you like, bestie πŸŽ€

πŸ’– create_server_pl () πŸ’–

this method creates server.pl in the distribution's root directory. just. right there. in the root. πŸ”₯

πŸ’– create_debug_sh () πŸ’–

this method creates debug.sh in the distribution's root directory. starts werver with environment set to display ::Plugin::DebugScreen on error. debug mode but make it ✨dramatic✨ πŸ’€

πŸ’– create_config_pl () πŸ’–

this method creates config-test.pl in the distribution's root/config directory.

πŸ’– create_create_pl () πŸ’–

this method creates create_controller.pl in the distribution's app/script directory.

πŸ’– create_tmpl () πŸ’–

this method takes all the template files ending in .tmpl (representing HTML::Template's) and installs them into a directory under the distro tree. for instance, if the distro was called Foo-Bar, the templates would be installed in Foo-Bar/templates.

note: the files will just be copied over, not rendered. so don't come for me when your template vars are still sitting there raw. πŸ™ˆ

πŸ’– create_submodule () πŸ’–

implements a default Home subclass of the main module. this module will be auto configured as the default module in the Dispatch subclass. main character energy, fr fr πŸ‘‘

πŸ’– create_submodule () πŸ’–

implements a default controller baseclass (main module).

(yes bestie, it's listed twice with the same name in the original. we don't ask questions, we just transcribe πŸ’…)

πŸ’– create_dbic_pl () πŸ’–

this method creates create_dbic_schema.pl in the distribution's root/script/ directory.

πŸ’– create_dispatch () πŸ’–

implements a CGI::Application::Dispatch subclass for this app in the lib directory under the main modules directory. routing, but cute 🌈


😭 BUGS 😭

please report any bugs or feature requests through the web interface at <http://rt.cpan.org>. the author will be notified, and then you'll automatically be notified of progress on your bug as changes are made. closed loop communication, we love to see it 🫢


🌟 AUTHOR 🌟

Gordon Van Amburg, <vanamburg at cpan.org>


πŸ’ ACKNOWLEDGEMENT πŸ’

this module borrows heavily, is verily grafted from, Module::Starter::Plugin::CGIApp by Jaldhar H. Vyas, <jaldhar at braincells.com>. "verily grafted"?? the drama, the poetry, we stan 🌸


this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. free as in bestie, go off πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

  • CGI::Application::Structured-starter
  • CGI::Application::Structured
  • CGI::Application
  • Module::Starter::Plugin::CGIApplication

and that's the whole page, bestie!! πŸ’… this was perl v5.42.0, dated 2025-07-25, and yeah β€” that footer is literally CGI::Ap...Starter(3) all over again, we've come full circle πŸ¦‹βœ¨ love u, go build something iconic πŸ’–

πŸ“¦ where this page comes from