I want to update comments of checkedin files in Clearcase with Perl script.
This script works fine if the comment I'm passing from command line doesn't contain spaces.
But when I use comments with spaces, I run into error -
Error: Pathname not found: "C:/Views/view1/some_dir/test.c@@/main/dbg_test/1
Following is command line input to script:
>>./appendcomments.pl dbg_test "\"scr1234, Test Scr\""
Here is my code.
if ($#ARGV != 1 )
{
print "usage: addcomments.pl <base branch> <comment>\n";
print " For example addcomments.pl rel5.0 \"This is an example\"\n";
exit;
}
my $base_branch = $ARGV[0];
my $comment = $ARGV[1];
my ($output, @FILE_LIST, $file, $desr);
@FILE_LIST = `cleartool find -avobs -version "version(.../$base_branch/LATEST)" -print`;
FILE: foreach $file (@FILE_LIST)
{
$file =~ s/\\/\//g;
$desr =`cleartool describe -fmt %Nc $file`;
if ($desr !~ /scr\s*\#*\s*(\d+)/img)
{
chomp($file);
$output = `cleartool chevent -c $comment -replace $file`;
}
}