forked from libwww-perl/libwww-perl
-
Notifications
You must be signed in to change notification settings - Fork 5
/
VERSION
executable file
·83 lines (65 loc) · 1.73 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
#!/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. 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=0.06;
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;
printf "%.2f\n", $VERSION;
sub rewrite
{
$VERSION += 0.01;
open READ, "$0" or die "Can't read myself: $!";
$versions = "";
while (<READ>) {
s/(^\$VERSION=)\d+\.\d+/$1.$VERSION/e;
$versions .= $_;
last if /^__END__/;
}
close READ;
open WRITE, ">$0";
print WRITE $versions;
print WRITE $o;
close WRITE;
# Let's also update the version number in the README file
# XXX this does not work for me (aas@oslonett.no)
# $^I="~";
# @ARGV=qw(README);
# while (<>) {
# s/(lwp version)\\s+\\d+\\.\\d+([a-z]\d*)?/\$1 $VERSION/ig;
# }
}
__END__
HTTP::Date 1.07
LWP 0.03
LWP::Base64 1.06
LWP::Socket 1.06
URI::URL 3.03