One of the fundamental problems in code generation systems is that people that use them are looking for the quickest, fastest way to get something done.
Therefore, by mere virtue of using a code generation system, they are disinclined to do things like replace the boilerplate abstracts and such.
I've needed a module starter for myself for a while, and Module::Starter seemed a bit like overkill, since my modules only have a Makefile.PL and Changes files, 2 test scripts and the module itself (with the automation doing the rest of it at release time).
While writing it, I thought I might as well implement certain functionality to make sure I always replace the boilerplate.
So here's what a typical module created by ADAMK::Starter (not going to CPAN) looks like :)
package DBIx::SQLiteSequence;
=pod
=head1 NAME
DBIx::SQLiteSequence - The author of the module is an idiot
=head1 SYNOPSIS
The author is stupid and forgot to write the synopsis
=head1 DESCRIPTION
The author is a self-professed buffoon who forgot to write the description
=head1 METHODS
=cut
use 5.005;
use strict;
use vars qw{$VERSION};
BEGIN {
$VERSION = '0.01';
}
#####################################################################
# Constructor and Accessors
=pod
=head2 new
The author is a mindless drone that forgot to write the docs for the new method
=cut
sub new {
my $class = shift;
# Create the object
my $self = bless { @_ }, $class;
# Check params
die "CODE INCOMPLETE";
return $self;
}
#####################################################################
# Main Methods
1;
=pod
=head1 SUPPORT
No support is available for this module, because the author is an
ugly troll that didn't bother to tell you what support is available.
=head1 AUTHOR
Adam Kennedy E
=head1 COPYRIGHT
Copyright 2007 Adam Kennedy <--- boring
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the
LICENSE file included with this module.
=cut
You know, an Acme::Module::Starter might be called for! The POD alone is worth the price of admission.
Re:Lovely!
sigzero on 2007-05-16T13:07:50
That is too funny...
#!/usr/bin/perl
use Cwd;
use File::Spec;
my $module = $ARGV[0] || prompt( "Module name> " );
my $dist = $module; $dist =~ s/::/-/g;
my $file = $module; $file =~ s/.*:://; $file.= ".pm";
my $cwd = File::Spec->catfile( cwd(), $dist );
system
join " ",
"/usr/local/bin/ttree",
"-s ~/.templates/modules" ,
"-d $cwd" ,
"-define module='$module'",
"-define module_file='$file'",
"-define module_dist='$dist'"
;
chdir $dist;
( my $base = $module ) =~ s/.*:://;
rename
File::Spec->catfile( 'lib', 'Foo.pm' ),
File::Spec->catfile( 'lib', $file );
sub prompt
{
print join "\n", @_;
print "> ";
my $line = <STDIN>;
chomp $line;
$line;
}
Re:The author of this module is a mindless drone
Alias on 2007-05-17T01:50:46
Well, I pretty much have what I want working now, so I'm happy to leave it as is.
It also means I can add other functionality like auto-commiting to my repository etc.
So I'm happy for now.