Module::New::File
package Your::Module::New::File::Something; use Module::New::File; file '{MAINFILE}' => content { return <<'TEMPLATE'; # following is a Mojo-like template for a module. package <%= $c->module %>; use strict; use warnings; sub new { bless {}, shift; } 1; TEMPLATE };
specifies the relative path of a file to create. {MAINFILE} becomes lib/Path/To/Module.pm you specified as a command line argument, and {MAINDIR} becomes lib/Path/To/Module.
{MAINFILE}
lib/Path/To/Module.pm
{MAINDIR}
lib/Path/To/Module
just a syntax sugar of sub { }. The subroutine takes a context object, and should return a scalar text. Of course you can freely use template engines (you might want to extend the context to hold a template engine object to reuse). As of 0.02, Module::New uses Text::MicroTemplate, a fork of Mojo::Template by default.
sub { }
Kenichi Ishigaki, <ishigaki@cpan.org>
Copyright (C) 2007-2009 by Kenichi Ishigaki.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Module::New, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::New
CPAN shell
perl -MCPAN -e shell install Module::New
For more information on module installation, please visit the detailed CPAN module installation guide.