#!/usr/bin/perl -w use strict; use Cwd; my($ver, $date, $coder); my $currentDir = cwd(); # remember starting dir # change into temp working area chdir "/tmp" or die "Could not change to /tmp because: $!\n"; # grab the cvs project from the repository `cvs co scripts`; #hop into the temp dir chdir "./scripts" or die "Could not change to /tmp because: $!\n"; # run 'cvs log' against file and grab the output my @output = `cvs log myFile.pl`; for(@output) { next if 1..11; # skip first eleven lines of output $ver = $1 if(/^revision\s(\d+\.\d+)$/); $date = $1, $coder = $2 if(m!^date:\s(\d{4}/\d{2}/\d{2})\s[\d|:]+;\s+author:\s+(\w+);!); # if we have everything we were looking for # print it out and undef the variables if( defined($ver) && defined($date) && defined($coder) ) { print "ver = $ver\ndate = $date\ncoder = $coder\n\n"; undef $ver; undef $date; undef $coder; next; } } # end while # change back to tmp dir and delete the project chdir "/tmp" or die "Could not change to /tmp because: $!\n"; `rm -rf ./scripts`; # return the user to his scheduled dir chdir $currentDir or die "Could not change to $currentDir because: $!\n";