# Update the versions from Subversion
use Cwd qw(abs_path);
use File::Basename;
use File::Find;

# Get the current path and revision
my $file = abs_path($0);
my $path = dirname($file);

# Find all pm, pl, xml, xsl and xsd files
find( { wanted => \&do_version }, $path );

# callback to do the tidying.
sub do_version
{
    my $file = $File::Find::name;

    return unless $file =~ /\.pm$/;

    open( FILE, "+<" . $file );

    my @lines = <FILE>;

    seek FILE, 0, 0;

    foreach my $line (@lines)
    {
        $line =~ s/VERSION\s*=\s*'.*'/VERSION = '0.01'/g;
        print FILE $line;
    }
    close FILE;

    system("cat $file | sed -e '/^1;/,/wibble/ d' | sed -e '\$a1;'> $file.tmp ; mv -f $file.tmp $file");

}
