ARSperl

 view release on metacpan or  search on metacpan

infra/mkchanges.pl  view on Meta::CPAN

#!/usr/bin/perl
#
# $Header: /cvsroot/arsperl/ARSperl/infra/mkchanges.pl,v 1.9 2008/11/24 15:40:23 jeffmurphy Exp $
#
# mkchanges.pl [-t] -f changes.dat
#
# generate a "CHANGES" or "changes.html" file
# based on the "changes.dat" file
#
# jeff murphy
# jcmurphy@hot-sauce.org
#
# this code is available under the terms of the GNU license or the
# Perl Artistic License (your choice).

use strict;
use FileHandle;
use vars qw{$opt_t $opt_f};
use Getopt::Std;

getopts('tf:');

my ($html) = defined($opt_t)?0:1;

if((!defined($opt_f)) || (! -e "$opt_f")) {
	die "usage: mkchanges.pl [-t] -f changes.dat > outputfile
-t    text output (default = html)
-f    changes.dat input file
";
}

my($f) = new FileHandle($opt_f, "r");
die "open($opt_f) failed: $!" if !defined($f);

if($html) {
	headerHTML();
} else {
	headerTXT();
}

while(<$f>) {
	next if /^\#/;
	if(/^released=(\S+)\s+version=(.*)/) {
		if($html) {
			spewHTML($f, $1, $2);
		} else {
			spewTXT($f, $1, $2);
		}
	}
}
$f->close();

if($html) {
	footerHTML();
} else {
	footerTXT();
}

exit 0;


sub spewHTML {
	my ($f, $rel, $ver) = (shift, shift, shift);
	my ($first)     = 1;
	my ($beenthere) = 0;
	my ($count)     = 0;
  
	while(<$f>) {
		chomp;
		s/\r//g;

		if(/^$/) {
			print "</table></td></tr></table>\n\n<P>\n\n";
			return;
		}

		if(/^(\S+)/) {
			my $who = $1;
			my $cc  = ' ';

			s/^$who//;
			if($who =~ /^\!/) {
				$cc = '!';
				$who =~ s/^\!//;
			}

			s/^\s+//g;



( run in 0.482 second using v1.01-cache-2.11-cpan-39bf76dae61 )