logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Module::Starter::Plugin::Template - module starter with templates

Author

       Ricardo SIGNES, "<rjbs at cpan.org>"

Bugs

       Please  report  any  bugs  or  feature  requests  to  the  bugtracker  for  this  project  on  GitHub at:
       <https://github.com/xsawyerx/module-starter/issues>. I will be notified, and then you'll automatically be
       notified of progress on your bug as I make changes.

Class Methods

"new(%args)"
       This plugin calls the "new" supermethod and then initializes the template store and renderer.  (See
       "templates" and "renderer" below.)

Description

       This plugin is designed to be added to a Module::Starter::Simple-compatible Module::Starter class.  It
       adds stub methods for template retrieval and rendering, and it replaces all of Simple's _guts methods
       with methods that will retrieve and render the appropriate templates.

Name

       Module::Starter::Plugin::Template - module starter with templates

Object Methods

"templates()"
       This method is used to initialize the template store on the Module::Starter object.  It returns a hash of
       templates; each key is a filename and each value is the body of the template.  The filename Module.pm is
       used for the module template.

   "renderer()"
       This method is used to initialize the template renderer.  Its result is stored in the object's "renderer"
       entry.  The implementation will determine its use.

   "render($template,\%options)"
       The "render" method will render the template passed to it, using the data in the Module::Starter object
       and in the hash of passed parameters.

   _gutsmethods
       All of the "FILE_guts" methods from Module::Starter::Simple are subclassed to look something like this:

           sub file_guts {
               my $self = shift;
               my %options;
               @options{qw(first second third)} = @_;

               my $template = $self->{templates}{filename};
               $self->render($template, \%options);
           }

       These methods will need to be rewritten when (as is likely) Module::Starter::Simple's _guts methods are
       refactored into a registry.

       module_guts
       Makefile_PL_guts
       MI_Makefile_PL_guts
       Build_PL_guts
       Changes_guts
       README_guts
       t_guts
       MANIFEST_guts
       ignores_guts

Synopsis

        use Module::Starter qw(
          Module::Starter::Simple
          Module::Starter::Plugin::Template
        );

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

Version

       version 1.77

See Also