AFS-Command

 view release on metacpan or  search on metacpan

util/bin/check_version  view on Meta::CPAN

#!/usr/bin/env perl
#
# $Id: check_version,v 7.1 2004/01/13 19:01:44 wpm Exp $
#
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
# OK, this hack fixes the $VERSION in all the modules, according the
# cwd.
#
# To run this, from the top level source directory,
# ./util/check_version
#

use Getopt::Long;
use File::Basename;
use Cwd;

GetOptions( \%args, qw( update version=s ) ) || die;

%skip = map { $_ => 1 }
  qw(
     .options/rcsMajor
     .msbaseline
     .exclude
     MANIFEST
     Changes.html
     README.html
    );

my $cwd = cwd;

my $newversion = $args{version};

if ( not $newversion ) {
    unless ( $cwd =~ m:perl5/AFS-Command/([^/]+)/: ) {
	die "Unable to determine MSDE version\n";
    }
    $newversion = $1;
}

warn "New \$VERSION is $newversion\n";

warn "Searching source tree for files...\n";

open(FIND,"find . -type f -print |") ||
  die "Unable to fork find: $!\n";

while ( <FIND> ) {
    chomp;
    s|^\./||;
    next if $skip{$_};
    next if /~$/;
    next unless /(\.pm(\.in)?|\.t)$/;
    push(@file,$_);
}

close(FIND) ||
  die "Error running find: $!\n";

foreach my $file ( sort @file ) {

    open(FILE,$file) || die "Unable to open $file: $!\n";
    my $found = 0;
    my $old = 0;
    while ( <FILE> ) {
	if ( $file =~ /\.pm(\.in)?$/ ) {
	    next unless /\$VERSION\s+=\s+\'([\d\.]+)\'/;
	    $version = $1;
	} else {
	    next unless /use\s+\S+\s+([\d\.]+)/;
	    $version = $1;
	}
	$found = 1;
	$old = 1 if $version ne $newversion;
	last;
    }
    close(FILE);

    if ( $file =~ /\.pm(\.in)?$/ ) {
	push(@missing,$file) unless $found;



( run in 1.054 second using v1.01-cache-2.11-cpan-140bd7fdf52 )