Bug#2093: perl dumps core on libwww-perl-5b5
Package: perl
Version: 5.002-3
Perl dumps core when run on the VERSION file included with
libwww-perl-5b5 (Avaiable via the CPAN archive). A copy of the
VERSION file is included.
------------------------
#!/bin/perl
=head1 VERSION
This is a self-modifying file. Whenever a version number in one of the
members increases, this program increases its own version number by
0.01. Can also increment alfa/beta version numbers. Members are
enumerated below the __END__ token.
This implies that we get a new timestamp. If we make Makefile
dependent on this program, we get a new Makefile everytime one of the
versions changes. It is really not the cheapest solution, but maybe
the most trivial one.
Add a new module by writing its name on a line after the __END__ token.
Change the overall version number arbitrarily by changing it within
this file.
=head1 Author
Andreas Koenig <koenig@mind.de>
=cut
$VERSION="5b5";
use lib "lib";
while (<DATA>){
chop;
my($lib,$version)=split;
next unless $lib;
$lib{$lib}=$version || 0;
}
for $lib (sort keys %lib) {
push @m, "use $lib;";
push @n, "\$rewrite++ if \$$lib\::VERSION > $lib{$lib};\n";
push @o, "$lib \$$lib\::VERSION\n";
}
eval join "", @m;
die $@ if $@;
eval join "", @n;
die $@ if $@;
eval join "", "\$o = \"", @o, "\"";
die $@ if $@;
&rewrite if $rewrite;
print "$VERSION\n";
sub rewrite
{
# Increment version number
if ($VERSION =~ /((?:^\d+(?:\.\d+)?-?)?[ab])(\d+)$/) {
$VERSION = $1 . ($2 + 1);
} else {
$VERSION = sprintf("%.2f", $VERSION + 0.01);
}
# Patch this file
open READ, "$0" or die "Can't read myself: $!";
$versions = "";
while (<READ>) {
s/(^\$VERSION=)\d+(?:\.\d+)?;/$1$VERSION;/;
s/(^\$VERSION=)"\S+"/$1"$VERSION"/;
$versions .= $_;
last if /^__END__/;
}
close READ;
open WRITE, ">$0";
print WRITE $versions;
print WRITE $o;
close WRITE;
}
__END__
Font::AFM 1.07
HTML::Element 1.18
HTML::Entities 1.01
HTML::Parse 1.11
HTTP::Date 1.10
LWP 0.05
LWP::Socket 1.15
MIME::Base64 1.03
MIME::QuotedPrint 1.04
Mail::Cap 1.03
URI::URL 3.05
Reply to: