forked from libwww-perl/libwww-perl
/
VERSION
executable file
·89 lines (72 loc) · 1.86 KB
/
VERSION
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/local/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