use strict; use warnings; use ExtUtils::MakeMaker; sub parseversion { # grab the version number from the changelog. I look for lines line # # libpackage-perl (0.02) # # I parse out the 0.02 part open DCH, '<', 'Changes' or die "Couldn't open 'Changes'"; my ($version) = =~ /^\S+ \s* \( ([0-9\.]+) \)/x or die "Couldn't parse version from 'Changes'"; close DCH; # The version is also stored in the script itself. Here I extract that version # number and make sure the two match open PL, '<', 'bin/feedgnuplot' or die "Couldn't open 'bin/feedgnuplot'"; while() { if( /VERSION = ([0-9\.]+)/ ) { if ( $1 != $version ) { die "Version mismatch. Changes says version is '$version', but 'bin/feedgnuplot' says it is '$1'"; } return $version; } } die "Couldn't parse version from 'bin/feedgnuplot'"; } sub MY::libscan { package MY; my ($self, $file) = @_; # Don't install any symlinks (i.e. README.pod) return undef if -l $file; # Don't install any feedgnuplot.pm. This exists only to make CPAN index this # distribution return undef if $file =~ /feedgnuplot.pm/; return $self->SUPER::libscan ($file); } # I want my manpage to go into the man section '1', NOT '1p'. Here I add a # snippet to the end of the generated Makefile to force this # # I also generate the feedgnuplot.pm. This exists only to make CPAN index this # distribution sub MY::postamble { return <<'EOF' MAN1EXT := 1 lib/App/feedgnuplot.pm: bin/feedgnuplot mkdir -p lib/App echo 'package App::feedgnuplot;' > $@ cat $^ >> $@ echo '1;' >> $@ dist: lib/App/feedgnuplot.pm EOF } WriteMakefile ( NAME => 'feedgnuplot', AUTHOR => q{Dima Kogan }, VERSION => parseversion(), ($ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE' => 'perl') : ()), PL_FILES => {}, EXE_FILES => [ 'bin/feedgnuplot' ], BUILD_REQUIRES => { 'String::ShellQuote' => 0}, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'feedgnuplot-* lib' }, );