3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

Move $VERSION out of PBot.pm and to its own VERSION.pm module

This commit is contained in:
Pragmatic Software 2010-06-05 04:34:14 +00:00
parent 4e4574d2b6
commit b1c2a12500
3 changed files with 24 additions and 9 deletions

View File

@ -10,15 +10,10 @@ package PBot::PBot;
use strict;
use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 140,
BUILD_DATE => "2010-06-04",
};
use PBot::VERSION;
use vars qw($VERSION);
$VERSION = BUILD_NAME . " revision " . BUILD_REVISION . " " . BUILD_DATE;
$VERSION = PBot::VERSION::BUILD_NAME . " revision " . PBot::VERSION::BUILD_REVISION . " " . PBot::VERSION::BUILD_DATE;
# unbuffer stdout
STDOUT->autoflush(1);

20
PBot/VERSION.pm Normal file
View File

@ -0,0 +1,20 @@
# File: VERSION.pm
# Author: pragma_
#
# Purpose: Keeps track of bot version.
# $Id$
package PBot::VERSION;
use strict;
use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 141,
BUILD_DATE => "2010-06-04",
};
1;

View File

@ -13,11 +13,11 @@ $rev++;
print "New version: $rev $date\n";
open my $in, '<', "PBot/PBot.pm" or die "Couldn't open PBot.pm for reading: $!";
open my $in, '<', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for reading: $!";
my @lines = <$in>;
close $in;
open my $out, '>', "PBot/PBot.pm" or die "Couldn't open PBot.pm for writing: $!";
open my $out, '>', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for writing: $!";
foreach my $text (@lines) {
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;