4 use warnings FATAL => 'all';
5 use File::Path qw(mkpath);
7 my $project = $ARGV[0] or die "No project name passed";
9 my @parts = split('-', $project);
11 my $lib_file = join('/', 'lib', @parts).".pm";
13 my $author = $ENV{DISTAR_INIT_AUTHOR} or die "DISTAR_INIT_AUTHOR unset";
15 mkpath "${project}/maint";
17 mkpath join('/', $project, 'lib', @parts[0..$#parts-1]);
19 my $package_name = join('::', @parts);
21 open my $mpl_main, '>', "${project}/Makefile.PL"
22 or die "couldn't open Makefile.PL: $!";
24 print $mpl_main sprintf(<<'END', $package_name, $lib_file);
26 use warnings FATAL => 'all';
27 use ExtUtils::MakeMaker;
29 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
39 open my $mpl_maint, '>', "${project}/maint/Makefile.PL.include"
40 or die "couldn't open maint/Makefile.PL.include: $!";
42 print $mpl_maint sprintf(<<'END', $author);
43 BEGIN { -e 'Distar' or system qw(git clone git://git.shadowcat.co.uk/p5sagit/Distar.git) }
52 open my $pm, '>', "${project}/${lib_file}"
53 or die "Couldn't open .pm file: $!";
55 my $year = 1900+(localtime)[5];
57 my $mod_text = sprintf(<<'END', $package_name, $package_name, $author, $year, $package_name);
60 our $VERSION = '0.000001'; # 0.0.1
62 $VERSION = eval $VERSION;
68 %s - Description goes here
80 None yet - maybe this software is perfect! (ahahahahahahahahaha)
84 Copyright (c) %s the %s L</AUTHOR> and L</CONTRIBUTORS>
89 This library is free software and may be distributed under the same terms
93 $mod_text =~ s/^ //mg;
99 chdir($project); system("git init");