NAME

Module::Cooker - Module starter kit based on Template

VERSION

Version 0.01

SYNOPSIS

use Module::Cooker;
 
my $mc = Module::Cooker->new( %params );
$mc->cook();
 

DESCRIPTION

You are probably more interested in the command line interface to this module: modcooker

CONSTRUCTOR

new

Here are the default vaues for the attributes:

my $defaults = {
    minperl   => '',
    author    => 'A. Uthor',
    email     => 'author@example.com',
    profile   => 'default',
    package   => 'My::MC::Module',
    version   => 'v0.1_1',
    extravars => {},
    localdirs => [],
    nosubs    => 0,
};
 
minperl
author
email
profile
package
version
extravars
localdirs
nosubs

ACCESSORS

There is a read-only accessor provided for each of the parameters accepted by new.

You can also obtain a hash (or hashref) with the values for each parameter by using the "summary" method described below.

METHODS

cook

dist_name

print $mc->dist_name . "\n";   # prints My-MC-Module
 

Read-only method that returns the name of the distrubution as derived from the package name. This is the name that is used to create the top-level directory for the distrubution. '::' sequences are transformed to '-' in accordance with normal CPAN practice.

module_name

print $mc->module_name . "\n";   # prints Module.pm
 

Read-only method that returns the name of main module in the distrubution. This is derived by taking the final element of the package name and appending '.pm' to it.

profile_dirs

Read-only method that returns a list of directories that contain a sub-directory with the same name as the requested profile.

The method will return either an array or array reference depending upon the calling context.

template_data

my $template_data = $mc->template_data;
my %template_data = $mc->template_data;
 
print Dumper($template_data);
 
$VAR1 = {
  'author' => {
    'name'  => 'A. Uthor'
    'email' => 'author@example.com',
  },
  'modcooker' => {
    'version' => '0.01'
    'perlver' => '5.010001',
  },
  'package' => {
    'name'       => 'My::MC::Module',
    'dist_name'  => 'My-MC-Module',
    'version'    => 'v0.1_1',
    'minperl'    => '',
    'libpath'    => 'lib/My/MC',
    'module'     => 'Module.pm'
    'modulepath' => 'lib/My/MC/Module.pm',
    'timestamp'  => '2013-11-28 16:40:23',
    'year'       => '2013'
  }
};
 

Read-only method that returns a copy of the data that will be passed to Template to be used for variable substitution. It should be noted that this is a copy and changes made to the returned structure will not affect what is actually passed on.

The method will return either a hash or hash reference depending upon the calling context.

basename_dir

Read-only method that returns the absolute path to where the module is located in the @INC search path with the name of this module (Cooker) appended. This is used to located the module's standard template directories.

summary

my $summary = $mc->summary;
my %summary = $mc->summary;
 
print Dumper($summary);
 
$VAR1 = {
  'nosubs'    => 0,
  'profile'   => 'default',
  'localdirs' => [],
  'version'   => 'v0.1_1',
  'author'    => 'A. Uthor',
  'extravars' => {},
  'package'   => 'My::MC::Module',
  'minperl'   => '',
  'email'     => 'author@example.com'
};
 

Read-only method that returns a copy of the data stored in the internal attributes after object construction. It should be noted that this is a copy and changes made to the structure will not affect the object itself.

The method will return either a hash or hash reference depending upon the calling context.

AUTHOR

Jim Bacon, <jim at nortx.com>

BUGS

Please report any bugs or feature requests to bug-module-cooker at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Cooker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can also submit an issue via the GitHub repository listed below.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Module::Cooker

You can also look for information at:

ACKNOWLEDGEMENTS

This module draws heavily upon ideas found in Distribution::Cooker, Module::Maker and Module::Starter.

Special thanks goes to Perl Monk tobyink for the module name regex pattern and the Perl Monks who assisted with peer review of the code, test suite, and documentation.

SEE ALSO

Template, Jose's Guide for Creating Perl modules

LICENSE AND COPYRIGHT

Copyright 2013 Jim Bacon.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.