#!/usr/bin/perl

use warnings;
use strict;

my $arg = shift or die "Please specify version\n";
$arg =~ /^\d+\.\d+\.\d+$/ or die "Invalid version number\n";

use File::Find;

find(\&wanted, 'lib');

sub wanted {
	return unless /\.pm$/;

	local $/ = undef;
	open my $f, "<:utf8", $_ or die;
	my $contents = <$f>;
	close $f;

	$contents =~ s/\$VERSION\s*=\s*'[^']+'/\$VERSION = '$arg'/g;

	open my $o, ">:utf8", $_ or die;
	print $o $contents;
	close $o;
}

