Module...:CGIApp(3pm)

πŸ“¦
version 0.44 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

Module::Starter::Plugin::CGIApp β€” a template-based module starter for CGI apps πŸ’– (yes bestie, it literally hands you a whole starter kit, no cap)


πŸŽ€ SYNOPSIS πŸŽ€

use Module::Starter qw(
    Module::Starter::Plugin::CGIApp
);

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

πŸ’– ABSTRACT πŸ’–

Okay so picture this: this is a plugin for Module::Starter that builds you a whole skeleton CGI::Application module, plus all the extra files you need to actually package it up for CPAN. And the way that you can customize the output? Via HTML::Template. Chef's kiss. 🧚


🌈 VERSION 🌈

This doc describes version 0.44 ⭐


πŸ’… DESCRIPTION πŸ’…

So this module subclasses Module::Starter::Simple and includes functionality similar to Module::Starter::Plugin::Template. Lowkey important: this doc only describes the methods that got overridden from those modules, or that are brand new here.

Only developers looking to extend this module need to read this. If you're just here to use Module::Starter::Plugin::CGIApp, be so fr and go read the docs for cgiapp-starter or titanium-starter instead. πŸ™ˆ


πŸ¦‹ METHODS πŸ¦‹

new ( %args )

This one calls the new supermethod from Module::Starter::Plugin::Simple and then initializes the template store. (Peep templates below for that. πŸ‘€)

create_distro ( %args )

Does exactly what it says on the tin, as advertised in Module::Starter. Periodt. πŸ’…

create_LICENSE( )

Makes a LICENSE file in the distribution's directory β€” the spot that holds the distribution's license terms. Iconic, honestly.

create_MANIFEST_SKIP( )

Drops a MANIFEST.SKIP file into the distribution's directory, so all the unneeded files can get skipped from inclusion in the distribution. Goodbye clutter πŸ¦‹

create_modules( @modules )

This one creates a starter module file for every module named in @modules. It's only subclassed from Module::Starter::Simple here so we can change the rtname tmpl_var to be the distro name instead of the module name. Little glow-up, huge difference ✨

create_perlcriticrc( )

Creates a perlcriticrc in the distribution's author test directory, so the behavior of perl-critic.t can be modified. Vibe check for your code, fr fr.

create_server_pl( )

Creates server.pl in the distribution's root directory. 🫢

create_t( @modules )

Creates a whole bunch of *.t files. @modules is a list of all the modules in the distribution. Test szn πŸ’–

create_tmpl( )

Takes all the template files ending in .html (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 lib/Foo/Bar/templates.

Heads up bestie: note the files will just be copied over, not rendered. πŸ™ˆ

create_xt( @modules )

Creates a bunch of *.t files for author tests. @modules is a list of all the modules in the distribution. Author tests are so main character energy. πŸ‘‘

render( $template, \%options )

You hand this method an HTML::Template and some options, and it hands you back the resulting document. So generous of it.

Data in the Module::Starter object that's a reference to an array @foo gets transformed into an array of hashes with one key called $foo_item, so it's usable inside 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>

templates ( )

Reads in the template files and populates the object's templates attribute. The module template directory gets found by checking the MODULE_TEMPLATE_DIR environment variable first, and then the config option template_dir. Environment variable ate, config option as backup. πŸ’…

Build_PL_guts($main_module, $main_pm_file)

Called by create_Build_PL, and returns the text used to populate Build.PL when the builder is Module::Build. Also, $main_pm_file is the filename of the distribution's main module, $main_module. Slay.

Changes_guts

Implements the creation of a Changes file. πŸŽ€

LICENSE_guts

Implements the creation of a LICENSE file.

Makefile_PL_guts($main_module, $main_pm_file)

Called by create_Makefile_PL, and returns the text used to populate Makefile.PL when the builder is ExtUtils::MakeMaker. Also, $main_pm_file is the filename of the distribution's main module, $main_module. Yes, same deal as before, we love a consistent API. ✨

MANIFEST_SKIP_guts

Implements the creation of a MANIFEST.SKIP file.

MI_Makefile_PL_guts($main_module, $main_pm_file)

Called by create_MI_Makefile_PL, and returns the text used to populate Makefile.PL when the builder is Module::Install. Also, $main_pm_file is the filename of the distribution's main module, $main_module. πŸ¦‹

module_guts($module, $rtname)

Implements the creation of a README file. (Yes, we know what it says. We're telling you what it says. πŸ‘€)

README_guts($build_instructions)

Implements the creation of a README file. 🌸

perlcriticrc_guts

Implements the creation of a perlcriticrc file.

server_pl_guts

Implements the creation of a server.pl file. πŸ”₯

t_guts(@modules)

Implements the creation of test files. @modules is a list of all the modules in the distribution. πŸ’–

tmpl_guts

Implements the creation of template files.

xt_guts(@modules)

Implements the creation of test files for author tests. @modules is a list of all the modules in the distribution. ⭐


πŸ“ BUGS πŸ“

Please report any bugs or feature requests to bug-module-starter-plugin-cgiapp at rt.cpan.org, or through the web interface at rt.cpan.org (http://rt.cpan.org). Bestie, the deal is: I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Communication, we love to see it. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Jaldhar H. Vyas, <jaldhar at braincells.com> πŸ’œ


Copyright (C) 2015, Consolidated Braincells Inc. All Rights Reserved.

This distribution is free software; you can redistribute it and/or modify it under the terms of either:

  1. the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
  2. the Artistic License version 1.0 or a later version.

The full text of the license can be found in the LICENSE file included with this distribution.


πŸ”₯ SEE ALSO πŸ”₯

cgiapp-starter, titanium-starter, Module::Starter, Module::Starter::Simple, Module::Starter::Plugin::Template. CGI::Application, Titanium, HTML::Template


okay that's the whole page bestie, mwah πŸ’… this was written up in the perl v5.32.1 era, dated 2022-01-30 β€” so if you're reading this from the future, hi, you're iconic, and the docs still ate. πŸŒˆπŸ’–βœ¨

πŸ“¦ where this page comes from