| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # THIS IS A GENERATED MODULE -- DON'T EDIT! | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | package App::Module::Setup::Templates::Default; | ||
| 9 | |||
| 10 | use File::Basename qw(dirname); | ||
| 11 | |||
| 12 | our $VERSION = "0.01"; | ||
| 13 | |||
| 14 | my $sar = <<'EOD'; | ||
| 15 | [% FILE Changes %] | ||
| 16 | Revision history for [% module.distname %] | ||
| 17 | |||
| 18 | [% module.version %] Date/time | ||
| 19 | First version, released on an unsuspecting world. | ||
| 20 | |||
| 21 | [% FILE MANIFEST %] | ||
| 22 | Changes | ||
| 23 | MANIFEST | ||
| 24 | Makefile.PL | ||
| 25 | README | ||
| 26 | lib/[% module.filename %] | ||
| 27 | t/00-load.t | ||
| 28 | [% FILE Makefile.PL %] | ||
| 29 | use strict; | ||
| 30 | use warnings; | ||
| 31 | use ExtUtils::MakeMaker; | ||
| 32 | |||
| 33 | WriteMakefile( | ||
| 34 | NAME => '[% module.name %]', | ||
| 35 | AUTHOR => '[% author.name %] <[% author.email %]>', | ||
| 36 | VERSION_FROM => 'lib/[% module.filename %]', | ||
| 37 | ABSTRACT_FROM => 'lib/[% module.filename %]', | ||
| 38 | LICENSE => '[% module.license %]', | ||
| 39 | PL_FILES => {}, | ||
| 40 | MIN_PERL_VERSION => '[% perl.minversion %]', | ||
| 41 | PREREQ_PM => { | ||
| 42 | 'Test::More' => 0, | ||
| 43 | }, | ||
| 44 | dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, | ||
| 45 | clean => { FILES => '[% module.distname %]-*' }, | ||
| 46 | ); | ||
| 47 | [% FILE README %] | ||
| 48 | [% module.distname %] | ||
| 49 | |||
| 50 | The README is used to introduce the module and provide instructions on | ||
| 51 | how to install the module, any machine dependencies it may have (for | ||
| 52 | example C compilers and installed libraries) and any other information | ||
| 53 | that should be provided before the module is installed. | ||
| 54 | |||
| 55 | A README file is required for CPAN modules since CPAN extracts the README | ||
| 56 | file from a module distribution so that people browsing the archive | ||
| 57 | can use it to get an idea of the module's uses. It is usually a good idea | ||
| 58 | to provide version information here so that people can decide whether | ||
| 59 | fixes for the module are worth downloading. | ||
| 60 | |||
| 61 | |||
| 62 | INSTALLATION | ||
| 63 | |||
| 64 | To install this module, run the following commands: | ||
| 65 | |||
| 66 | perl Makefile.PL | ||
| 67 | make | ||
| 68 | make test | ||
| 69 | make install | ||
| 70 | |||
| 71 | SUPPORT AND DOCUMENTATION | ||
| 72 | |||
| 73 | After installing, you can find documentation for this module with the | ||
| 74 | perldoc command. | ||
| 75 | |||
| 76 | perldoc [% module.name %] | ||
| 77 | |||
| 78 | You can also look for information at: | ||
| 79 | |||
| 80 | RT, CPAN's request tracker | ||
| 81 | http://rt.cpan.org/NoAuth/Bugs.html?Dist=[% module.distname %] | ||
| 82 | |||
| 83 | Search CPAN | ||
| 84 | http://search.cpan.org/dist/[% module.distname %] | ||
| 85 | |||
| 86 | |||
| 87 | COPYRIGHT AND LICENCE | ||
| 88 | |||
| 89 | Copyright (C) [% current.year %] [% author.name %] | ||
| 90 | |||
| 91 | This program is free software; you can redistribute it and/or modify it | ||
| 92 | under the same terms as Perl itself. | ||
| 93 | |||
| 94 | [% FILE lib/_Module.pm %] | ||
| 95 | #! perl | ||
| 96 | |||
| 97 | package [% module.name %]; | ||
| 98 | |||
| 99 | use warnings; | ||
| 100 | use strict; | ||
| 101 | use Carp qw( carp croak ); | ||
| 102 | |||
| 103 | |||
| 104 | =head1 NAME | ||
| 105 | |||
| 106 | [% module.name %] - The great new [% module.name %]! | ||
| 107 | |||
| 108 | =cut | ||
| 109 | |||
| 110 | our $VERSION = '[% module.version %]'; | ||
| 111 | |||
| 112 | |||
| 113 | =head1 SYNOPSIS | ||
| 114 | |||
| 115 | Quick summary of what the module does. | ||
| 116 | |||
| 117 | Perhaps a little code snippet. | ||
| 118 | |||
| 119 | use [% module.name %]; | ||
| 120 | |||
| 121 | my $foo = [% module.name %]->new(); | ||
| 122 | ... | ||
| 123 | |||
| 124 | |||
| 125 | =head1 EXPORT | ||
| 126 | |||
| 127 | A list of functions that can be exported. You can delete this section | ||
| 128 | if you don't export anything, such as for a purely object-oriented module. | ||
| 129 | |||
| 130 | |||
| 131 | =head1 FUNCTIONS | ||
| 132 | |||
| 133 | =head2 function1 | ||
| 134 | |||
| 135 | =cut | ||
| 136 | |||
| 137 | sub function1 { | ||
| 138 | } | ||
| 139 | |||
| 140 | =head2 function2 | ||
| 141 | |||
| 142 | =cut | ||
| 143 | |||
| 144 | sub function2 { | ||
| 145 | } | ||
| 146 | |||
| 147 | |||
| 148 | =head1 AUTHOR | ||
| 149 | |||
| 150 | [% author.name %], C<< <[% author.cpanid %] at CPAN dot org> >> | ||
| 151 | |||
| 152 | |||
| 153 | =head1 BUGS | ||
| 154 | |||
| 155 | Please report any bugs or feature requests to C<bug-[% module.distnamelc %] at rt.cpan.org>, or through | ||
| 156 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=[% module.distname %]>. I will be notified, and then you'll | ||
| 157 | automatically be notified of progress on your bug as I make changes. | ||
| 158 | |||
| 159 | |||
| 160 | =head1 SUPPORT | ||
| 161 | |||
| 162 | You can find documentation for this module with the perldoc command. | ||
| 163 | |||
| 164 | perldoc [% module.name %] | ||
| 165 | |||
| 166 | You can also look for information at: | ||
| 167 | |||
| 168 | =over 4 | ||
| 169 | |||
| 170 | =item * RT: CPAN's request tracker | ||
| 171 | |||
| 172 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=[% module.distname %]> | ||
| 173 | |||
| 174 | =item * Search CPAN | ||
| 175 | |||
| 176 | L<http://search.cpan.org/dist/[% module.distname %]> | ||
| 177 | |||
| 178 | =back | ||
| 179 | |||
| 180 | |||
| 181 | =head1 ACKNOWLEDGEMENTS | ||
| 182 | |||
| 183 | |||
| 184 | =head1 COPYRIGHT & LICENSE | ||
| 185 | |||
| 186 | Copyright [% current.year %] [% author.name %], all rights reserved. | ||
| 187 | |||
| 188 | This program is free software; you can redistribute it and/or modify it | ||
| 189 | under the same terms as Perl itself. | ||
| 190 | |||
| 191 | |||
| 192 | =cut | ||
| 193 | |||
| 194 | 1; # End of [% module.name %] | ||
| 195 | [% FILE t/00-load.t %] | ||
| 196 | #! perl -T | ||
| 197 | |||
| 198 | use Test::More tests => 1; | ||
| 199 | |||
| 200 | BEGIN { | ||
| 201 | use_ok( '[% module.name %]' ); | ||
| 202 | } | ||
| 203 | |||
| 204 | diag( "Testing [% module.name %] $[% module.name %]::VERSION, Perl $], $^X" ); | ||
| 205 | EOD | ||
| 206 | |||
| 207 | my @files; | ||
| 208 | my @dirs; | ||
| 209 | my %data; | ||
| 210 | |||
| 211 | sub load { | ||
| 212 | my ( $self ) = ( @_ ); | ||
| 213 | |||
| 214 | return ( \@files, \@dirs, \%data ) if @files; | ||
| 215 | |||
| 216 | open( my $fd, '<', \$sar ); | ||
| 217 | my $file; | ||
| 218 | my %dirs; | ||
| 219 | while ( <$fd> ) { | ||
| 220 | if ( /\[\%\s*FILE\s+(.*?)\s*\%\]/ ) { | ||
| 221 | push( @files, $file = $1 ); | ||
| 222 | $dirs{ dirname($file) }++ if dirname($file); | ||
| 223 | } | ||
| 224 | elsif ( $file ) { | ||
| 225 | $data{$file} .= $_; | ||
| 226 | } | ||
| 227 | else { | ||
| 228 | die("Internal error: Leading data in sar"); | ||
| 229 | } | ||
| 230 | } | ||
| 231 | @dirs = sort keys %dirs; | ||
| 232 | ( \@files, \@dirs, \%data ); | ||
| 233 | } | ||
| 234 | |||
| 235 | 1; | ||
| 236 |