Module-Starter-1.73/0000755000175000017500000000000013143242255013714 5ustar grinnzgrinnzModule-Starter-1.73/README0000644000175000017500000000126613064625343014606 0ustar grinnzgrinnzNAME Module::Starter - a simple starter kit for any module Module::Starter is used to create a skeletal CPAN distribution, including basic builder scripts, tests, documentation, and module code. For more information, refer to the documentation for module-starter, Module::Starter, and Module::Starter::Simple. AUTHORS Andy Lester, "" Ricardo Signes, "" C.J. Adams-Collier, "" COPYRIGHT Copyright 2004-7 Andy Lester, Ricardo Signes, C.J. Adams-Collier, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Module-Starter-1.73/bin/0000755000175000017500000000000013143242255014464 5ustar grinnzgrinnzModule-Starter-1.73/bin/module-starter0000755000175000017500000000632113064625343017370 0ustar grinnzgrinnz#!/usr/bin/perl -w =head1 NAME module-starter - creates a skeleton module distribution =cut use warnings; use strict; use Module::Starter::App; Module::Starter::App->run; =head1 SYNOPSIS module-starter [options] Options: --module=module Module name (required, repeatable) --distro=name Distribution name (optional) --dir=dirname Directory name to create new module in (optional) --builder=module Build with 'ExtUtils::MakeMaker' or 'Module::Build' --eumm Same as --builder=ExtUtils::MakeMaker --mb Same as --builder=Module::Build --mi Same as --builder=Module::Install --author=name Author's name (taken from getpwuid if not provided) --email=email Author's email (taken from EMAIL if not provided) --ignores=type Ignore type files to include (repeatable) --license=type License under which the module will be distributed (default is artistic2) --minperl=ver Minimum Perl version required (optional; default is 5.006) --fatalize Generate code that causes all warnings to be fatal with: use warnings FATAL => 'all' --verbose Print progress messages while working --force Delete pre-existing files if needed --help Show this message Available Licenses: perl, artistic, artistic2, mit, mozilla, mozilla2, bsd, freebsd, cc0, gpl, lgpl, gpl3, lgpl3, agpl3, apache, qpl Available Ignore Types: cvs, git, hg, manifest, generic (NOTE: If manifest is included, the MANIFEST file will be skipped and only a MANIFEST.SKIP file will be included.) Example: module-starter --module=Foo::Bar,Foo::Bat \ --author="Andy Lester" --email=andy@petdance.com =head1 DESCRIPTION C is a command-line interface to L, which it uses to perform all the work of creating distributions. An alternate backend for C can be specified with the C<--class> option. Plugins to the standard Module::Starter module can be specified with one or more C<--plugin> options. If no directory name is supplied, the distribution name will be used for the directory. If no distribution name is supplied, the first listed module name will be used as the distribution name. Multiple --builder options may be supplied to produce the files for multiple builders. =head1 CONFIGURATION module-starter will look for a configuration file before reading its command line parameters. The default location is C<$HOME/.module-starter/config> but if the MODULE_STARTER_DIR environment variable is set, module-starter will look for C in that directory. The configuration file is just a list of names and values, separated by colons. Values that take lists are just space separated. Note that the C<--ignores> command line parameter corresponds to the C configuration file entry. A sample configuration file might read: author: Ricardo SIGNES email: rjbs@cpan.org ignores_type: git plugins: Module::Starter::Simple Module::Starter::Plugin::XYZ xyz_option: red green blue This format may become more elaborate in the future, but a file of this type should remain valid. =cut Module-Starter-1.73/MANIFEST0000644000175000017500000000145713143242255015054 0ustar grinnzgrinnzbin/module-starter Changes getting-started.html lib/Module/Starter.pm lib/Module/Starter/App.pm lib/Module/Starter/BuilderSet.pm lib/Module/Starter/Plugin.pod lib/Module/Starter/Plugin/Template.pm lib/Module/Starter/Simple.pm LICENSE Makefile.PL MANIFEST perlcriticrc README t/00-load.t t/BuilderSet.t t/data/templates/Build.PL t/data/templates/Changes t/data/templates/Makefile.PL t/data/templates/Module.pm t/data/templates/README t/data/templates/t/00-load.t t/data/templates/t/boilerplate.t t/data/templates/t/pod-coverage.t t/data/templates/t/pod.t t/lib/Module/Starter/TestPlugin.pm t/module-starter.t t/pod-coverage.t t/pod.t t/test-dist.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Module-Starter-1.73/lib/0000755000175000017500000000000013143242255014462 5ustar grinnzgrinnzModule-Starter-1.73/lib/Module/0000755000175000017500000000000013143242255015707 5ustar grinnzgrinnzModule-Starter-1.73/lib/Module/Starter.pm0000644000175000017500000001147313143167764017712 0ustar grinnzgrinnzpackage Module::Starter; use warnings; use strict; use Carp qw( croak ); use Module::Runtime qw( require_module ); =head1 NAME Module::Starter - a simple starter kit for any module =head1 VERSION Version 1.73 =cut our $VERSION = '1.73'; =head1 SYNOPSIS Nothing in here is meant for public consumption. Use F from the command line. module-starter --module=Foo::Bar,Foo::Bat \ --author="Andy Lester" --email=andy@petdance.com =head1 DESCRIPTION This is the core module for Module::Starter. If you're not looking to extend or alter the behavior of this module, you probably want to look at L instead. Module::Starter is used to create a skeletal CPAN distribution, including basic builder scripts, tests, documentation, and module code. This is done through just one method, C. =head1 METHODS =head2 Module::Starter->create_distro(%args) C is the only method you should need to use from outside this module; all the other methods are called internally by this one. This method creates orchestrates all the work; it creates distribution and populates it with the all the requires files. It takes a hash of params, as follows: distro => $distroname, # distribution name (defaults to first module) modules => [ module names ], # modules to create in distro dir => $dirname, # directory in which to build distro builder => 'Module::Build', # defaults to ExtUtils::MakeMaker # or specify more than one builder in an # arrayref license => $license, # type of license; defaults to 'artistic2' author => $author, # author's full name (taken from C if not provided) email => $email, # author's email address (taken from C if not provided) ignores_type => $type, # ignores file type ('generic', 'cvs', 'git', 'hg', 'manifest' ) fatalize => $fatalize, # generate code that makes warnings fatal verbose => $verbose, # bool: print progress messages; defaults to 0 force => $force # bool: overwrite existing files; defaults to 0 The ignores_type is a new feature that allows one to create SCM-specific ignore files. These are the mappings: ignores_type => 'generic' # default, creates 'ignore.txt' ignores_type => 'cvs' # creates .cvsignore ignores_type => 'git' # creates .gitignore ignores_type => 'hg' # creates .hgignore ignores_type => 'manifest' # creates MANIFEST.SKIP It is also possible to provide an array ref with multiple types wanted: ignores_type => [ 'git', 'manifest' ] =head1 PLUGINS Module::Starter itself doesn't actually do anything. It must load plugins that implement C and other methods. This is done by the class's C routine, which accepts a list of plugins to be loaded, in order. For more information, refer to L. =cut sub import { my $class = shift; my @plugins = ((@_ ? @_ : 'Module::Starter::Simple'), $class); my $parent; while (my $child = shift @plugins) { require_module $child; ## no critic no strict 'refs'; #Violates ProhibitNoStrict push @{"${child}::ISA"}, $parent if $parent; use strict 'refs'; ## use critic if ( @plugins && $child->can('load_plugins') ) { $parent->load_plugins(@plugins); last; } $parent = $child; } return; } =head1 AUTHORS Sawyer X, C<< >> Andy Lester, C<< >> Ricardo Signes, C<< >> C.J. Adams-Collier, C<< >> =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Module::Starter You can also look for information at: =over 4 =item * Source code at GitHub L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * GitHub issue tracker L =item * Metacpan L =back =head1 BUGS Please report any bugs or feature requests to the bugtracker for this project on GitHub at: L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 COPYRIGHT Copyright 2005-2009 Andy Lester, Ricardo Signes and C.J. Adams-Collier, All Rights Reserved. Copyright 2010 Sawyer X, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # vi:et:sw=4 ts=4 Module-Starter-1.73/lib/Module/Starter/0000755000175000017500000000000013143242255017333 5ustar grinnzgrinnzModule-Starter-1.73/lib/Module/Starter/BuilderSet.pm0000644000175000017500000001673313143171066021746 0ustar grinnzgrinnzpackage Module::Starter::BuilderSet; use strict; use warnings; use Carp qw( carp ); =head1 NAME Module::Starter::BuilderSet - determine builder metadata =head1 VERSION Version 1.73 =cut our $VERSION = '1.73'; =head1 SYNOPSIS use Module::Starter::BuilderSet; my $builder_set = Module::Starter::BuilderSet->new; my @supported_builders = $builder_set->supported_builders(); my $default_builder = $builder_set->default_builder(); my $output_file = $builder_set->file_for_builder($default_builder); my $create_method = $builder_set->method_for_builder($default_builder); Module::Starter::Simple->$create_method($default_builder); # eeew. my @build_commands = $builder_set->instructions_for_builder($default_builder); my @builder_dependencies = $builder_set->deps_for_builder($default_builder); my @compatible_builders = $builder_set->check_compatibility(@builder_list); my $ms_simple = Module::Starter::Simple->new(); my $build_method = $builder_set->manifest_method($builder); $ms_simple->$build_method(); =head1 DESCRIPTION Module::Starter::BuilderSet is a collection of utility methods used to provide metadata about builders supported by Module::Starter. =head1 CLASS METHODS =head2 C<< new() >> This method initializes and returns an object representing the set of Builders supported by Module::Starter =cut sub new { my $class = shift; my $self = { 'Module::Build' => { file => "Build.PL", build_method => "create_Build_PL", build_deps => [], build_manifest => 'create_MB_MANIFEST', instructions => [ 'perl Build.PL', './Build', './Build test', './Build install', ], }, 'Module::Install' => { file => "Makefile.PL", build_method => "create_MI_Makefile_PL", build_deps => [], build_manifest => 'create_MI_MANIFEST', instructions => [ 'perl Makefile.PL', 'make', 'make test', 'make install', ], }, 'ExtUtils::MakeMaker' => { file => "Makefile.PL", build_method => "create_Makefile_PL", build_manifest => 'create_EUMM_MANIFEST', build_deps => [ { command => 'make', aliases => [ 'make', 'gmake' ], }, { command => 'chmod', aliases => [ 'chmod' ], }, ], instructions => [ 'perl Makefile.PL', 'make', 'make test', 'make install', ], } }; return bless $self, $class; } sub _builder { my $self = shift; my $builder = shift; $builder = $self->default_builder unless $builder; unless (exists $self->{$builder}) { carp("Don't know anything about builder '$builder'."); return undef; } return $self->{$builder}; } =head2 C<< supported_builders() >> This method returns a list of builders supported by Module::Starter =cut sub supported_builders { my $self = shift; return keys %$self; } =head2 C<< file_for_builder($builder) >> This method returns the name of the file generated by Module::Starter that will be used to build the generated module =cut sub file_for_builder { my $self = shift; my $builder = shift; return $self->_builder($builder)->{file}; } =head2 C<< method_for_builder($builder) >> This method returns the name of the method in the C package that is called to create the file returned by C =cut sub method_for_builder { my $self = shift; my $builder = shift; return $self->_builder($builder)->{build_method}; } =head2 C<< instructions_for_builder($builder) >> This method returns a list of commands that, when run from the command line (or with C), will cause the generated module to be built, tested and installed. =cut sub instructions_for_builder { my $self = shift; my $builder = shift; return @{ $self->_builder($builder)->{instructions} }; } =head2 C<< deps_for_builder($builder) >> This method returns a list of dependencies in the following format: C<< ( { command => "make", aliases => [ 'make', 'gmake' ], }, { command => "another_command", aliases => [ 'alias0', 'alias1', '...' ], }, ) >> =cut sub deps_for_builder { my $self = shift; my $builder = shift; return @{ $self->_builder($builder)->{build_deps} }; } =head2 C<< manifest_method($builder) >> This method returns the command to run to create the manifest according to the builder asked. =cut sub manifest_method { my ( $self, $builder ) = @_; return $self->_builder($builder)->{'build_manifest'}; } =head2 C<< check_compatibility(@builders) >> This method accepts a list of builders and filters out the ones that are unsupported or mutually exclusive, returning the builders that passed the filter. If none pass the filter, the default builder is returned. =cut sub check_compatibility { my $self = shift; my @builders = @_; # if we're passed an array reference (or even a list of array # references), de-reference the first one passed and assign # @builders its contents @builders = @{$builders[0]} if(@builders && ref $builders[0] eq 'ARRAY'); # remove empty and unsupported builders @builders = grep { $self->_builder($_) } @builders; # if we stripped all of them, use the default push(@builders, $self->default_builder) unless int( @builders ) > 0; my %uniq; my @good; foreach my $builder (@builders) { # Builders that generate the same build file are mutually exclusive # If given a list of builder modules that includes mutually # exclusive modules, we'll use the first in the list my $file = $self->file_for_builder($builder); if (exists $uniq{$file}) { # don't print a warning if the same builder was listed twice. # Otherwise, inform the caller that these builders are mutually # exclusive carp("Builders '$builder' and '$uniq{$file}' are mutually exclusive.". " Using '$uniq{$file}'." ) unless $builder eq $uniq{$file}; } else { $uniq{$file} = $builder; push(@good, $uniq{$file}); } } return( @good ); } =head2 C<< default_builder() >> This method returns the module name of the default builder. =cut sub default_builder { my $self = shift; return 'ExtUtils::MakeMaker'; } =head1 BUGS Please report any bugs or feature requests to the bugtracker for this project on GitHub at: L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 AUTHOR C.J. Adams-Collier, C<< >> =head1 Copyright & License Copyright 2007 C.J. Adams-Collier, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Please note that these modules are not products of or supported by the employers of the various contributors to the code. =cut 1; # vi:et:sw=4 ts=4 Module-Starter-1.73/lib/Module/Starter/Plugin/0000755000175000017500000000000013143242255020571 5ustar grinnzgrinnzModule-Starter-1.73/lib/Module/Starter/Plugin/Template.pm0000644000175000017500000001175113140533215022703 0ustar grinnzgrinnzpackage Module::Starter::Plugin::Template; use warnings; use strict; use Carp qw( confess ); =head1 NAME Module::Starter::Plugin::Template - module starter with templates =head1 VERSION Version 1.73 =cut our $VERSION = '1.73'; =head1 SYNOPSIS use Module::Starter qw( Module::Starter::Simple Module::Starter::Plugin::Template ); Module::Starter->create_distro(%args); =head1 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. =head1 CLASS METHODS =head2 C<< new(%args) >> This plugin calls the C supermethod and then initializes the template store and renderer. (See C and C below.) =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->{templates} = { $self->templates }; $self->{renderer} = $self->renderer; return bless $self => $class; } =head1 OBJECT METHODS =head2 C<< 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 F is used for the module template. =cut sub templates { confess 'attempted to use abstract base templates method'; } =head2 C<< renderer() >> This method is used to initialize the template renderer. Its result is stored in the object's C entry. The implementation will determine its use. =cut sub renderer { confess 'attempted to use abstract base renderer method'; } =head2 C<< render($template, \%options) >> The C method will render the template passed to it, using the data in the Module::Starter object and in the hash of passed parameters. =cut sub render { my $self = shift; my $template = shift; my $options = shift; confess 'attempted to use abstract base render method'; } =head2 _guts methods All of the C 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. =over 4 =item module_guts =cut sub module_guts { my $self = shift; my %options; @options{qw(module rtname)} = @_; my $template = $self->{templates}{'Module.pm'}; $self->render($template, \%options); } =item Makefile_PL_guts =cut sub Makefile_PL_guts { my $self = shift; my %options; @options{qw(main_module main_pm_file)} = @_; my $template = $self->{templates}{'Makefile.PL'}; $self->render($template, \%options); } =item MI_Makefile_PL_guts =cut sub MI_Makefile_PL_guts { my $self = shift; my %options; @options{qw(main_module main_pm_file)} = @_; my $template = $self->{templates}{'MI_Makefile.PL'}; $self->render($template, \%options); } =item Build_PL_guts =cut sub Build_PL_guts { my $self = shift; my %options; @options{qw(main_module main_pm_file)} = @_; my $template = $self->{templates}{'Build.PL'}; $self->render($template, \%options); } =item Changes_guts =cut sub Changes_guts { my $self = shift; my $template = $self->{templates}{'Changes'}; $self->render($template); } =item README_guts =cut sub README_guts { my $self = shift; my %options; @options{qw(build_instructions)} = @_; my $template = $self->{templates}{'README'}; $self->render($template, \%options); } =item t_guts =cut sub t_guts { my $self = shift; my %options; $options{modules} = [ @_ ]; my %t_files; foreach (grep { /\.t$/ } keys %{$self->{templates}}) { my $template = $self->{templates}{$_}; $t_files{$_} = $self->render($template, \%options); } return %t_files; } =item MANIFEST_guts =cut sub MANIFEST_guts { my $self = shift; my %options; $options{files} = [ sort @_ ]; my $template = $self->{templates}{MANIFEST}; $self->render($template, \%options); } =item ignores_guts =cut sub ignores_guts { my $self = shift; my $template = $self->{templates}{ignores}; $self->render($template); } =back =head1 AUTHOR Ricardo SIGNES, C<< >> =head1 Bugs Please report any bugs or feature requests to the bugtracker for this project on GitHub at: L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 COPYRIGHT Copyright 2005-2007 Ricardo SIGNES, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut # vi:et:sw=4 ts=4 1; Module-Starter-1.73/lib/Module/Starter/Plugin.pod0000644000175000017500000000431013064625343021300 0ustar grinnzgrinnz=pod =head1 NAME Module::Starter::Plugin -- how Module::Starter plugins work =head1 DESCRIPTION This document is a guide to writing plugins for Module::Starter. Currently, as is evident, it isn't very comprehensive. It should provide enough information for writing effective plugins, though. After all, Module::Starter's guts are nice and simple. =head2 C<< Module::Starter->import >> Module::Starter provides an import method, the arguments to which are plugins, in the order in which they should be loaded. If no plugins are given, L (and only Module::Starter::Simple) is loaded. By default, the given modules are required and arranged in an I chain. That is, Module::Starter subclasses the last plugin given, which subclasses the second-to-last, up to the first plugin given, which is the base class. If a plugin provides a C method, however, the remaining plugins to be loaded are passed to that method, which is responsible for loading the rest of the plugins. This architecture suggests two kinds of plugins: =head2 engine plugins An engine is a plugin that stands alone, implementing the public C method and all the functionality required to carry out that implementation. The only engine included with Module::Starter is Module::Starter::Simple, and I'm not sure any more will be seen in the wild any time soon. =head2 plain old plugins Other plugins are designed to subclass an engine and alter its behavior, just as a normal subclass alters its parent class's. These plugins may add features to Module::Starter engines, or may just provide general APIs for other plugins to exploit (like L.) The template plugin is a simple example of a plugin that alters an engine to accept further plugins. Other plugins like template will probably be written in the near future, and plugins that exploit the API provided by Module::Starter::Plugin::Template will be available on the CPAN. =head1 AUTHOR Ricardo SIGNES C<< >> =head1 COPYRIGHT Copyright 2005, Ricardo SIGNES. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Module-Starter-1.73/lib/Module/Starter/App.pm0000644000175000017500000000702413143171010020402 0ustar grinnzgrinnzpackage Module::Starter::App; =head1 NAME Module::Starter::App - the code behind the command line program =cut use warnings; use strict; our $VERSION = '1.73'; use File::Spec; use Getopt::Long; use Pod::Usage; use Carp qw( croak ); use Module::Runtime qw( require_module ); sub _config_file { my $self = shift; my $configdir = $ENV{'MODULE_STARTER_DIR'} || ''; if ( !$configdir && $ENV{'HOME'} ) { $configdir = File::Spec->catdir( $ENV{'HOME'}, '.module-starter' ); } return File::Spec->catfile( $configdir, 'config' ); } sub _config_read { my $self = shift; my $filename = $self->_config_file; return () unless -e $filename; open( my $config_file, '<', $filename ) or die "couldn't open config file $filename: $!\n"; my %config; while (my $line = <$config_file>) { chomp $line; next if $line =~ /\A\s*\Z/sm; if ($line =~ /\A(\w+):\s*(.+)\Z/sm) { $config{$1} = $2; } } return $self->_config_multi_process(%config); } sub _config_multi_process { my ( $self, %config ) = @_; # The options that accept multiple arguments must be set to an arrayref foreach my $key (qw( builder ignores_type modules plugins )) { $config{$key} = [ split /(?:\s*,\s*|\s+)/, (ref $config{$key} ? join(',', @{$config{$key}}) : $config{$key}) ] if $config{$key}; $config{$key} = [] unless exists $config{$key}; } return %config; } sub _process_command_line { my ( $self, %config ) = @_; $config{'argv'} = [ @ARGV ]; pod2usage(2) unless @ARGV; GetOptions( 'class=s' => \$config{class}, 'plugin=s@' => \$config{plugins}, 'dir=s' => \$config{dir}, 'distro=s' => \$config{distro}, 'module=s@' => \$config{modules}, 'builder=s@' => \$config{builder}, 'ignores=s@' => \$config{ignores_type}, eumm => sub { push @{$config{builder}}, 'ExtUtils::MakeMaker' }, mb => sub { push @{$config{builder}}, 'Module::Build' }, mi => sub { push @{$config{builder}}, 'Module::Install' }, 'author=s' => \$config{author}, 'email=s' => \$config{email}, 'license=s' => \$config{license}, 'minperl=s' => \$config{minperl}, 'fatalize' => \$config{fatalize}, force => \$config{force}, verbose => \$config{verbose}, version => sub { require Module::Starter; print "module-starter v$Module::Starter::VERSION\n"; exit 1; }, help => sub { pod2usage(1); }, ) or pod2usage(2); if (@ARGV) { pod2usage( -msg => "Unparseable arguments received: " . join(',', @ARGV), -exitval => 2, ); } $config{class} ||= 'Module::Starter'; $config{builder} = ['ExtUtils::MakeMaker'] unless $config{builder}; return %config; } =head2 run Module::Starter::App->run; This is equivalent to running F. Its behavior is still subject to change. =cut sub run { my $self = shift; my %config = $self->_config_read; %config = $self->_process_command_line(%config); %config = $self->_config_multi_process(%config); require_module $config{class}; $config{class}->import( @{ $config{'plugins'} } ); my $starter = $config{class}->new( %config ); $starter->postprocess_config; $starter->pre_create_distro; $starter->create_distro; $starter->post_create_distro; $starter->pre_exit; return 1; } 1; Module-Starter-1.73/lib/Module/Starter/Simple.pm0000644000175000017500000014102713143171335021127 0ustar grinnzgrinnzpackage Module::Starter::Simple; use 5.006; use strict; use warnings; use Cwd 'cwd'; use ExtUtils::Command qw( rm_rf mkpath touch ); use File::Spec (); use Carp qw( carp confess croak ); use Module::Starter::BuilderSet; =head1 NAME Module::Starter::Simple - a simple, comprehensive Module::Starter plugin =head1 VERSION Version 1.73 =cut our $VERSION = '1.73'; =head1 SYNOPSIS use Module::Starter qw(Module::Starter::Simple); Module::Starter->create_distro(%args); =head1 DESCRIPTION Module::Starter::Simple is a plugin for Module::Starter that will perform all the work needed to create a distribution. Given the parameters detailed in L, it will create content, create directories, and populate the directories with the required files. =head1 CLASS METHODS =head2 C<< new(%args) >> This method is called to construct and initialize a new Module::Starter object. It is never called by the end user, only internally by C, which creates ephemeral Module::Starter objects. It's documented only to call it to the attention of subclass authors. =cut sub new { my $class = shift; return bless { @_ } => $class; } =head1 OBJECT METHODS All the methods documented below are object methods, meant to be called internally by the ephemeral objects created during the execution of the class method C above. =head2 postprocess_config A hook to do any work after the configuration is initially processed. =cut sub postprocess_config { 1 }; =head2 pre_create_distro A hook to do any work right before the distro is created. =cut sub pre_create_distro { 1 }; =head2 C<< create_distro(%args) >> This method works as advertised in L. =cut sub create_distro { my $either = shift; ( ref $either ) or $either = $either->new( @_ ); my $self = $either; my $modules = $self->{modules} || []; my @modules = map { split /,/ } @{$modules}; croak "No modules specified.\n" unless @modules; for (@modules) { croak "Invalid module name: $_" unless /\A[a-z_]\w*(?:::[\w]+)*\Z/i; } if ( ( not $self->{author} ) && ( $^O ne 'MSWin32' ) ) { ( $self->{author} ) = split /,/, ( getpwuid $> )[6]; } if ( not $self->{email} and exists $ENV{EMAIL} ) { $self->{email} = $ENV{EMAIL}; } croak "Must specify an author\n" unless $self->{author}; croak "Must specify an email address\n" unless $self->{email}; ($self->{email_obfuscated} = $self->{email}) =~ s/@/ at /; $self->{license} ||= 'artistic2'; $self->{minperl} ||= '5.006'; $self->{ignores_type} ||= ['generic']; $self->{manifest_skip} = !! grep { /manifest/ } @{ $self->{ignores_type} }; $self->{license_record} = $self->_license_record(); $self->{main_module} = $modules[0]; if ( not defined $self->{distro} or not length $self->{distro} ) { $self->{distro} = $self->{main_module}; $self->{distro} =~ s/::/-/g; } $self->{basedir} = $self->{dir} || $self->{distro}; $self->create_basedir; my @files; push @files, $self->create_modules( @modules ); push @files, $self->create_t( @modules ); push @files, $self->create_ignores; my %build_results = $self->create_build(); push(@files, @{ $build_results{files} } ); push @files, $self->create_Changes; push @files, $self->create_README( $build_results{instructions} ); $self->create_MANIFEST( $build_results{'manifest_method'} ) unless ( $self->{manifest_skip} ); # TODO: put files to ignore in a more standard form? # XXX: no need to return the files created return; } =head2 post_create_distro A hook to do any work after creating the distribution. =cut sub post_create_distro { 1 }; =head2 pre_exit A hook to do any work right before exit time. =cut sub pre_exit { print "Created starter directories and files\n"; } =head2 create_basedir Creates the base directory for the distribution. If the directory already exists, and I<$force> is true, then the existing directory will get erased. If the directory can't be created, or re-created, it dies. =cut sub create_basedir { my $self = shift; # Make sure there's no directory if ( -e $self->{basedir} ) { die( "$self->{basedir} already exists. ". "Use --force if you want to stomp on it.\n" ) unless $self->{force}; local @ARGV = $self->{basedir}; rm_rf(); die "Couldn't delete existing $self->{basedir}: $!\n" if -e $self->{basedir}; } CREATE_IT: { $self->progress( "Created $self->{basedir}" ); local @ARGV = $self->{basedir}; mkpath(); die "Couldn't create $self->{basedir}: $!\n" unless -d $self->{basedir}; } return; } =head2 create_modules( @modules ) This method will create a starter module file for each module named in I<@modules>. =cut sub create_modules { my $self = shift; my @modules = @_; my @files; for my $module ( @modules ) { my $rtname = lc $module; $rtname =~ s/::/-/g; push @files, $self->_create_module( $module, $rtname ); } return @files; } =head2 module_guts( $module, $rtname ) This method returns the text which should serve as the contents for the named module. I<$rtname> is the email suffix which rt.cpan.org will use for bug reports. (This should, and will, be moved out of the parameters for this method eventually.) =cut our $LICENSES = { perl => { license => 'perl', slname => 'perl_5', url => 'http://dev.perl.org/licenses/', blurb => <<'EOT', 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 L for more information. EOT }, artistic => { license => 'artistic', slname => 'artistic_1', url => 'http://www.perlfoundation.org/artistic_license_1_0', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (1.0). You may obtain a copy of the full license at: L Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. EOT }, artistic2 => { license => 'artistic2', slname => 'artistic_2', url => 'http://www.perlfoundation.org/artistic_license_2_0', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, mit => { license => 'mit', slname => 'mit', url => 'http://www.opensource.org/licenses/mit-license.php', blurb => <<'EOT', This program is distributed under the MIT (X11) License: L Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. EOT }, mozilla => { license => 'mozilla', slname => 'mozilla_1_1', url => 'http://www.mozilla.org/MPL/1.1/', blurb => <<'EOT', The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at L Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. EOT }, mozilla2 => { license => 'mozilla2', slname => 'open_source', url => 'http://www.mozilla.org/MPL/2.0/', blurb => <<'EOT', This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at L. EOT }, bsd => { license => 'bsd', slname => 'bsd', url => 'http://www.opensource.org/licenses/BSD-3-Clause', blurb => <<"EOT", This program is distributed under the (Revised) BSD License: L Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of ___AUTHOR___'s Organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, freebsd => { license => 'freebsd', slname => 'freebsd', url => 'http://www.opensource.org/licenses/BSD-2-Clause', blurb => <<"EOT", This program is distributed under the (Simplified) BSD License: L Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, cc0 => { license => 'cc0', slname => 'unrestricted', url => 'http://creativecommons.org/publicdomain/zero/1.0/', blurb => <<'EOT', This program is distributed under the CC0 1.0 Universal License: L The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. See Other Information below. Other Information: * In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights. * Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. * When using or citing the work, you should not imply endorsement by the author or the affirmer. EOT }, gpl => { license => 'gpl', slname => 'gpl_2', url => 'http://www.gnu.org/licenses/gpl-2.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991 or at your option any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A copy of the GNU General Public License is available in the source tree; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA EOT }, lgpl => { license => 'lgpl', slname => 'lgpl_2_1', url => 'http://www.gnu.org/licenses/lgpl-2.1.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA EOT }, gpl3 => { license => 'gpl3', slname => 'gpl_3', url => 'http://www.gnu.org/licenses/gpl-3.0.html', blurb => <<'EOT', This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see L. EOT }, lgpl3 => { license => 'lgpl3', slname => 'lgpl_3_0', url => 'http://www.gnu.org/licenses/lgpl-3.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see L. EOT }, agpl3 => { license => 'agpl3', slname => 'agpl_3', url => 'http://www.gnu.org/licenses/agpl-3.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see L. EOT }, apache => { license => 'apache', slname => 'apache_2_0', url => 'http://www.apache.org/licenses/LICENSE-2.0', blurb => <<'EOT', Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at L Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. EOT }, qpl => { license => 'qpl', slname => 'qpl_1_0', url => 'http://www.opensource.org/licenses/QPL-1.0', blurb => <<'EOT', This program is distributed under the Q Public License (QPL-1.0): L The Software and this license document are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. EOT }, }; sub _license_record { $LICENSES->{ shift->{license} }; } sub _license_blurb { my $self = shift; my $record = $self->{license_record}; my $license_blurb = defined($record) ? $record->{blurb} : <<"EOT"; This program is released under the following license: $self->{license} EOT $license_blurb =~ s/___AUTHOR___/$self->{author}/ge; chomp $license_blurb; return $license_blurb; } # _create_module: used by create_modules to build each file and put data in it sub _create_module { my $self = shift; my $module = shift; my $rtname = shift; my @parts = split( /::/, $module ); my $filepart = (pop @parts) . '.pm'; my @dirparts = ( $self->{basedir}, 'lib', @parts ); my $SLASH = q{/}; my $manifest_file = join( $SLASH, 'lib', @parts, $filepart ); if ( @dirparts ) { my $dir = File::Spec->catdir( @dirparts ); if ( not -d $dir ) { local @ARGV = $dir; mkpath @ARGV; $self->progress( "Created $dir" ); } } my $module_file = File::Spec->catfile( @dirparts, $filepart ); $self->{module_file}{$module} = File::Spec->catfile('lib', @parts, $filepart); $self->create_file( $module_file, $self->module_guts( $module, $rtname ) ); $self->progress( "Created $module_file" ); return $manifest_file; } sub _thisyear { return (localtime())[5] + 1900; } sub _module_to_pm_file { my $self = shift; my $module = shift; my @parts = split( /::/, $module ); my $pm = pop @parts; my $pm_file = File::Spec->catfile( 'lib', @parts, "${pm}.pm" ); $pm_file =~ s{\\}{/}g; # even on Win32, use forward slash return $pm_file; } sub _reference_links { return ( { nickname => 'RT', title => 'CPAN\'s request tracker (report bugs here)', link => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=%s', }, { nickname => 'AnnoCPAN', title => 'Annotated CPAN documentation', link => 'http://annocpan.org/dist/%s', }, { title => 'CPAN Ratings', link => 'http://cpanratings.perl.org/d/%s', }, { title => 'Search CPAN', link => 'http://search.cpan.org/dist/%s/', }, ); } =head2 create_Makefile_PL( $main_module ) This will create the Makefile.PL for the distribution, and will use the module named in I<$main_module> as the main module of the distribution. =cut sub create_Makefile_PL { my $self = shift; my $main_module = shift; my $builder_name = 'ExtUtils::MakeMaker'; my $output_file = Module::Starter::BuilderSet->new()->file_for_builder($builder_name); my $fname = File::Spec->catfile( $self->{basedir}, $output_file ); $self->create_file( $fname, $self->Makefile_PL_guts( $main_module, $self->_module_to_pm_file($main_module), ), ); $self->progress( "Created $fname" ); return $output_file; } =head2 create_MI_Makefile_PL( $main_module ) This will create a Module::Install Makefile.PL for the distribution, and will use the module named in I<$main_module> as the main module of the distribution. =cut sub create_MI_Makefile_PL { my $self = shift; my $main_module = shift; my $builder_name = 'Module::Install'; my $output_file = Module::Starter::BuilderSet->new()->file_for_builder($builder_name); my $fname = File::Spec->catfile( $self->{basedir}, $output_file ); $self->create_file( $fname, $self->MI_Makefile_PL_guts( $main_module, $self->_module_to_pm_file($main_module), ), ); $self->progress( "Created $fname" ); return $output_file; } =head2 Makefile_PL_guts( $main_module, $main_pm_file ) This method is called by create_Makefile_PL and returns text used to populate Makefile.PL; I<$main_pm_file> is the filename of the distribution's main module, I<$main_module>. =cut sub Makefile_PL_guts { my $self = shift; my $main_module = shift; my $main_pm_file = shift; (my $author = "$self->{author} <$self->{email}>") =~ s/'/\'/g; my $slname = $self->{license_record} ? $self->{license_record}->{slname} : $self->{license}; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); return <<"HERE"; use $self->{minperl}; use strict; use $warnings use ExtUtils::MakeMaker; WriteMakefile( NAME => '$main_module', AUTHOR => q{$author}, VERSION_FROM => '$main_pm_file', ABSTRACT_FROM => '$main_pm_file', LICENSE => '$slname', PL_FILES => {}, MIN_PERL_VERSION => '$self->{minperl}', CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '0', }, BUILD_REQUIRES => { 'Test::More' => '0', }, PREREQ_PM => { #'ABC' => '1.6', #'Foo::Bar::Module' => '5.0401', }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => '$self->{distro}-*' }, ); HERE } =head2 MI_Makefile_PL_guts( $main_module, $main_pm_file ) This method is called by create_MI_Makefile_PL and returns text used to populate Makefile.PL; I<$main_pm_file> is the filename of the distribution's main module, I<$main_module>. =cut sub MI_Makefile_PL_guts { my $self = shift; my $main_module = shift; my $main_pm_file = shift; my $author = "$self->{author} <$self->{email}>"; $author =~ s/'/\'/g; my $license_url = $self->{license_record} ? $self->{license_record}->{url} : ''; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); return <<"HERE"; use $self->{minperl}; use strict; use $warnings use inc::Module::Install; name '$self->{distro}'; all_from '$main_pm_file'; author q{$author}; license '$self->{license}'; perl_version '$self->{minperl}'; tests_recursive('t'); resources ( #homepage => 'http://yourwebsitehere.com', #IRC => 'irc://irc.perl.org/#$self->{distro}', license => '$license_url', #repository => 'git://github.com/$self->{author}/$self->{distro}.git', #repository => 'https://bitbucket.org/$self->{author}/$self->{distro}', bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=$self->{distro}', ); configure_requires ( 'Module::Install' => '0', ); build_requires ( 'Test::More' => '0', ); requires ( #'ABC' => '1.6', #'Foo::Bar::Module' => '5.0401', ); install_as_cpan; auto_install; WriteAll; HERE } =head2 create_Build_PL( $main_module ) This will create the Build.PL for the distribution, and will use the module named in I<$main_module> as the main module of the distribution. =cut sub create_Build_PL { my $self = shift; my $main_module = shift; my $builder_name = 'Module::Build'; my $output_file = Module::Starter::BuilderSet->new()->file_for_builder($builder_name); my $fname = File::Spec->catfile( $self->{basedir}, $output_file ); $self->create_file( $fname, $self->Build_PL_guts( $main_module, $self->_module_to_pm_file($main_module), ), ); $self->progress( "Created $fname" ); return $output_file; } =head2 Build_PL_guts( $main_module, $main_pm_file ) This method is called by create_Build_PL and returns text used to populate Build.PL; I<$main_pm_file> is the filename of the distribution's main module, I<$main_module>. =cut sub Build_PL_guts { my $self = shift; my $main_module = shift; my $main_pm_file = shift; (my $author = "$self->{author} <$self->{email}>") =~ s/'/\'/g; my $slname = $self->{license_record} ? $self->{license_record}->{slname} : $self->{license}; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); return <<"HERE"; use $self->{minperl}; use strict; use $warnings use Module::Build; my \$builder = Module::Build->new( module_name => '$main_module', license => '$slname', dist_author => q{$author}, dist_version_from => '$main_pm_file', release_status => 'stable', configure_requires => { 'Module::Build' => '0', }, build_requires => { 'Test::More' => '0', }, requires => { #'ABC' => '1.6', #'Foo::Bar::Module' => '5.0401', }, add_to_cleanup => [ '$self->{distro}-*' ], ); \$builder->create_build_script(); HERE } =head2 create_Changes( ) This method creates a skeletal Changes file. =cut sub create_Changes { my $self = shift; my $fname = File::Spec->catfile( $self->{basedir}, 'Changes' ); $self->create_file( $fname, $self->Changes_guts() ); $self->progress( "Created $fname" ); return 'Changes'; } =head2 Changes_guts Called by create_Changes, this method returns content for the Changes file. =cut sub Changes_guts { my $self = shift; return <<"HERE"; Revision history for $self->{distro} 0.01 Date/time First version, released on an unsuspecting world. HERE } =head2 create_README( $build_instructions ) This method creates the distribution's README file. =cut sub create_README { my $self = shift; my $build_instructions = shift; my $fname = File::Spec->catfile( $self->{basedir}, 'README' ); $self->create_file( $fname, $self->README_guts($build_instructions) ); $self->progress( "Created $fname" ); return 'README'; } =head2 README_guts Called by create_README, this method returns content for the README file. =cut sub _README_intro { my $self = shift; return <<"HERE"; The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it to get an idea of the module's uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. HERE } sub _README_information { my $self = shift; my @reference_links = _reference_links(); my $content = "You can also look for information at:\n"; foreach my $ref (@reference_links){ my $title; $title = "$ref->{nickname}, " if exists $ref->{nickname}; $title .= $ref->{title}; my $link = sprintf($ref->{link}, $self->{distro}); $content .= qq[ $title $link ]; } return $content; } sub _README_license { my $self = shift; my $year = $self->_thisyear(); my $license_blurb = $self->_license_blurb(); return <<"HERE"; LICENSE AND COPYRIGHT Copyright (C) $year $self->{author} $license_blurb HERE } sub README_guts { my $self = shift; my $build_instructions = shift; my $intro = $self->_README_intro(); my $information = $self->_README_information(); my $license = $self->_README_license(); return <<"HERE"; $self->{distro} $intro INSTALLATION $build_instructions SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc $self->{main_module} $information $license HERE } =head2 create_t( @modules ) This method creates a bunch of *.t files. I<@modules> is a list of all modules in the distribution. =cut sub create_t { my $self = shift; my @modules = @_; my %t_files = $self->t_guts(@modules); my %xt_files = $self->xt_guts(@modules); my @files; push @files, map { $self->_create_t('t', $_, $t_files{$_}) } keys %t_files; push @files, map { $self->_create_t('xt', $_, $xt_files{$_}) } keys %xt_files; return @files; } =head2 t_guts( @modules ) This method is called by create_t, and returns a description of the *.t files to be created. The return value is a hash of test files to create. Each key is a filename and each value is the contents of that file. =cut sub t_guts { my $self = shift; my @modules = @_; my %t_files; my $minperl = $self->{minperl}; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); my $header = <<"EOH"; #!perl -T use $minperl; use strict; use $warnings use Test::More; EOH $t_files{'pod.t'} = $header.<<'HERE'; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); HERE $t_files{'manifest.t'} = $header.<<'HERE'; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } my $min_tcm = 0.9; eval "use Test::CheckManifest $min_tcm"; plan skip_all => "Test::CheckManifest $min_tcm required" if $@; ok_manifest(); HERE $t_files{'pod-coverage.t'} = $header.<<'HERE'; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); HERE my $nmodules = @modules; my $main_module = $modules[0]; my $use_lines = join( "\n", map { qq{ use_ok( '$_' ) || print "Bail out!\\n";} } @modules ); $t_files{'00-load.t'} = $header.<<"HERE"; plan tests => $nmodules; BEGIN { $use_lines } diag( "Testing $main_module \$${main_module}::VERSION, Perl \$], \$^X" ); HERE return %t_files; } =head2 xt_guts( @modules ) This method is called by create_t, and returns a description of the author only *.t files to be created in the xt directory. The return value is a hash of test files to create. Each key is a filename and each value is the contents of that file. =cut sub xt_guts { my $self = shift; my @modules = @_; my %xt_files; my $minperl = $self->{minperl}; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); my $header = <<"EOH"; #!perl -T use $minperl; use strict; use $warnings use Test::More; EOH my $module_boilerplate_tests; $module_boilerplate_tests .= " module_boilerplate_ok('".$self->_module_to_pm_file($_)."');\n" for @modules; my $boilerplate_tests = @modules + 2; $xt_files{'boilerplate.t'} = $header.<<"HERE"; plan tests => $boilerplate_tests; sub not_in_file_ok { my (\$filename, \%regex) = \@_; open( my \$fh, '<', \$filename ) or die "couldn't open \$filename for reading: \$!"; my \%violated; while (my \$line = <\$fh>) { while (my (\$desc, \$regex) = each \%regex) { if (\$line =~ \$regex) { push \@{\$violated{\$desc}||=[]}, \$.; } } } if (\%violated) { fail("\$filename contains boilerplate text"); diag "\$_ appears on lines \@{\$violated{\$_}}" for keys \%violated; } else { pass("\$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my (\$module) = \@_; not_in_file_ok(\$module => 'the great new \$MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } TODO: { local \$TODO = "Need to replace the boilerplate text"; not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); $module_boilerplate_tests } HERE return %xt_files; } sub _create_t { my $self = shift; my $directory = shift; # 't' or 'xt' my $filename = shift; my $content = shift; my @dirparts = ( $self->{basedir}, $directory ); my $tdir = File::Spec->catdir( @dirparts ); if ( not -d $tdir ) { local @ARGV = $tdir; mkpath(); $self->progress( "Created $tdir" ); } my $fname = File::Spec->catfile( @dirparts, $filename ); $self->create_file( $fname, $content ); $self->progress( "Created $fname" ); return join('/', $directory, $filename ); } =head2 create_MB_MANIFEST This methods creates a MANIFEST file using Module::Build's methods. =cut sub create_MB_MANIFEST { my $self = shift; $self->create_EUMM_MANIFEST; } =head2 create_MI_MANIFEST This method creates a MANIFEST file using Module::Install's methods. Currently runs ExtUtils::MakeMaker's methods. =cut sub create_MI_MANIFEST { my $self = shift; $self->create_EUMM_MANIFEST; } =head2 create_EUMM_MANIFEST This method creates a MANIFEST file using ExtUtils::MakeMaker's methods. =cut sub create_EUMM_MANIFEST { my $self = shift; my $orig_dir = cwd(); # create the MANIFEST in the correct path chdir $self->{'basedir'} || die "Can't reach basedir: $!\n"; require ExtUtils::Manifest; $ExtUtils::Manifest::Quiet = 0; ExtUtils::Manifest::mkmanifest(); # return to our original path, wherever it was chdir $orig_dir || die "Can't return to original dir: $!\n"; } =head2 create_MANIFEST( $method ) This method creates the distribution's MANIFEST file. It must be run last, because all the other create_* functions have been returning the functions they create. It receives a method to run in order to create the MANIFEST file. That way it can create a MANIFEST file according to the builder used. =cut sub create_MANIFEST { my ( $self, $manifest_method ) = @_; my $fname = File::Spec->catfile( $self->{basedir}, 'MANIFEST' ); $self->$manifest_method(); $self->filter_lines_in_file( $fname, qr/^xt\/boilerplate\.t$/, qr/^ignore\.txt$/, ); $self->progress( "Created $fname" ); return 'MANIFEST'; } =head2 get_builders( ) This methods gets the correct builder(s). It is called by C, and returns an arrayref with the builders. =cut sub get_builders { my $self = shift; # pass one: pull the builders out of $self->{builder} my @tmp = ref $self->{'builder'} eq 'ARRAY' ? @{ $self->{'builder'} } : $self->{'builder'}; my @builders; my $COMMA = q{,}; # pass two: expand comma-delimited builder lists foreach my $builder (@tmp) { push( @builders, split( $COMMA, $builder ) ); } return \@builders; } =head2 create_build( ) This method creates the build file(s) and puts together some build instructions. The builders currently supported are: ExtUtils::MakeMaker Module::Build Module::Install =cut sub create_build { my $self = shift; # get the builders my @builders = @{ $self->get_builders }; my $builder_set = Module::Starter::BuilderSet->new(); # Remove mutually exclusive and unsupported builders @builders = $builder_set->check_compatibility( @builders ); # compile some build instructions, create a list of files generated # by the builders' create_* methods, and call said methods my @build_instructions; my @files; my $manifest_method; foreach my $builder ( @builders ) { if ( !@build_instructions ) { push( @build_instructions, 'To install this module, run the following commands:' ); } else { push( @build_instructions, "Alternatively, to install with $builder, you can ". "use the following commands:" ); } push( @files, $builder_set->file_for_builder($builder) ); my @commands = $builder_set->instructions_for_builder($builder); push( @build_instructions, join("\n", map { "\t$_" } @commands) ); my $build_method = $builder_set->method_for_builder($builder); $self->$build_method($self->{main_module}); $manifest_method = $builder_set->manifest_method($builder); } return( files => [ @files ], instructions => join( "\n\n", @build_instructions ), manifest_method => $manifest_method, ); } =head2 create_ignores() This creates a text file for use as MANIFEST.SKIP, .cvsignore, .gitignore, or whatever you use. =cut sub create_ignores { my $self = shift; my $type = $self->{ignores_type}; my %names = ( generic => 'ignore.txt', cvs => '.cvsignore', git => '.gitignore', hg => '.hgignore', manifest => 'MANIFEST.SKIP', ); my $create_file = sub { my $type = shift; my $name = $names{$type}; my $fname = File::Spec->catfile( $self->{basedir}, $names{$type} ); $self->create_file( $fname, $self->ignores_guts($type) ); $self->progress( "Created $fname" ); }; if ( ref $type eq 'ARRAY' ) { foreach my $single_type ( @{$type} ) { $create_file->($single_type); } } elsif ( ! ref $type ) { $create_file->($type); } return; # Not a file that goes in the MANIFEST } =head2 ignores_guts() Called by C, this method returns the contents of the ignore file. =cut sub ignores_guts { my ($self, $type) = @_; my $ms = $self->{manifest_skip} ? "MANIFEST\nMANIFEST.bak\n" : ''; my $guts = { generic => $ms.<<"EOF", Makefile Makefile.old Build Build.bat META.* MYMETA.* .build/ _build/ cover_db/ blib/ inc/ .lwpcookies .last_cover_stats nytprof.out pod2htm*.tmp pm_to_blib $self->{distro}-* $self->{distro}-*.tar.gz EOF # make this more restrictive, since MANIFEST tends to be less noticeable # (also, manifest supports REs.) manifest => <<'EOF', # Top-level filter (only include the following...) ^(?!(?:script|examples|lib|inc|t|xt|maint)/|(?:(?:Makefile|Build)\.PL|README|MANIFEST|Changes|META\.(?:yml|json))$) # Avoid version control files. \bRCS\b \bCVS\b ,v$ \B\.svn\b \b_darcs\b # (.git or .hg only in top-level, hence it's blocked above) # Avoid temp and backup files. ~$ \.tmp$ \.old$ \.bak$ \..*?\.sw[po]$ \#$ \b\.# # avoid OS X finder files \.DS_Store$ # ditto for Windows \bdesktop\.ini$ \b[Tt]humbs\.db$ # Avoid patch remnants \.orig$ \.rej$ EOF }; $guts->{hg} = $guts->{cvs} = $guts->{git} = $guts->{generic}; return $guts->{$type}; } =head1 HELPER METHODS =head2 verbose C tells us whether we're in verbose mode. =cut sub verbose { return shift->{verbose} } =head2 create_file( $fname, @content_lines ) Creates I<$fname>, dumps I<@content_lines> in it, and closes it. Dies on any error. =cut sub create_file { my $self = shift; my $fname = shift; my @content = @_; open( my $fh, '>', $fname ) or confess "Can't create $fname: $!\n"; print {$fh} @content; close $fh or die "Can't close $fname: $!\n"; return; } =head2 progress( @list ) C prints the given progress message if we're in verbose mode. =cut sub progress { my $self = shift; print @_, "\n" if $self->verbose; return; } =head2 filter_lines_in_file( $filename, @compiled_regexes ) C goes over a file and removes lines with the received regexes. For example, removing t/boilerplate.t in the MANIFEST. =cut sub filter_lines_in_file { my ( $self, $file, @regexes ) = @_; my @read_lines; open my $fh, '<', $file or die "Can't open file $file: $!\n"; @read_lines = <$fh>; close $fh or die "Can't close file $file: $!\n"; chomp @read_lines; open $fh, '>', $file or die "Can't open file $file: $!\n"; foreach my $line (@read_lines) { my $found; foreach my $regex (@regexes) { if ( $line =~ $regex ) { $found++; } } $found or print {$fh} "$line\n"; } close $fh or die "Can't close file $file: $!\n"; } =head1 BUGS Please report any bugs or feature requests to the bugtracker for this project on GitHub at: L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 AUTHOR Sawyer X, C<< >> Andy Lester, C<< >> C.J. Adams-Collier, C<< >> =head1 Copyright & License Copyright 2005-2009 Andy Lester and C.J. Adams-Collier, All Rights Reserved. Copyright 2010 Sawyer X, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Please note that these modules are not products of or supported by the employers of the various contributors to the code. =cut sub _module_header { my $self = shift; my $module = shift; my $rtname = shift; my $warnings = sprintf 'warnings%s;', ($self->{fatalize} ? " FATAL => 'all'" : ''); my $content = <<"HERE"; package $module; use $self->{minperl}; use strict; use $warnings \=head1 NAME $module - The great new $module! \=head1 VERSION Version 0.01 \=cut our \$VERSION = '0.01'; HERE return $content; } sub _module_bugs { my $self = shift; my $module = shift; my $rtname = shift; my $bug_email = "bug-\L$self->{distro}\E at rt.cpan.org"; my $bug_link = "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$self->{distro}"; my $content = <<"HERE"; \=head1 BUGS Please report any bugs or feature requests to C<$bug_email>, or through the web interface at L<$bug_link>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. HERE return $content; } sub _module_support { my $self = shift; my $module = shift; my $rtname = shift; my $content = qq[ \=head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc $module ]; my @reference_links = _reference_links(); return undef unless @reference_links; $content .= qq[ You can also look for information at: \=over 4 ]; foreach my $ref (@reference_links) { my $title; my $link = sprintf($ref->{link}, $self->{distro}); $title = "$ref->{nickname}: " if exists $ref->{nickname}; $title .= $ref->{title}; $content .= qq[ \=item * $title L<$link> ]; } $content .= qq[ \=back ]; return $content; } sub _module_license { my $self = shift; my $module = shift; my $rtname = shift; my $license_blurb = $self->_license_blurb(); my $year = $self->_thisyear(); my $content = qq[ \=head1 LICENSE AND COPYRIGHT Copyright $year $self->{author}. $license_blurb ]; return $content; } sub module_guts { my $self = shift; my $module = shift; my $rtname = shift; # Sub-templates my $header = $self->_module_header($module, $rtname); my $bugs = $self->_module_bugs($module, $rtname); my $support = $self->_module_support($module, $rtname); my $license = $self->_module_license($module, $rtname); my $content = <<"HERE"; $header \=head1 SYNOPSIS Quick summary of what the module does. Perhaps a little code snippet. use $module; my \$foo = $module->new(); ... \=head1 EXPORT A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module. \=head1 SUBROUTINES/METHODS \=head2 function1 \=cut sub function1 { } \=head2 function2 \=cut sub function2 { } \=head1 AUTHOR $self->{author}, C<< <$self->{email_obfuscated}> >> $bugs $support \=head1 ACKNOWLEDGEMENTS $license \=cut 1; # End of $module HERE return $content; } 1; # vi:et:sw=4 ts=4 Module-Starter-1.73/META.json0000644000175000017500000000320613143242255015336 0ustar grinnzgrinnz{ "abstract" : "a simple starter kit for any module", "author" : [ "Andy Lester " ], "dynamic_config" : 0, "generated_by" : "ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Module-Starter", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "ExtUtils::Command" : "0", "File::Spec" : "0", "Getopt::Long" : "0", "Module::Runtime" : "0", "Pod::Usage" : "1.21", "Test::Harness" : "0.21", "Test::More" : "0", "parent" : "0", "perl" : "5.006001", "version" : "0.77" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/xsawyerx/module-starter/issues" }, "homepage" : "https://github.com/xsawyerx/module-starter", "repository" : { "type" : "git", "url" : "https://github.com/xsawyerx/module-starter.git", "web" : "https://github.com/xsawyerx/module-starter" }, "x_IRC" : "irc://irc.perl.org/#toolchain" }, "version" : "1.73", "x_serialization_backend" : "JSON::PP version 2.94" } Module-Starter-1.73/Makefile.PL0000644000175000017500000000424513143167764015706 0ustar grinnzgrinnz# vi:et:sw=4 softtabstop=4 use strict; use warnings; use 5.006001; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Module::Starter', AUTHOR => 'Andy Lester ', VERSION_FROM => 'lib/Module/Starter.pm', (eval { ExtUtils::MakeMaker->VERSION('6.21') } ? (LICENSE => 'perl') : ()), (eval { ExtUtils::MakeMaker->VERSION('6.48') } ? (MIN_PERL_VERSION => '5.6.1') : ()), ABSTRACT_FROM => 'lib/Module/Starter.pm', EXE_FILES => [ 'bin/module-starter' ], PREREQ_PM => { 'Test::More' => '0', 'Test::Harness' => '0.21', 'ExtUtils::Command' => '0', 'File::Spec' => '0', 'Getopt::Long' => '0', 'Module::Runtime' => '0', 'Pod::Usage' => '1.21', 'parent' => '0', 'version' => '0.77', }, (! eval { ExtUtils::MakeMaker->VERSION('6.46') } ? () : (META_MERGE => { dynamic_config => 0, 'meta-spec' => { version => 2 }, resources => { homepage => 'https://github.com/xsawyerx/module-starter', repository => { type => 'git', url => 'https://github.com/xsawyerx/module-starter.git', web => 'https://github.com/xsawyerx/module-starter', }, bugtracker => { web => 'https://github.com/xsawyerx/module-starter/issues' }, x_IRC => 'irc://irc.perl.org/#toolchain', }, }) ), dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Module-Starter-*' }, ); sub MY::postamble { my $postamble = <<'MAKE_FRAG'; .PHONY: tags critic tags: ctags -f tags --recurse --totals \ --exclude=blib \ --exclude=.svn \ --exclude='*~' \ --languages=Perl --langmap=Perl:+.t \ critic: perlcritic -verbose "%f: [%p] %m at line %l, near '%r'. (Severity: %s)\n" -q -profile perlcriticrc lib/ bin/ t/ MAKE_FRAG return $postamble; } Module-Starter-1.73/t/0000755000175000017500000000000013143242255014157 5ustar grinnzgrinnzModule-Starter-1.73/t/test-dist.t0000644000175000017500000013140113143171771016270 0ustar grinnzgrinnz#!/usr/bin/perl use strict; use warnings; use Test::More; use Module::Starter; use File::Spec; use File::Path; use Carp; use version; use Module::Runtime qw( require_module ); package TestParseFile; use Test::More; use File::Basename; sub new { my $class = shift; my $self = shift; $self ||= {}; $self->{_orig_vars} = { %$self }; bless $self, $class; $self->_slurp_to_ref(); return $self; } sub _text { my ($self, $text) = @_; if ($text) { unless (ref $text) { $self->{_text} = \$text; } elsif (ref $text eq 'SCALAR') { $self->{_text} = $text; } else { Carp::confess( 'Text must be a scalar type' ); } } return ${$self->{_text}}; } sub _slurp_to_ref { my ($self) = @_; local $/; open my $in, '<', $self->{fn} or Carp::confess( "Cannot open ".$self->{fn} ); $self->_text(<$in>); close($in); return $self->{_text}; } sub _diag { my ($self) = @_; return diag explain $self->{_orig_vars}; } sub parse { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($self, $re, $msg) = @_; $msg ||= "Parsing $re"; my $verdict = like($self->_text, $re, $self->format_msg($msg)) or $self->_diag; ${$self->{_text}} =~ s{$re}{}ms if ($verdict); return $verdict; } sub consume { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($self, $prefix, $msg) = @_; $msg ||= 'Contents'; my $verdict = is( substr($self->_text, 0, length($prefix)), $prefix, $self->format_msg($msg)) or $self->_diag; ${$self->{_text}} = substr($self->_text, length($prefix)) if ($verdict); return $verdict; } sub is_end { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($self, $msg) = @_; $msg ||= "That's all folks!"; my $verdict = is ($self->_text, "", $self->format_msg($msg)) or $self->_diag; return $verdict; } # This is merely a copy of $LICENSES from Module::Starter::Simple. # We could just use $Module::Starter::Simple::LICENSES, but really # it's bad form to use variables from the actual modules for the # purposes of testing. our $LICENSES = { perl => { license => 'perl', slname => 'perl_5', url => 'http://dev.perl.org/licenses/', blurb => <<'EOT', 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 L for more information. EOT }, artistic => { license => 'artistic', slname => 'artistic_1', url => 'http://www.perlfoundation.org/artistic_license_1_0', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (1.0). You may obtain a copy of the full license at: L Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. EOT }, artistic2 => { license => 'artistic2', slname => 'artistic_2', url => 'http://www.perlfoundation.org/artistic_license_2_0', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, mit => { license => 'mit', slname => 'mit', url => 'http://www.opensource.org/licenses/mit-license.php', blurb => <<'EOT', This program is distributed under the MIT (X11) License: L Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. EOT }, mozilla => { license => 'mozilla', slname => 'mozilla_1_1', url => 'http://www.mozilla.org/MPL/1.1/', blurb => <<'EOT', The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at L Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. EOT }, mozilla2 => { license => 'mozilla2', slname => 'open_source', url => 'http://www.mozilla.org/MPL/2.0/', blurb => <<'EOT', This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at L. EOT }, bsd => { license => 'bsd', slname => 'bsd', url => 'http://www.opensource.org/licenses/BSD-3-Clause', blurb => <<"EOT", This program is distributed under the (Revised) BSD License: L Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of ___AUTHOR___'s Organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, freebsd => { license => 'freebsd', slname => 'freebsd', url => 'http://www.opensource.org/licenses/BSD-2-Clause', blurb => <<"EOT", This program is distributed under the (Simplified) BSD License: L Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EOT }, cc0 => { license => 'cc0', slname => 'unrestricted', url => 'http://creativecommons.org/publicdomain/zero/1.0/', blurb => <<'EOT', This program is distributed under the CC0 1.0 Universal License: L The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. See Other Information below. Other Information: * In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights. * Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. * When using or citing the work, you should not imply endorsement by the author or the affirmer. EOT }, gpl => { license => 'gpl', slname => 'gpl_2', url => 'http://www.gnu.org/licenses/gpl-2.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991 or at your option any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A copy of the GNU General Public License is available in the source tree; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA EOT }, lgpl => { license => 'lgpl', slname => 'lgpl_2_1', url => 'http://www.gnu.org/licenses/lgpl-2.1.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA EOT }, gpl3 => { license => 'gpl3', slname => 'gpl_3', url => 'http://www.gnu.org/licenses/gpl-3.0.html', blurb => <<'EOT', This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see L. EOT }, lgpl3 => { license => 'lgpl3', slname => 'lgpl_3_0', url => 'http://www.gnu.org/licenses/lgpl-3.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see L. EOT }, agpl3 => { license => 'agpl3', slname => 'agpl_3', url => 'http://www.gnu.org/licenses/agpl-3.0.html', blurb => <<'EOT', This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see L. EOT }, apache => { license => 'apache', slname => 'apache_2_0', url => 'http://www.apache.org/licenses/LICENSE-2.0', blurb => <<'EOT', Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at L Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. EOT }, qpl => { license => 'qpl', slname => 'qpl_1_0', url => 'http://www.opensource.org/licenses/QPL-1.0', blurb => <<'EOT', This program is distributed under the Q Public License (QPL-1.0): L The Software and this license document are provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. EOT }, }; =head2 $file_parser->parse_paras(\@paras, $message) Parse the paragraphs paras. Paras can either be strings, in which case they'll be considered plain texts. Or they can be hash refs with the key 're' pointing to a regex string. Here's an example: my @synopsis_paras = ( '=head1 SYNOPSIS', 'Quick summary of what the module does.', 'Perhaps a little code snippet.', { re => q{\s*} . quotemeta(q{use MyModule::Test;}), }, { re => q{\s*} . quotemeta(q{my $foo = MyModule::Test->new();}) . q{\n\s*} . quotemeta("..."), }, ); $mod1->parse_paras( \@synopsis_paras, 'MyModule::Test - SYNOPSIS', ); =cut sub parse_paras { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($self, $paras, $msg) = @_; # Construct a large regex. my $regex = join '', map { $_.q{\n\n+} } map { (ref($_) eq 'HASH') ? $_->{re} : quotemeta($_) } @{$paras}; return $self->parse( qr/$regex/ms, $msg ); } sub format_msg { my ($self, $msg) = @_; return $msg; } =head2 $file_parser->parse_file_start Parse the file based on the filename. This will have various templates on how to parse files of that type. =cut sub parse_file_start { my ($self) = @_; my $basefn = basename($self->{fn}); if ($basefn =~ /\.pm/) { return $self->parse_module_start() if (ref $self eq 'TestParseModuleFile'); Carp::confess( "Wrong method for testing $basefn; use TestParseModuleFile" ); } my $distro = $self->{distro}; my $mainmod = $self->{modules}[0]; my $minperl = $self->{minperl} || '5.006'; my $slname = $LICENSES->{ $self->{license} }->{slname}; my $license_url = $LICENSES->{ $self->{license} }->{url}; (my $authoremail = "$self->{author} <$self->{email}>") =~ s/'/\'/g; (my $libmod = "lib/$mainmod".'.pm') =~ s|::|/|g; my $install_pl = $self->{builder} eq 'Module::Build' ? 'Build.PL' : 'Makefile.PL'; my $manifest_skip = $self->{ignores_type} && !! grep { /manifest/ } @{ $self->{ignores_type} }; if ($basefn =~ /\.pm/) { return $self->parse_module_start() if (ref $self eq 'TestParseModuleFile'); Carp::confess( "Wrong method for testing $basefn; use TestParseModuleFile" ); } my $msw_re = qr{use \Q$minperl;\E\n\Quse strict;\E\n\Quse warnings;\E\n}; my $mswb_re = $self->{builder} eq 'Module::Install' ? qr{\A$msw_re\Quse inc::$self->{builder};\E\n\n} : qr{\A$msw_re\Quse $self->{builder};\E\n\n}; my $mswt_re = qr{\A\Q#!perl -T\E\n$msw_re\Quse Test::More;\E\n\n}; if ($basefn eq 'README') { plan tests => 6; $self->parse(qr{\A\Q$distro\E\n\n}ms, "Starts with the package name", ); $self->parse(qr{\AThe README is used to introduce the module and provide instructions.*?\n\n}ms, "README used to introduce", ); $self->parse( qr{\AA README file is required for CPAN modules since CPAN extracts the.*?\n\n\n}ms, "A README file is required", ); my $install_instr = $self->{builder} eq 'Module::Build' ? qr{\Qperl Build.PL\E\n\s+\Q./Build\E\n\s+\Q./Build test\E\n\s+\Q./Build install\E} : qr{\Qperl Makefile.PL\E\n\s+\Qmake\E\n\s+\Qmake test\E\n\s+\Qmake install\E}; $self->parse(qr{\A\n*INSTALLATION\n\nTo install this module, run the following commands:\n\n\s+$install_instr\n\n}, "INSTALLATION section", ); $self->parse(qr{\ASUPPORT AND DOCUMENTATION\n\nAfter installing.*?^\s+perldoc \Q$mainmod\E\n\n}ms, "Support and docs 1" ); $self->parse(qr{\AYou can also look for information at:\n\n\s+RT[^\n]+\n\s+\Qhttp://rt.cpan.org/NoAuth/Bugs.html?Dist=$distro\E\n\n}ms, "RT" ); } elsif ($basefn eq 'Build.PL' && $self->{builder} eq 'Module::Build') { plan tests => 10; $self->parse($mswb_re, "Min/Strict/Warning/Builder" ); $self->parse(qr{\A.*module_name *=> *'\Q$mainmod\E',\n}ms, "module_name", ); $self->parse(qr{\A\s*license *=> *'$slname',\n}ms, "license", ); $self->parse(qr{\A\s*dist_author *=> *\Qq{$authoremail},\E\n}ms, "dist_author", ); $self->parse(qr{\A\s*dist_version_from *=> *\Q'$libmod',\E\n}ms, "dist_version_from", ); $self->parse(qr{\A\s*release_status *=> *\Q'stable',\E\n}ms, "release_status", ); $self->parse( qr/\A\s*configure_requires => \{\n *\Q'$self->{builder}' => '0'\E,\n\s*\},\n/ms, "Configure Requires", ); $self->parse( qr/\A\s*build_requires => \{\n *\Q'Test::More' => '0'\E,\n\s*\},\n/ms, "Build Requires", ); $self->parse( qr/\A\s*requires => \{\n *#'ABC' *=> '1.6',\n *#'Foo::Bar::Module' => '5.0401',\n\s*\},\n/ms, "Requires", ); $self->parse( qr/\A\s*add_to_cleanup *=> \Q[ '$distro-*' ],\E\n/ms, "add_to_cleanup", ); } elsif ($basefn eq 'Makefile.PL' && $self->{builder} eq 'ExtUtils::MakeMaker') { plan tests => 11; $self->parse($mswb_re, "Min/Strict/Warning/Builder" ); $self->parse(qr{\A.*NAME *=> *'$mainmod',\n}ms, "NAME", ); $self->parse(qr{\A\s*AUTHOR *=> *\Qq{$authoremail},\E\n}ms, "AUTHOR", ); $self->parse(qr{\A\s*VERSION_FROM *=> *\Q'$libmod',\E\n}ms, "VERSION_FROM", ); $self->parse(qr{\A\s*ABSTRACT_FROM *=> *\Q'$libmod',\E\n}ms, "ABSTRACT_FROM", ); $self->parse(qr{\A\s*LICENSE *=> *\Q'$slname',\E\n}ms, "LICENSE", ); $self->parse(qr{\A\s*PL_FILES *=> *\{\},\n}ms, "PL_FILES", ); $self->parse(qr{\A\s*MIN_PERL_VERSION *=> *\Q'$minperl',\E\n}ms, "MIN_PERL_VERSION", ); $self->parse( qr/\A\s*CONFIGURE_REQUIRES => \{\n *\Q'$self->{builder}' => '0'\E,\n\s*\},\n/ms, "CONFIGURE_REQUIRES", ); $self->parse( qr/\A\s*BUILD_REQUIRES => \{\n *\Q'Test::More' => '0'\E,\n\s*\},\n/ms, "BUILD_REQUIRES", ); $self->parse( qr/\A\s*PREREQ_PM => \{\n *#'ABC' *=> '1.6',\n *#'Foo::Bar::Module' => '5.0401',\n\s*\},\n/ms, "PREREQ_PM", ); } elsif ($basefn eq 'Makefile.PL' && $self->{builder} eq 'Module::Install') { plan tests => 13; $self->parse($mswb_re, "Min/Strict/Warning/Builder" ); $self->parse(qr{\Aname\s+\Q'$distro';\E\n}ms, "name", ); $self->parse(qr{\Aall_from\s+\Q'$libmod';\E\n}ms, "all_from", ); $self->parse(qr{\Aauthor\s+\Qq{$authoremail};\E\n}ms, "author", ); $self->parse(qr{\Alicense\s+\Q'$self->{license}';\E\n\n}ms, "license", ); $self->parse(qr{\Aperl_version\s+\Q'$minperl';\E\n\n}ms, "perl_version", ); $self->parse(qr{\A\Qtests_recursive('t');\E\n\n}ms, "tests_recursive", ); $self->consume(<<"EOT", 'resources'); resources ( #homepage => 'http://yourwebsitehere.com', #IRC => 'irc://irc.perl.org/#$distro', license => '$license_url', #repository => 'git://github.com/$self->{author}/$distro.git', #repository => 'https://bitbucket.org/$self->{author}/$self->{distro}', bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=$distro', ); EOT $self->parse( qr/\A\s*configure_requires \(\n *\Q'$self->{builder}' => '0'\E,\n\s*\);\n/ms, "configure_requires", ); $self->parse( qr/\A\s*build_requires \(\n *\Q'Test::More' => '0'\E,\n\s*\);\n/ms, "build_requires", ); $self->parse( qr/\A\s*requires \(\n *#'ABC' *=> '1.6',\n *#'Foo::Bar::Module' => '5.0401',\n\s*\);\n/ms, "requires", ); $self->consume(<<"EOF", 'Footer'); install_as_cpan; auto_install; WriteAll; EOF $self->is_end(); } elsif ($basefn eq 'Changes') { plan tests => 2; $self->consume(<<"EOF"); Revision history for $distro 0.01 Date/time First version, released on an unsuspecting world. EOF $self->is_end(); } elsif ($basefn eq 'MANIFEST' && !$manifest_skip) { plan tests => 2; $self->consume(join("\n", ('Build.PL') x!! ($self->{builder} eq 'Module::Build'), 'Changes', ( map { my $f = $_; $f =~ s|::|/|g; "lib/$f.pm"; } @{$self->{modules}} ), ('Makefile.PL') x!! ($self->{builder} ne 'Module::Build'), "MANIFEST\t\t\tThis list of files", qw( README t/00-load.t t/manifest.t t/pod-coverage.t t/pod.t ) )."\n"); $self->is_end(); } elsif ($basefn eq 'MANIFEST.SKIP' && $manifest_skip) { plan tests => 2; $self->consume(<<'EOF'); # Top-level filter (only include the following...) ^(?!(?:script|examples|lib|inc|t|xt|maint)/|(?:(?:Makefile|Build)\.PL|README|MANIFEST|Changes|META\.(?:yml|json))$) # Avoid version control files. \bRCS\b \bCVS\b ,v$ \B\.svn\b \b_darcs\b # (.git or .hg only in top-level, hence it's blocked above) # Avoid temp and backup files. ~$ \.tmp$ \.old$ \.bak$ \..*?\.sw[po]$ \#$ \b\.# # avoid OS X finder files \.DS_Store$ # ditto for Windows \bdesktop\.ini$ \b[Tt]humbs\.db$ # Avoid patch remnants \.orig$ \.rej$ EOF $self->is_end(); } elsif ($basefn =~ /^(?:ignore\.txt|\.(?:cvs|git)ignore)$/) { plan tests => ($manifest_skip ? 3 : 2); $self->consume("MANIFEST\nMANIFEST.bak\n", 'MANIFEST*') if ($manifest_skip); $self->consume(<<"EOF"); Makefile Makefile.old Build Build.bat META.* MYMETA.* .build/ _build/ cover_db/ blib/ inc/ .lwpcookies .last_cover_stats nytprof.out pod2htm*.tmp pm_to_blib $distro-* $distro-*.tar.gz EOF $self->is_end(); } elsif ($basefn eq '00-load.t') { my $cnt = scalar @{$self->{modules}}; plan tests => $cnt + 4; $self->parse($mswt_re, "#!perl/Min/Strict/Warning/Test::More" ); $self->consume(<<"EOH", 'Plan Header'); plan tests => $cnt; BEGIN { EOH foreach my $module (@{$self->{modules}}) { $self->consume(<<"EOM", $module); use_ok( '$module' ) || print "Bail out!\\n"; EOM } my $escape_version = '$'.$mainmod.'::VERSION'; $self->consume(<<"EOF", 'Footer'); } diag( "Testing $mainmod $escape_version, Perl \$], \$^X" ); EOF $self->is_end(); } elsif ($basefn eq 'boilerplate.t') { my $cnt = scalar @{$self->{modules}} + 2; plan tests => $cnt + 3; $self->parse($mswt_re, "#!perl/Min/Strict/Warning/Test::More" ); $self->consume(<<"EOH", 'Plan Header'); plan tests => $cnt; EOH $self->consume(<<'EOT', 'Sub declares'); sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } TODO: { local $TODO = "Need to replace the boilerplate text"; not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); EOT foreach my $module (@{$self->{modules}}) { (my $modre = 'lib::'.$module.'\.pm') =~ s|::|'[:/]'|ge; # only : for Mac, and / for all others (including Windows) $self->parse(qr{\A\s*module_boilerplate_ok\(\'$modre\'\)\;\n}, $module); } $self->parse(qr{\A\s*\}\s*}ms, 'Footer'); $self->is_end(); } elsif ($basefn eq 'manifest.t') { plan tests => 3; $self->parse($mswt_re, "#!perl/Min/Strict/Warning/Test::More" ); my $minimal_test_checkmanifest = '0.9'; $self->consume(<<"EOF"); unless ( \$ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } my \$min_tcm = $minimal_test_checkmanifest; eval "use Test::CheckManifest \$min_tcm"; plan skip_all => "Test::CheckManifest \$min_tcm required" if \$\@; ok_manifest(); EOF $self->is_end(); } elsif ($basefn eq 'pod.t') { plan tests => 4; $self->parse($mswt_re, "#!perl/Min/Strict/Warning/Test::More" ); $self->consume( "unless ( \$ENV{RELEASE_TESTING} ) {\n plan( skip_all => \"Author tests not required for installation\" );\n}\n\n", 'test is release only' ); my $minimal_test_pod = "1.22"; $self->consume(<<"EOF"); # Ensure a recent version of Test::Pod my \$min_tp = $minimal_test_pod; eval "use Test::Pod \$min_tp"; plan skip_all => "Test::Pod \$min_tp required for testing POD" if \$\@; all_pod_files_ok(); EOF $self->is_end(); } elsif ($basefn eq 'pod-coverage.t') { plan tests => 6; $self->parse($mswt_re, "#!perl/Min/Strict/Warning/Test::More" ); $self->consume( "unless ( \$ENV{RELEASE_TESTING} ) {\n plan( skip_all => \"Author tests not required for installation\" );\n}\n\n", 'test is release only' ); my $l1 = q{eval "use Test::Pod::Coverage $min_tpc";}; $self->parse( qr/\A# Ensure a recent[^\n]+\nmy \$min_tpc = \d+\.\d+;\n\Q$l1\E\nplan skip_all[^\n]+\n *if \$\@;\n\n/ms, 'min_tpc block', ); $l1 = q{eval "use Pod::Coverage $min_pc";}; $self->parse( qr/\A(?:# [^\n]+\n)*my \$min_pc = \d+\.\d+;\n\Q$l1\E\nplan skip_all[^\n]+\n *if \$\@;\n\n/ms, 'min_pod_coverage block', ); $self->parse( qr/all_pod_coverage_ok\(\);\n/, 'all_pod_coverage_ok', ); $self->is_end(); } else { $self->_diag; Carp::confess( "No testing template for $basefn" ); } done_testing(); return; } package TestParseModuleFile; use parent qw(-norequire TestParseFile); sub parse_module_start { my $self = shift; my $perl_name = $self->{module}; my $dist_name = $self->{distro}; my $author_name = $self->{author}; my $lc_dist_name = lc($dist_name); my $minperl = $self->{minperl} || 5.006; Test::More::plan tests => 19; $self->parse( qr/\Apackage \Q$perl_name\E;\n\nuse $minperl;\nuse strict;\n\Quse warnings;\E\n\n/ms, 'start', ); { my $s1 = qq{$perl_name - The great new $perl_name!}; $self->parse( qr/\A=head1 NAME\n\n\Q$s1\E\n\n/ms, "NAME Pod.", ); } $self->parse( qr/\A=head1 VERSION\n\nVersion 0\.01\n\n=cut\n\nour \$VERSION = '0\.01';\n+/, "module version", ); { my @synopsis_paras = ( '=head1 SYNOPSIS', 'Quick summary of what the module does.', 'Perhaps a little code snippet.', { re => q{\s*} . quotemeta(qq{use $perl_name;}), }, { re => q{\s*} . quotemeta(q{my $foo = } . $perl_name . q{->new();}) . q{\n\s*} . quotemeta('...'), }, ); $self->parse_paras( \@synopsis_paras, 'SYNOPSIS', ); } $self->parse_paras( [ '=head1 EXPORT', "A list of functions that can be exported. You can delete this section\n" . "if you don't export anything, such as for a purely object-oriented module.", ], "EXPORT", ); $self->parse_paras( [ "=head1 SUBROUTINES/METHODS", "=head2 function1", "=cut", "sub function1 {\n}", ], "function1", ); $self->parse_paras( [ "=head2 function2", "=cut", "sub function2 {\n}", ], "function2", ); $self->parse_paras( [ "=head1 AUTHOR", { re => quotemeta($author_name) . q{[^\n]+} }, ], "AUTHOR", ); $self->parse_paras( [ "=head1 BUGS", { re => q/Please report any bugs.*C.*changes\./ }, ], "BUGS", ); $self->parse_paras( [ "=head1 SUPPORT", { re => q/You can find documentation for this module.*/ }, { re => q/\s+perldoc / . quotemeta($perl_name), }, "You can also look for information at:", "=over 4", ], "Support 1", ); $self->parse_paras( [ { re => q/=item \* RT:[^\n]*/, }, "L", ], "Support - RT", ); $self->parse_paras( [ { re => q/=item \* AnnoCPAN:[^\n]*/, }, "L", ], "AnnoCPAN", ); $self->parse_paras( [ { re => q/=item \* CPAN Ratings[^\n]*/, }, "L", ], "CPAN Ratings", ); $self->parse_paras( [ { re => q/=item \* Search CPAN[^\n]*/, }, "L", ], "CPAN Ratings", ); $self->parse_paras( [ "=back", ], "Support - =back", ); $self->parse_paras( [ "=head1 ACKNOWLEDGEMENTS", ], "acknowledgements", ); my $license_blurb = $LICENSES->{ $self->{license} }->{blurb}; $license_blurb =~ s/___AUTHOR___/$author_name/ge; $self->parse_paras( [ "=head1 LICENSE AND COPYRIGHT", { re => q/Copyright \d+ / . quotemeta($author_name) . q/\./ }, split(/\n\n+/, $license_blurb ), ], "copyright", ); $self->parse_paras( [ "=cut", ], "=cut POD end", ); $self->consume( qq{1; # End of $perl_name}, "End of module", ); return; } package main; use File::Find; # Since we are going into randomization with tests, seed saving is now important. # rand calls srand automatically, then we re-seed. Perl 5.14 would allow us to # just get the seed value from a srand() call, but we aren't there yet... my $random_seed = int(rand() * 2**32); srand($random_seed); sub run_settest { my ($base_dir, $distro_var) = @_; my $module_base_dir = File::Spec->catdir(qw(t data), ref $base_dir ? @$base_dir : $base_dir); $distro_var->{dir} = $module_base_dir; subtest 'Set ==> '.$distro_var->{modules}[0] => sub { Module::Starter->create_distro( %$distro_var ); $distro_var->{__srand} = $random_seed; my $manifest_skip = $distro_var->{ignores_type} && !! grep { /manifest/ } @{ $distro_var->{ignores_type} }; my @exist_files = ( qw(README Changes), $manifest_skip ? 'MANIFEST.SKIP' : 'MANIFEST', $distro_var->{builder} eq 'Module::Build' ? 'Build.PL' : 'Makefile.PL', [qw(t 00-load.t)], [qw(xt boilerplate.t)], [qw(t manifest.t)], [qw(t pod.t)], [qw(t pod-coverage.t)], ); # Make sure we are actually testing every single file my @test_files; my $base_cnt = scalar File::Spec->splitdir($module_base_dir); find({ no_chdir => 1, wanted => sub { -f and do { my @dirs = File::Spec->splitdir($_); @dirs = splice(@dirs, $base_cnt); # delete base_dir return if ($dirs[0] eq 'lib' && $dirs[-1] =~ /\.pm$/); push(@test_files, @dirs == 1 ? $dirs[0] : \@dirs ); }; } }, $module_base_dir); plan tests => (@exist_files + @test_files + @{$distro_var->{modules}}); # File existence tests foreach my $arrfile (@exist_files) { my $file = ref $arrfile ? File::Spec->catfile(@$arrfile) : $arrfile; ok(-f File::Spec->catfile($module_base_dir, $file), "Exists: $file"); } # Standard file tests foreach my $arrfile (@test_files) { my $file = ref $arrfile ? File::Spec->catfile(@$arrfile) : $arrfile; subtest $file => sub { TestParseFile->new( { fn => File::Spec->catfile($module_base_dir, $file), %$distro_var } )->parse_file_start(); }; } # Module tests foreach my $module (@{$distro_var->{modules}}) { subtest $module => sub { TestParseModuleFile->new({ fn => File::Spec->catfile($module_base_dir, 'lib', split(/::/, "$module.pm")), module => $module, %$distro_var })->parse_module_start(); }; } rmtree $module_base_dir unless ($ENV{'DONT_DEL_TEST_DIST'}); }; } my @rand_char = split //, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'; sub rstr { my $str = ''; my $len = int(rand(20)) + 1; $str .= $rand_char[ int(rand(@rand_char)) ] for (1 .. $len); return $str; } sub rstr_array { my @str; my $len = int(rand(5)) + 1; push(@str, rstr) for (1 .. $len); return @str; } sub rstr_module { my @str; my $len = int(rand(5)) + 1; push(@str, rstr) for (1 .. $len); while ($str[0] =~ /^\d+/) { $str[0] =~ s/^\d+//; shift @str unless ($str[0]); return rstr_module() unless (@str); } return join('::', @str); } plan tests => 5; my $DONT_DEL = $ENV{'DONT_DEL_TEST_DIST'}; run_settest('MyModule-Test', { distro => 'MyModule-Test', modules => ['MyModule::Test', 'MyModule::Test::App'], builder => 'Module::Build', license => 'artistic2', author => 'Baruch Spinoza', email => 'spinoza@philosophers.tld', verbose => 0, force => $DONT_DEL, }); run_settest('Book-Park-Mansfield', { distro => 'Book-Park-Mansfield', modules => [ 'Book::Park::Mansfield', 'Book::Park::Mansfield::Base', 'Book::Park::Mansfield::FannyPrice', 'JAUSTEN::Utils', ], builder => 'Module::Build', license => 'artistic2', author => 'Jane Austen', email => 'jane.austen@writers.tld', verbose => 0, force => $DONT_DEL, }); # Test all variations of everything # To make sure that we capture any new licenses, we can grab # $Module::Starter::Simple::LICENSES and check the keys. # Thus, any desyncs between here and there will fail tests. my @licenses = keys %$Module::Starter::Simple::LICENSES; foreach my $builder (qw(ExtUtils::MakeMaker Module::Build Module::Install)) { subtest "builder = $builder" => sub { $builder = $builder; # 5.8 scoping issue (GH#57) plan (eval { require_module $builder; 1 } ? (tests => scalar @licenses) : (skip_all => $builder.' not installed') ); foreach my $license (@licenses) { subtest "license = $license" => sub { $license = $license; # 5.8 scoping issue (GH#57) plan tests => 5; foreach my $minperl (5.006, 5.008001, v5.10.0, 'v5.10.1', $]) { subtest "minperl = $minperl" => sub { plan (version->parse($minperl) > version->parse($]) ? (skip_all => "$minperl is actually newer than Perl version ($])") : (tests => 16) ); foreach my $it (0..15) { subtest "ignores_type = ".substr(unpack("B8", pack("C", $it)), 4) => sub { # Only run through 1% of these tests, since there's so many combinations # (But, always do both force tests.) plan ((rand() > .01) ? (skip_all => 'Only testing a 1% sample') : (tests => 2) ); # This stuff should always be the same for both force tests. # Force tests should always been last (innermost) in the loop as well. my $distro = join('-', rstr_array); my $author = rstr.' '.rstr; my $email = join('.', rstr_array).'@'.join('.', rstr_array).'.tld'; my @modules; my $len = int(rand(20)) + 1; push(@modules, rstr_module ) for (1 .. $len); @modules = sort { # match the sorting to exactly what the MANIFEST lists would look like my ($q, $r) = ($a, $b); $q =~ s|::|/|g; $r =~ s|::|/|g; return lc $q cmp lc $r; } @modules; foreach my $force (0, 1) { subtest "force = $force" => sub { $ENV{'DONT_DEL_TEST_DIST'} = !$force || $DONT_DEL; run_settest(['loop', $distro], { # store these in its own directory distro => $distro, modules => \@modules, builder => $builder, license => $license, author => $author, email => $email, minperl => $minperl, verbose => 0, force => $force, ignores_type => [ ('generic') x!! ($it | 8), ('cvs') x!! ($it | 4), ('git') x!! ($it | 2), ('manifest') x!! ($it | 1), ], }); }; } }; } }; } }; } }; } $ENV{'DONT_DEL_TEST_DIST'} = $DONT_DEL; my $loop_dir = File::Spec->catdir(qw(t data loop)); rmtree $loop_dir if (-d $loop_dir && !$DONT_DEL); 1; =head1 NAME t/test-dist.t - test the integrity of prepared distributions. =head1 AUTHOR Shlomi Fish, L Heavy revamp by Brendan Byrd, L Module-Starter-1.73/t/lib/0000755000175000017500000000000013143242255014725 5ustar grinnzgrinnzModule-Starter-1.73/t/lib/Module/0000755000175000017500000000000013143242255016152 5ustar grinnzgrinnzModule-Starter-1.73/t/lib/Module/Starter/0000755000175000017500000000000013143242255017576 5ustar grinnzgrinnzModule-Starter-1.73/t/lib/Module/Starter/TestPlugin.pm0000644000175000017500000005341713064625343022251 0ustar grinnzgrinnzpackage Module::Starter::TestPlugin; # Module::Starter::PBP use base 'Module::Starter::Simple'; use version; $VERSION = qv('0.0.3'); use warnings; use strict; use Carp; sub module_guts { my $self = shift; my %context = ( 'MODULE NAME' => shift, 'RT NAME' => shift, 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); return $self->_load_and_expand_template('Module.pm', \%context); } sub Makefile_PL_guts { my $self = shift; my %context = ( 'MAIN MODULE' => shift, 'MAIN PM FILE' => shift, 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); return $self->_load_and_expand_template('Makefile.PL', \%context); } sub Build_PL_guts { my $self = shift; my %context = ( 'MAIN MODULE' => shift, 'MAIN PM FILE' => shift, 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); return $self->_load_and_expand_template('Build.PL', \%context); } sub Changes_guts { my $self = shift; my %context = ( 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); return $self->_load_and_expand_template('Changes', \%context); } sub README_guts { my $self = shift; my %context = ( 'BUILD INSTRUCTIONS' => shift, 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); return $self->_load_and_expand_template('README', \%context); } sub t_guts { my $self = shift; my @modules = @_; my %context = ( 'DATE' => scalar localtime, 'YEAR' => $self->_thisyear(), ); my %t_files; for my $test_file ( map { s{\A .*/t/}{}xms; $_; } glob "$self->{template_dir}/t/*" ) { $t_files{$test_file} = $self->_load_and_expand_template("t/$test_file", \%context); } my $nmodules = @modules; my $main_module = $modules[0]; my $use_lines = join( "\n", map { "use_ok( '$_' );" } @modules ); $t_files{'00-load.t'} = <<"END_LOAD"; use Test::More tests => $nmodules; BEGIN { $use_lines } diag( "Testing $main_module \$${main_module}::VERSION" ); END_LOAD return %t_files; } sub _load_and_expand_template { my ($self, $rel_file_path, $context_ref) = @_; @{$context_ref}{map {uc} keys %$self} = values %$self; die "Can't find directory that holds Module::Starter::PBP templates\n", "(no 'template_dir: ' in config file)\n" if not defined $self->{template_dir}; die "Can't access Module::Starter::PBP template directory\n", "(perhaps 'template_dir: $self->{template_dir}' is wrong in config file?)\n" if not -d $self->{template_dir}; my $abs_file_path = "$self->{template_dir}/$rel_file_path"; die "The Module::Starter::PBP template: $rel_file_path\n", "isn't in the template directory ($self->{template_dir})\n\n" if not -e $abs_file_path; die "The Module::Starter::PBP template: $rel_file_path\n", "isn't readable in the template directory ($self->{template_dir})\n\n" if not -r $abs_file_path; open my $fh, '<', $abs_file_path or croak $!; local $/; my $text = <$fh>; $text =~ s{<([A-Z ]+)>} { $context_ref->{$1} || die "Unknown placeholder <$1> in $rel_file_path\n" }xmseg; return $text; } sub import { my $class = shift; my ($setup, @other_args) = @_; # If this is not a setup request, # refer the import request up the hierarchy... if (@other_args || !$setup || $setup ne 'setup') { return $class->SUPER::import(@_); } # Otherwise, gather the necessary tools... use ExtUtils::Command qw( mkpath ); use File::Spec; local $| = 1; # Locate the home directory... if (!defined $ENV{HOME}) { print 'Please enter the full path of your home directory: '; $ENV{HOME} = <>; chomp $ENV{HOME}; croak 'Not a valid directory. Aborting.' if !-d $ENV{HOME}; } # Create the directories... my $template_dir = File::Spec->catdir( $ENV{HOME}, '.module-starter', 'PBP' ); if ( not -d $template_dir ) { print {*STDERR} "Creating $template_dir..."; local @ARGV = $template_dir; mkpath; print {*STDERR} "done.\n"; } my $template_test_dir = File::Spec->catdir( $ENV{HOME}, '.module-starter', 'PBP', 't' ); if ( not -d $template_test_dir ) { print {*STDERR} "Creating $template_test_dir..."; local @ARGV = $template_test_dir; mkpath; print {*STDERR} "done.\n"; } # Create or update the config file (making a backup, of course)... my $config_file = File::Spec->catfile( $ENV{HOME}, '.module-starter', 'config' ); my @config_info; if ( -e $config_file ) { print {*STDERR} "Backing up $config_file..."; my $backup = File::Spec->catfile( $ENV{HOME}, '.module-starter', 'config.bak' ); rename($config_file, $backup); print {*STDERR} "done.\n"; print {*STDERR} "Updating $config_file..."; open my $fh, '<', $backup or die "$config_file: $!\n"; @config_info = grep { not /\A (?: template_dir | plugins ) : /xms } <$fh>; close $fh or die "$config_file: $!\n"; } else { print {*STDERR} "Creating $config_file...\n"; my $author = _prompt_for('your full name'); my $email = _prompt_for('an email address'); @config_info = ( "author: $author\n", "email: $email\n", "builder: ExtUtils::MakeMaker Module::Build\n", ); print {*STDERR} "Writing $config_file...\n"; } push @config_info, ( "plugins: Module::Starter::PBP\n", "template_dir: $template_dir\n", ); open my $fh, '>', $config_file or die "$config_file: $!\n"; print {$fh} @config_info or die "$config_file: $!\n"; close $fh or die "$config_file: $!\n"; print {*STDERR} "done.\n"; print {*STDERR} "Installing templates...\n"; # Then install the various files... my @files = ( ['Build.PL'], ['Makefile.PL'], ['README'], ['Changes'], ['Module.pm'], ['t', 'pod-coverage.t'], ['t', 'pod.t'], ['t', 'perlcritic.t'], ); my %contents_of = do { local $/; "", split /_____\[ (\S+) \]_+\n/, }; for (values %contents_of) { s/^!=([a-z])/=$1/gxms; } for my $ref_path ( @files ) { my $abs_path = File::Spec->catfile( $ENV{HOME}, '.module-starter', 'PBP', @{$ref_path} ); print {*STDERR} "\t$abs_path..."; open my $fh, '>', $abs_path or die "$abs_path: $!\n"; print {$fh} $contents_of{$ref_path->[-1]} or die "$abs_path: $!\n"; close $fh or die "$abs_path: $!\n"; print {*STDERR} "done\n"; } print {*STDERR} "Installation complete.\n"; exit; } sub _prompt_for { my ($requested_info) = @_; my $response; RESPONSE: while (1) { print "Please enter $requested_info: "; $response = <>; if (not defined $response) { warn "\n[Installation cancelled]\n"; exit; } $response =~ s/\A \s+ | \s+ \Z//gxms; last RESPONSE if $response =~ /\S/; } return $response; } 1; # Magic true value required at end of module =pod =head1 NAME Module::Starter::PBP - Create a module as recommended in "Perl Best Practices" =head1 VERSION This document describes Module::Starter::PBP version 0.0.3 =head1 SYNOPSIS # In your ~/.module-starter/config file... author: email: plugins: Module::Starter::PBP template_dir: # Then on the command-line... > module-starter --module=Your::New::Module # Or, if you're lazy and happy to go with # the recommendations in "Perl Best Practices"... > perl -MModule::Starter::PBP=setup =head1 DESCRIPTION This module implements a simple approach to creating modules and their support files, based on the Module::Starter approach. Module::Starter needs to be installed before this module can be used. When used as a Module::Starter plugin, this module allows you to specify a simple directory of templates which are filled in with module-specific information, and thereafter form the basis of your new module. The default templates that this module initially provides are based on the recommendations in the book "Perl Best Practices". =head1 INTERFACE This module simply acts as a plugin for Module::Starter. So it uses the same command-line interface as that module. The template files it is to use are specified in your Module::Starter C file, by adding a C configuration variable that gives the full path name of the directory in which you want to put the templates. The easiest way to set up this C file, the associated directory, and the necessary template files is to type: > perl -MModule::Starter::PBP=setup on the command line. You will then be asked for your name, email address, and the full path name of the directory where you want to keep the templates, after which they will be created and installed. Then you can create a new module by typing: > module-starter --module=Your::New::Module =head2 Template format The templates are plain files named: Build.PL Makefile.PL README Changes Module.pm t/whatever_you_like.t The C file is the template for the C<.pm> file for your module. Any files in the C subdirectory become the templates for the testing files of your module. All the remaining files are templates for the ditribution files of the same names. In those files, the following placeholders are replaced by the appropriate information specific to the file: =over =item The nominated author. Taken from the C setting in your Module::Starter C file. =item Makefile or Module::Build instructions. Computed automatically according to the C setting in your Module::Starter C file. =item The current date (as returned by C). Computed automagically =item The name of the complete module distribution. Computed automatically from the name of the module. =item Where to send feedback. Taken from the C setting in your Module::Starter C file. =item The licence under which the module is released. Taken from the C setting in your Module::Starter C file. =item
The name of the main module of the distribution. =item
The name of the C<.pm> file for the main module. =item The name of the current module being created within the distribution. =item The name to use for bug reports to the RT system. That is: Please report any bugs or feature requests to bug-@rt.cpan.org> =item The current year. Computed automatically =back =head1 DIAGNOSTICS =over =item C<< Can't find directory that holds Module::Starter::PBP templates >> You did not tell Module::Starter::PBP where your templates are stored. You need a 'template_dir' specification. Typically this would go in your ~/.module-starter/config file. Something like: template_dir: /users/you/.module-starter/Templates =item C<< Can't access Module::Starter::PBP template directory >> You specified a 'template_dir', but the path didn't lead to a readable directory. =item C<< The template: %s isn't in the template directory (%s) >> One of the required templates: was missing from the template directory you specified. =item C<< The template: %s isn't readable in the template directory (%s) >> One of the templates in the template directory you specified was not readable. =item C<< Unknown placeholder <%s> in %s >> One of the templates in the template directory contained a replacement item that wasn't a known piece of information. =back =head1 CONFIGURATION AND ENVIRONMENT See the documentation for C and C. =head1 DEPENDENCIES Requires the C module. =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR Damian Conway C<< >> =head1 LICENCE AND COPYRIGHT Copyright (c) 2005, Damian Conway C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut __DATA__ _____[ Build.PL ]________________________________________________ use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => '
', license => '', dist_author => ' <>', dist_version_from => '
', requires => { 'Test::More' => 0, 'version' => 0, }, add_to_cleanup => [ '-*' ], ); $builder->create_build_script(); _____[ Makefile.PL ]_____________________________________________ use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => '
', AUTHOR => ' <>', VERSION_FROM => '
', ABSTRACT_FROM => '
', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, 'version' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => '-*' }, ); _____[ README ]__________________________________________________ version 0.0.1 [ REPLACE THIS... The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be understood before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it get an idea of the modules uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. ] INSTALLATION DEPENDENCIES None. COPYRIGHT AND LICENCE Copyright (C) , This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. _____[ Changes ]_________________________________________________ Revision history for 0.0.1 Initial release. _____[ Module.pm ]_______________________________________________ package ; use warnings; use strict; use Carp; use version; $VERSION = qv('0.0.3'); # Other recommended modules (uncomment to use): # use IO::Prompt; # use Perl6::Export; # use Perl6::Slurp; # use Perl6::Say; # Module implementation here 1; # Magic true value required at end of module __END__ !=head1 NAME - [One line description of module's purpose here] !=head1 VERSION This document describes version 0.0.1 !=head1 SYNOPSIS use ; !=for author to fill in: Brief code example(s) here showing commonest usage(s). This section will be as far as many users bother reading so make it as educational and exeplary as possible. !=head1 DESCRIPTION !=for author to fill in: Write a full description of the module and its features here. Use subsections (=head2, =head3) as appropriate. !=head1 INTERFACE !=for author to fill in: Write a separate section listing the public components of the modules interface. These normally consist of either subroutines that may be exported, or methods that may be called on objects belonging to the classes provided by the module. !=head1 DIAGNOSTICS !=for author to fill in: List every single error and warning message that the module can generate (even the ones that will "never happen"), with a full explanation of each problem, one or more likely causes, and any suggested remedies. !=over !=item C<< Error message here, perhaps with %s placeholders >> [Description of error here] !=item C<< Another error message here >> [Description of error here] [Et cetera, et cetera] !=back !=head1 CONFIGURATION AND ENVIRONMENT !=for author to fill in: A full explanation of any configuration system(s) used by the module, including the names and locations of any configuration files, and the meaning of any environment variables or properties that can be set. These descriptions must also include details of any configuration language used. requires no configuration files or environment variables. !=head1 DEPENDENCIES !=for author to fill in: A list of all the other modules that this module relies upon, including any restrictions on versions, and an indication whether the module is part of the standard Perl distribution, part of the module's distribution, or must be installed separately. ] None. !=head1 INCOMPATIBILITIES !=for author to fill in: A list of any modules that this module cannot be used in conjunction with. This may be due to name conflicts in the interface, or competition for system or program resources, or due to internal limitations of Perl (for example, many modules that use source code filters are mutually incompatible). None reported. !=head1 BUGS AND LIMITATIONS !=for author to fill in: A list of known problems with the module, together with some indication Whether they are likely to be fixed in an upcoming release. Also a list of restrictions on the features the module does provide: data types that cannot be handled, performance issues and the circumstances in which they may arise, practical limitations on the size of data sets, special cases that are not (yet) handled, etc. No bugs have been reported. Please report any bugs or feature requests to C@rt.cpan.org>, or through the web interface at L. !=head1 AUTHOR C<< <> >> !=head1 LICENCE AND COPYRIGHT Copyright (c) , C<< <> >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. !=head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. _____[ pod-coverage.t ]__________________________________________ #!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); _____[ pod.t ]___________________________________________________ #!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); _____[ perlcritic.t ]___________________________________________________ #!perl if (!require Test::Perl::Critic) { Test::More::plan( skip_all => "Test::Perl::Critic required for testing PBP compliance" ); } Test::Perl::Critic::all_critic_ok(); Module-Starter-1.73/t/pod-coverage.t0000644000175000017500000000131713064625343016726 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More; BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); Module-Starter-1.73/t/module-starter.t0000644000175000017500000002435613143171445017327 0ustar grinnzgrinnz#!perl -T =head1 DESCRIPTION module-starter.t is a collection of tests to ensure that the C script behaves correctly. We test... =over 4 =item * options processing =item * correct file layout of generated package =item * successful make and test runs of generated package =back =cut use strict; use warnings; use Test::More; plan skip_all => "these tests must be completely rewritten"; use File::Spec; use File::Temp qw/ tempdir /; use File::Find; use Carp qw/ carp /; use Module::Starter::BuilderSet; # Since we're making system calls from this test, we have to be extra # paranoid. # Clean up the environment my $old_path = $ENV{PATH}; $ENV{PATH} = ""; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; my $test_name = __FILE__; (my $dist_dir) = (File::Spec->rel2abs($test_name) =~ m{^(.+)$test_name$}); # $dest_dir may not have had the taint adequately scrubbed from it, so # we'll check to see if it contains some of the files we expect it to my $test_libpath = catfile($dist_dir, 't', 'lib'); my $test_filename = catfile($dist_dir, $test_name); my $changes_filename = catfile($dist_dir, 'Changes'); my $test_dir = catfile($dist_dir, 't'); my $module_starter = catfile($dist_dir, 'blib', 'script', 'module-starter'); my $template_dir = catfile($dist_dir, 't', 'data', 'templates'); my $config_dir = catfile($dist_dir, 't', 'data'); my $config_file = catfile($config_dir, 'config'); my $temp_dir = tempdir( CLEANUP => 1 ); my $author = 'C.J. Adams-Collier'; my $email = 'cjac@colliertech.org'; my %options = ( author => $author, email => $email, force => undef, ); sub generated_files { my $opts = shift; my @modules = (ref $opts->{module} eq 'ARRAY' ? @{ $opts->{module} } : $opts->{module}); my $starter_dir = $modules[0]; $starter_dir =~ s/::/-/g; my %generated_files = ( $starter_dir => 'd', catfile($starter_dir, 'lib') => 'd', catfile($starter_dir, 'MANIFEST') => 'f', catfile($starter_dir, 't') => 'd', catfile($starter_dir, 't', 'pod-coverage.t') => 'f', catfile($starter_dir, 't', '00-load.t') => 'f', catfile($starter_dir, 't', 'boilerplate.t') => 'f', catfile($starter_dir, 't', 'pod.t') => 'f', catfile($starter_dir, 't', 'manifest.t') => 'f', catfile($starter_dir, 'README') => 'f', catfile($starter_dir, 'Changes') => 'f', catfile($starter_dir, 'ignores.txt') => 'f', ); foreach my $module (@modules){ my @parts = split(/::/, $module); my $pm = pop @parts; my $filename = catfile(@parts, "${pm}.pm"); $generated_files{catfile($starter_dir, 'lib', $filename)} = 'f'; while(@parts){ my $dirname = catfile(@parts); $generated_files{catfile($starter_dir, 'lib', $dirname)} = 'd'; pop @parts; } } my $builder_set = Module::Starter::BuilderSet->new; my @builders = $builder_set->check_compatibility($opts->{builder}); foreach my $builder (@builders){ my $build_file = $builder_set->file_for_builder($builder); $generated_files{catfile($starter_dir, $build_file)} = 'f'; } return %generated_files; } sub check_generated_files { my $opts = shift; my %generated_files = generated_files($opts); my $all_files_correct = 1; foreach my $k (keys %generated_files) { my $v = $generated_files{$k}; if ($v eq 'f') { $all_files_correct = 0 unless -f $k; } elsif ($v eq 'd') { $all_files_correct = 0 unless -d $k; } else { # Not a directory or file? Weird. $all_files_correct = 0; } } my @modules = (ref $opts->{module} eq 'ARRAY' ? @{ $opts->{module} } : $opts->{module}); my $starter_dir = $modules[0]; $starter_dir =~ s/::/-/g; TODO: { local $TODO = "need to generate META.yml"; ok(-f catfile($starter_dir, 'META.yml'), "META.yml exists"); }; ok($all_files_correct, "All files present and accounted for"); my $num_extra_files = 0; find({ wanted => sub { unless( exists $generated_files{$File::Find::name} ){ $num_extra_files++; carp("found extra file: $File::Find::name"); } }, no_chdir => 1 }, $starter_dir ); is($num_extra_files, 0, "No extra files"); } sub catfile { File::Spec->catfile('a','b') =~ /^a(.+)b$/; my $separator = $1; my @parts = @_; return join($separator, # strip trailing directory separators map { my $part = $_; $part =~ s/$separator$//; $part } @parts ); } sub build_module_starter { my $opts = shift; $opts->{module} = "" unless exists $opts->{module}; $opts->{builder} = "" unless exists $opts->{builder}; my $starter_dir = (ref $opts->{module} eq 'ARRAY' ? $opts->{module}->[0] : $opts->{module} ); $starter_dir =~ s/::/-/g; # Now to try to build the Starter module... chdir( catfile($temp_dir,$starter_dir) ); (my($path, $perl)) = $^X =~ /^(.+)(perl.*)$/i; $perl = catfile($path,$perl); (my @dirs) = ( $old_path =~ /([^;:]+)(?:;|:|$)/g ); my $path_sep; if ($old_path eq join(":", @dirs)) { $path_sep = ":"; } elsif ($old_path eq join(";", @dirs)) { $path_sep = ";"; } my $builder_set = Module::Starter::BuilderSet->new; # Use only the supported builders which are not mutually exclusive my @builders; # Capture warnings printed to STDERR { local *STDERR; open STDERR, q{>}, File::Spec->devnull(); @builders = $builder_set->check_compatibility($opts->{builder}); } foreach my $builder ( @builders ){ my @commands = $builder_set->instructions_for_builder($builder); # ensure that we use the correct perl @commands = map { my $cmd = $_; $cmd =~ s/\bperl\b/$perl/; $cmd } @commands; my %commands; my %build_path; # Find tools needed by the builder my @deps = $builder_set->deps_for_builder($builder); foreach my $dir ( @dirs ) { foreach my $dependency ( @deps ){ if( grep { -x catfile($dir, $_) } @{ $dependency->{aliases} } ){ $build_path{$dir} = 1; $commands{$dependency->{command}} = 1; } } } my $build_path = join($path_sep, keys %build_path); my $env = "PERL5LIB=\$PERL5LIB:$test_libpath PATH=$build_path"; SKIP: { skip( "Can't find dependencies for $builder", int(@commands) ) if grep { !exists( $commands{ $_->{command} } ) } @deps; foreach my $command (@commands){ my $cmd = "$env $command > /dev/null 2>&1"; diag "RUNNING: $cmd"; if( $command !~ /install/ ){ system( $cmd ); is($?, 0, "$builder: $cmd"); }else{ TODO: { local $TODO = "install tests not yet designed"; is(1, 0, "$builder: $cmd"); }; } } } } chdir( $temp_dir ); } sub run_module_starter { my %opts = @_; my $command = $module_starter; my @option_string = (""); foreach my $k (keys %opts) { my $v = $opts{$k}; if( ref $v eq 'ARRAY' && int( @$v ) > 1 ){ # If the option is multi-valued, we will test both formats: # # --option=value0 --option=value1 # and # --option=value0,value1 $option_string[1] = $option_string[0] unless($option_string[1]); $option_string[0] .= join( " ", map { " --$k='$_'" } @$v ); my $COMMA= q{,}; $option_string[1] .= " --$k=" . join( $COMMA, @$v ); }else{ # in case anyone ever decides to pass a single-valued arrayref $v = $v->[0] if ref $v eq 'ARRAY'; # Make sure we append to the multi-value option string if it # exists for(my $i = 0; $i < int(@option_string) ; $i++ ){ # Flags have no value $option_string[$i] .= " --$k" . ($v ? "='$v'" : ''); } } } my $starter_dir = (ref $opts{module} eq 'ARRAY' ? $opts{module}->[0] : $opts{module} ); $starter_dir =~ s/::/-/g; foreach my $options ( @option_string ){ my $env = "PERL5LIB=\$PERL5LIB:$test_libpath"; $env .= " MODULE_STARTER_DIR=$config_dir" if -f $config_file; system( "$env $command $options 2>&1 >/dev/null" ); is($?, 0, "$env $command $options" ); check_generated_files(\%opts); build_module_starter(\%opts); } } ok( -f $changes_filename, '[paranoia] Dist dir contains Changes file' ); ok( -d $test_dir, '[paranoia] Dist dir contains t/' ); ok( -f $module_starter, '[paranoia] module_starter file exists' ); ok( -x $module_starter, '[paranoia] module_starter is executable' ); chdir( $temp_dir ); # Compute the number of tests for the plan with these variables: # # $x: no. of command line argument formats (1 for single args, 2 for multi) # $y: no. of builders. if none passed, uses default builder # z($y): no. of commands in builder $y's @instructions list # tests += $x * # $x command line argument formats # ( 1 + # module-starter ran correctly # 3 + # files generated correctly # ( $y * # $y builders # z($y) # number of commands in this builder $y's @instructions # ) # ) # run with one module. # default builder has 4 commands. # tests += 1 * ( 1 + 3 + ( 1 * 4 ) ) = 8 run_module_starter( %options, module => 'Foo::Bar' ); # run with two modules. # default builder has 4 commands. # tests += 2 * ( 1 + 3 + ( 1 * 4 ) ) = 16 run_module_starter( %options, module => [ 'Foo::Bar', 'Foo::Baz' ] ); # run with two modules and a couple of builders. # both builders have 4 commands. # tests += 2 * ( 1 + 3 + ( 2 * 4 ) ) = 24 run_module_starter( %options, module => [ 'Foo::Bar', 'Foo::Baz' ], builder => [ 'Module::Build', 'ExtUtils::MakeMaker' ], ); # run with one module, default builder, and our example plug-in # tests += 1 * ( 1 + 3 + ( 1 * 4 ) ) = 8 open my $fh, q{>}, $config_file or die "couldn't open config file '$config_file' for writing: $!"; print $fh "template_dir: $template_dir\n"; close $fh; run_module_starter ( %options, module => [ 'Foo::Bar' ], plugin => [ 'Module::Starter::TestPlugin' ], ); unlink $config_file; chdir( $dist_dir ); Module-Starter-1.73/t/00-load.t0000644000175000017500000000045013064625343015504 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More tests => 4; use_ok( 'Module::Starter' ); use_ok( 'Module::Starter::Simple' ); use_ok( 'Module::Starter::BuilderSet' ); use_ok( 'Module::Starter::Plugin::Template' ); diag( "Testing Module::Starter $Module::Starter::VERSION, Perl $], $^X" ); Module-Starter-1.73/t/pod.t0000644000175000017500000000060513064625343015134 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More; BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); Module-Starter-1.73/t/data/0000755000175000017500000000000013143242255015070 5ustar grinnzgrinnzModule-Starter-1.73/t/data/templates/0000755000175000017500000000000013143242255017066 5ustar grinnzgrinnzModule-Starter-1.73/t/data/templates/Module.pm0000644000175000017500000000312113064625343020653 0ustar grinnzgrinnzpackage Foo::Bar; use warnings; use strict; =head1 NAME Foo::Bar - The great new Foo::Bar! =head1 VERSION Version 0.01 =cut our $VERSION = '0.01'; =head1 SYNOPSIS Quick summary of what the module does. Perhaps a little code snippet. use Foo::Bar; my $foo = Foo::Bar->new(); ... =head1 EXPORT A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module. =head1 FUNCTIONS =head2 function1 =cut sub function1 { } =head2 function2 =cut sub function2 { } =head1 AUTHOR C.J. Adams-Collier, C<< >> =head1 BUGS Please report any bugs or feature requests to the bugtracker for this project on GitHub at: L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Foo::Bar You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =head1 COPYRIGHT & LICENSE Copyright 2007 C.J. Adams-Collier, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # End of Foo::Bar Module-Starter-1.73/t/data/templates/README0000644000175000017500000000253413064625343017757 0ustar grinnzgrinnzFoo-Bar The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it to get an idea of the module's uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module, run the following commands: perl Makefile.PL\n make\n make test\n make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Foo::Bar You can also look for information at: GitHub issue tracker https://github.com/xsawyerx/module-starter/issues AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Foo-Bar CPAN Ratings http://cpanratings.perl.org/d/Foo-Bar Search CPAN http://search.cpan.org/dist/Foo-Bar COPYRIGHT AND LICENCE Copyright (C) 2007 C.J. Adams-Collier This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Module-Starter-1.73/t/data/templates/Makefile.PL0000644000175000017500000000074213064637721021053 0ustar grinnzgrinnzuse strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo::Bar', AUTHOR => 'C.J. Adams-Collier ', VERSION_FROM => 'lib/Foo/Bar.pm', ABSTRACT_FROM => 'lib/Foo/Bar.pm', PL_FILES => {}, PREREQ_PM => { 'Test::More' => '0', }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Foo-Bar-*' }, ); Module-Starter-1.73/t/data/templates/t/0000755000175000017500000000000013143242255017331 5ustar grinnzgrinnzModule-Starter-1.73/t/data/templates/t/pod-coverage.t0000644000175000017500000000030613064625343022075 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More; eval 'use Test::Pod::Coverage 1.04'; plan skip_all => 'Test::Pod::Coverage 1.04 required for testing POD coverage' if $@; all_pod_coverage_ok(); Module-Starter-1.73/t/data/templates/t/00-load.t0000644000175000017500000000021113064625343020651 0ustar grinnzgrinnz#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Foo::Bar' ); } diag( "Testing Foo::Bar $Foo::Bar::VERSION, Perl $], $^X" ); Module-Starter-1.73/t/data/templates/t/pod.t0000644000175000017500000000024613064625343020307 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More; eval 'use Test::Pod 1.14'; plan skip_all => 'Test::Pod 1.14 required for testing POD' if $@; all_pod_files_ok(); Module-Starter-1.73/t/data/templates/t/boilerplate.t0000644000175000017500000000244113064625343022026 0ustar grinnzgrinnz#!perl -T use strict; use warnings; use Test::More tests => 3; sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } TODO: { local $TODO = "Need to replace the boilerplate text"; not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); module_boilerplate_ok('lib/Foo/Bar.pm'); } Module-Starter-1.73/t/data/templates/Changes0000644000175000017500000000015313064625343020365 0ustar grinnzgrinnzRevision history for Foo-Bar 0.01 Date/time First version, released on an unsuspecting world. Module-Starter-1.73/t/data/templates/Build.PL0000644000175000017500000000000013064625343020355 0ustar grinnzgrinnzModule-Starter-1.73/t/BuilderSet.t0000644000175000017500000000644613143170461016417 0ustar grinnzgrinnz#perl -T # This test suite ensures that Module::Starter::BuilderSet behaves use strict; use warnings; use Test::More tests => 17; eval { require Module::Starter::BuilderSet }; ok(!$@, 'require Module::Starter::BuilderSet'); my $bset = Module::Starter::BuilderSet->new; isa_ok($bset, 'Module::Starter::BuilderSet'); can_ok($bset, qw( default_builder supported_builders file_for_builder instructions_for_builder deps_for_builder method_for_builder check_compatibility ) ); ok( ( grep { $bset->default_builder() eq $_ } $bset->supported_builders() ), 'default builder is in the list of supported builders' ); ok( ( !grep { !$bset->file_for_builder($_) } $bset->supported_builders() ), 'all supported builders claim to generate a file' ); ok( (!grep {!$bset->instructions_for_builder($_)} $bset->supported_builders()), 'all supported builders provide build instructions' ); foreach my $builder ( $bset->supported_builders() ){ foreach my $dep ($bset->deps_for_builder($builder)){ ok( exists $dep->{command} && $dep->{command} ne '', "dependency command for '$builder' is set" ); ok(exists $dep->{aliases} && ref $dep->{aliases} eq 'ARRAY' && int( @{ $dep->{aliases} } ) > 0, "aliases look correct for builder '$builder', dep '$dep->{command}'" ); } } use Module::Starter::Simple; my $simple = bless {}, 'Module::Starter::Simple'; can_ok( $simple, map { $bset->method_for_builder($_) } $bset->supported_builders() ); my @incompat = ( 'ExtUtils::MakeMaker', 'Module::Install', ); my @compat = ( 'Module::Build', 'Module::Install', ); my @nonexistent = ( 'CJAC::Boing', 'CJAC::Flop', ); ok( int( $bset->check_compatibility() ) == 1 && ( $bset->check_compatibility() )[0] eq $bset->default_builder(), 'check_compatibility() with no args returns default builder' ); my @return; # Capture warnings printed to STDERR { local *STDERR; open STDERR, q{>}, File::Spec->devnull(); @return = $bset->check_compatibility(@nonexistent); } ok( int( @return ) == 1 && $return[0] eq $bset->default_builder(), 'check_compatibility() with unsupported builder returns default builder' ); my @return2; # Capture warnings printed to STDERR { local *STDERR; open STDERR, q{>}, File::Spec->devnull(); @return = $bset->check_compatibility(@incompat); @return2 = $bset->check_compatibility(reverse @incompat); } ok( int( @return ) != int( @incompat ), 'check_compatibility() strips incompatible builder' ); ok( $return[0] eq $incompat[0] && $return2[0] eq $incompat[-1], 'check_compatibility() gives precidence to the first module passed' ); is_deeply( [($bset->check_compatibility(@compat))], [@compat], "check_compatibility() returns all compatible builders" ); # Capture warnings printed to STDERR { local *STDERR; open STDERR, q{>}, File::Spec->devnull(); @return = $bset->check_compatibility(@compat, @incompat, @nonexistent); } is_deeply( \@return, \@compat, "check_compatibility() returns only compatible builders ". "when given mixed set of compatible, incompatible and nonsense" ); Module-Starter-1.73/Changes0000644000175000017500000003043113143242237015210 0ustar grinnzgrinnzRevision history for Perl extension Module::Starter 1.73 Fri Aug 11 01:46:00 EDT 2017 * Fix case where a distro name of '0' would be replaced by the first module name, confusing the tests (Dan Book) * Use Module::Runtime instead of string eval (Dan Book) 1.72 Sat Mar 25 21:20:41 EDT 2017 * Stable release containing previous fixes 1.71_01 Thu Mar 23 23:04:11 EDT 2017 * GH#51: drop use of Module::Build::Compat in Build.PL (Karen Etheridge) * GH#56: Fix generated syntax errors when using --fatalize (Dan Book) * GH#57: Fix strange scoping issue in test on 5.8 (Dan Book) * GH#58: Typo and doc fixes (Tordek) * GH#59: Quote versions in generated Makefile.PL/Build.PL (Dan Book) * GH#61: Fix version comparison in test (Dan Book) * GH#63: Remove unneeded dependency Module::Install::AuthorTests (Dan Book) * GH#64: Replace usage of Path::Class with File::Spec (Dan Book) 1.71 Fri Jan 30 13:28:31 2015 * GH #47: create_t breaks plugins. (David Pottage) 1.70 Tue Jan 20 20:56:31 2015 * Change the url for issues from rt.cpan.org to GitHub (David Pottage) * Added a missing module to prerequisites (David Pottage) * Marked t/pod* test scripts as RELEASE_TESTING (David Pottage) * Moved boilerplate test to xt/ directory (David Pottage) * Added a --fatalize option to generate code where warnings are fatal This changes the default behaviour, as fatal warnings are now considered unwise for any public module that many others depend on. See: http://blogs.perl.org/users/peter_rabbitson/2014/01/fatal-warnings-are-a-ticking-time-bomb-via-chromatic.html 1.62 Sun Dec 8 11:49:21 2013 * Fix regexp in tests to stop failing on 5.8.x (Sawyer X). * Fix FSF address in template block and tests (Brian Manning). * Typo fixes (David Steinbrunner). 1.61 Fri Dec 6 14:01:19 2013 * Stop getpwuid calls on Windows, instead prompt user for author. (Martin McGrath) 1.60 Thu Oct 25 20:29:50 2012 * Guess author from getpwuid if not provided (Hilko Bengen). * Guess email from $ENV{'EMAIL'} if not provided (Hilko Bengen). 1.59 Thu Oct 25 19:54:05 2012 * Skip POD tests unless RELEASE_TESTING environment is on. (Alberto Simoes) 1.58_03 Fri May 11 16:24:44 2012 -- Trying to clean up test failures. More to come. 1.58_02 Wed Apr 25 12:53:34 2012 -- All changes in this release are by Brendan Byrd (SineSwiper). Thank you! :) Licenses: * Add GPL3 licenses (fixes RT #72321). * Add all other supported licenses, including Software::License support (fixes RT #68634). New Params: * Make ignores_type an arrayref (closes Pull Request #8). * Add new --ignores parameter (also repeatable). * Add new --minperl parameter (Minimum Perl version). File Creation: * Fix MANIFEST.SKIP to skip creation of MANIFEST. * Make all warnings FATAL in created .t/.pm files. * Add config/build requires to Makefile/Build.PL. * Bulk up Module::Install Makefile.PL. * Fix ignores_guts to use different contents for MANIFEST.SKIP and other ignore files. test-dist.t Revamp: * Complete refactor of test-dist.t to make it more standardized. * Create new TestParseFile::parse_file_start method that handles parsing of all current created file types (outside of .pm files). * Use subtest for better organization. * Add verification that existing files are there and no new surprise files are not there. * Add new mega-loop to "test all variations of everything" (uses 1% sample size to keep test speed fast for average users). * Use .gitignore and MANIFEST.SKIP. 1.58_01 * Fix repository URL by Shlomi Fish (GH #7). 1.58 Sat Jul 2 15:58:46 2011 * Added prereq on Path::Class (RT #68360). * Doc fixes by Nicholas Bamber and Salvatore Bonaccorso (RT #68385). 1.57 Tue Apr 12 11:07:01 IDT 2011 * No functional changes. * Removing English from unnecessary tests that confuse a tester. 1.56 Thu Apr 7 17:01:11 IDT 2011 * No functional changes, productionizing. 1.55_01 Fri Jun 11 16:56:00 IDT 2010 Special thanks goes to Andy Lester, who has been, still is and will remain an inspiration to many programmers, myself included. [ENHANCEMENTS] Added hooks for distribution building in App. Thanks to brian d foy. MANIFEST is now created via the proper builder. Kept create_MANIFEST to act as hook. Added Apache license by pfig. * [RT #53539] Refactoring, adding hooks, described above. (Patch provided by brian d. foy) * [RT #27304] Minimal version of perl (5.006) (Patch provided by Alexandr Ciornii) * [RT #53339] ::Simple uses the builder to create the MANIFEST * Moved repository to Github * Some more refactoring in Simple::create_builder() 1.54 Tue Dec 8 09:11:00 CST 2009 This release could not have happened without Sawyer X. [ENHANCEMENTS] Added more exclusions. Thanks to Olivier Mengué. * [RT #45941] Correcting POD sections for Perl Critic (Sawyer X) * [RT #13847] Bail out if load fails, minimum Test::Harness (Sawyer X) * [RT #24110] Support for Test::CheckManifest + tests for it (Sawyer X) * [RT #22648] Pod::Parser (Pod::Usage) >= 1.21 (Sawyer X) (earliest Backpan version tested to work) * [RT #48723] Add metadata to META.yml (Sawyer X) (Patch provided by Olivier Mengué, thank you!) * [RT #39397] Add option to create .gitignore (Sawyer X) 1.52 Mon Jul 27 01:25:03 CDT 2009 * Support for more licenses. Thanks to Shlomi Fish. * Fix slashing problems for Windows. Thanks Olivier Mengué. * Complains about extra unparsed options to try to detect problems that come out of misquoted variables. Thanks to Gunnar Wolf. * The list of files to ignore is now called ignore.txt, which you can turn into .cvsignore, .gitignore, MANIFEST.SKIP or whatever. * Handles authors with apostrophes in their names better. Thanks to, not surprisingly, Dave O'Neill. * Removed module requirements on Test::Pod and Test::Pod::Coverage for Module::Starter to be built and installed. However, t/pod.t and t/pod-coverage.t do still both get created even if either of their two main modules are not installed. 1.50 Tue Oct 28 00:27:37 CDT 2008 * Added Perl Training Australia's getting-started.html * Add license setting to default Makefile.PL output (Thanks, Gabor!) * Fixed the RT link in the boilerplate. (Thanks, Shlomi) 1.46 Fri Nov 9 18:36 America/New_York 2007 [ENHANCEMENTS] * add Module::Install compat for ::Template plugin * boilerplate.t no longer appears in default MANIFEST * META.yml no longer appears in default MANIFEST [FIXES] * undo some bugs introduced by changing API of subclassable "guts" methods * remove some duplicated code 1.46 Wed Oct 31 08:49 America/New_York 2007 * put nearly all of the module-starter program into a module (to test) * add license to META.yml 1.44 Sun Oct 11 19:09 America/New_York 2007 * no changes since 1.43_03 1.43_03 [FIXES] * pod-coverage.t includes Pod::Coverage version check * Test::Pod and Test::Pod::Coverage are now requirements. Thanks, David Golden. 1.43_02 Wed Apr 25 09:37-Wed May 09 14:46 PDT 2007 [ENHANCEMENTS] * broke Module::Starter::Simple's README_guts and module_guts methods into smaller, override-able pieces * re-factored Module::Starter::Simple's build system; the build metadata now lives in Module::Starter::BuildSet. This allows us access to the metadata from the test suite. It also makes it a bit easier to add supported builders. * added a test Plugin module (based on Module::Starter::PBP) * wrote a test suite for running module-starter * wrote a test suite for Module::Starter::BuildSet * modified the critic Makefile target to name the policy which raised the violation * Split most long lines (>80 chars) on whitespace [FIXES] * Ensured that perlcritic succeeds without errors or warnings * Added perlcriticrc to the MANIFEST * corrected build -> builder in module-starter --help docs 1.43_01 Wed Mar 28 12:21:00 EDT 2007 [FIXES] * Now properly reports on all files in --verbose mode. [ENHANCEMENTS] * Add support for Module::Install 1.42 Wed Nov 9 11:25:10 CST 2005 [FIXES] * Don't build Build.PL or Makefile.PL multiple times * Move Test::More from require to build_require in Build.PL [ENHANCEMENTS] * Documentation now includes references to search.cpan, AnnoCPAN, RT and CPAN Ratings. * Email addresses are now obfuscated very basically as "andy at petdance.com". * Include boilerplate.t to notice unchanged boilerplate text * Experimental new method to handle plugin loading 1.40 Wed Jul 6 19:30:00 CDT 2005 [FIXES] * Document --dir option to module-starter * Proper escaping of $] and $^X * Never use \ for path delimiters in {Makefile,Build}.PL * Don't always completely ignore --license 1.38 Wed Mar 16 20:28:00 CST 2005 [FIXES] * Don't allow invalid module names 1.36 Mon Mar 7 08:38:00 CST 2005 [FIXES] * 00.load.t is now 00-load.t, so VMS and RiscOS folks can use it. * Escape apostrophes in author name in Makefile.PL * Add a link directly to this dist's queue in RT, not just to RT * Don't set configdir to something in $HOME if it's undef 1.34 Mon Sep 20 19:15:00 CDT 2004 [ENHANCEMENTS] * module-starter now reads a config file 1.30 Mon Aug 16 14:00:00 CDT 2004 [ENHANCEMENTS] * Module::Starter is now merely a public interface to plugins * Module::Starter::Simple, the old M::S is now a plugin * Module::Starter::Plugin::Template added * module-starter now shows usage if no parms are passed. * The t/pod.t and t/pod-coverage.t files now use tainting, and require the appropriate versions of Test::Pod and Test::Pod::Coverage, respectively. 1.22 Mon Jul 12 17:05:26 CDT 2004 [FIXES] * Another fix to inline POD, to cope with brain damage in Pod::Parser 1.20 Sun Jul 11 22:28:57 CDT 2004 [ENHANCEMENTS] * Moved some data (distro, basedir) from parameters to object data * Moved some data (rtname) from routine-local to parameter data * Correted lies in POD regarding args to create_distro * Every create_file method now calls a file_guts method to get contents. * All the quoted POD inline should now not render in perldoc. * The module-build script now respects --class * Minor refactoring of parameters to create_directory and _module * Everything is now an overridable object method. Thanks to Ricardo Signes. * Added verbose() method. * Added progress() method so subclass can decide how progress is reported. All of the above is courtesy the diligent work of Ricard Signes. [DOCUMENTATION] * Large expansion of POD (Starter.pm and module-starter) 1.00 Fri Jun 25 17:57:31 CDT 2004 [ENHANCEMENTS] * Added a README file. The README file is somewhat intelligently constructed, too. * Now you can specify both EU::MM and M::B as your builders, so the module can have a double life. Thanks to Sébastien Aperghis-Tramonifor the help. 0.04 Mon Apr 5 20:45:58 CDT 2004 [ENHANCEMENTS] * Added support for Module::Build. Thanks, Randy Sims. 0.02 Thu Feb 26 00:11:57 CST 2004 First real version, released on an unsuspecting world. Module-Starter-1.73/LICENSE0000644000175000017500000004347313067504735014745 0ustar grinnzgrinnzTerms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2005 by Andy Lester, Ricardo Signes and C.J. Adams-Collier. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2005 by Andy Lester, Ricardo Signes and C.J. Adams-Collier. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Module-Starter-1.73/META.yml0000644000175000017500000000171513143242255015171 0ustar grinnzgrinnz--- abstract: 'a simple starter kit for any module' author: - 'Andy Lester ' build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Module-Starter no_index: directory: - t - inc requires: ExtUtils::Command: '0' File::Spec: '0' Getopt::Long: '0' Module::Runtime: '0' Pod::Usage: '1.21' Test::Harness: '0.21' Test::More: '0' parent: '0' perl: '5.006001' version: '0.77' resources: IRC: irc://irc.perl.org/#toolchain bugtracker: https://github.com/xsawyerx/module-starter/issues homepage: https://github.com/xsawyerx/module-starter repository: https://github.com/xsawyerx/module-starter.git version: '1.73' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Module-Starter-1.73/perlcriticrc0000644000175000017500000000117513064625343016335 0ustar grinnzgrinnz[-CodeLayout::ProhibitParensWithBuiltins] [CodeLayout::ProhibitHardTabs] allow_leading_tabs = 0 [-ControlStructures::ProhibitPostfixControls] [-Documentation::RequirePodAtEnd] [-Documentation::RequirePodSections] [-InputOutput::ProhibitInteractiveTest] [-InputOutput::ProhibitBacktickOperators] [-Miscellanea::RequireRcsKeywords] [-Modules::RequireVersionVar] [-NamingConventions::ProhibitMixedCaseSubs] [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] [-ValuesAndExpressions::ProhibitEmptyQuotes] [-Variables::ProhibitPunctuationVars] [-BuiltinFunctions::ProhibitStringyEval]