Hi,
Now I have modified the script as shown below. I am using for the first time, Please be kind to forgive mistakes.
use Date::Calc qw(Delta_YMD);
@date = localtime();
open(LOG, ">veiwreport.txt") or print die $!;
@vlist = "raghavr_view11";
foreach(@vlist)
{
@viewdetails = `cleartool lsview -prop -full $_`;
}
foreach $vd (@viewdetails)
{
if ($vd =~ m/Last accessed/)
{
@details = split(/\s+/,$vd);
$accdet = $details[2];
@acc = split(/T/,$accdet);
chomp(@acc[0]);
print "\nLast accessed : @acc[0]";
print LOG "\t Last accessed : @acc[0]";
$ac=@acc[0];
@ac = split(/\-/,$ac);
$year1=@ac[0];
$month1=@ac[1];
$day1=@ac[2];
}
if ($vd =~ m/Created/)
{
@a = split(".",$vd,1);
@b = split("T",@a[0]);
$b[0] =~ s/(\w)*/ /;
$b[0] =~ s/\s+//;
print " created on $b[0]";
print LOG " created on $b[0]";
$crd=@b[0];
@cd = split(/\-/,$crd);
$year2=@cd[0];
$month2=@cd[1];
$day2=@cd[2];
}
$diff = Delta_YMD($year1,$month1,$day1, $year2,$month2,$day2);
print "Age of the $vd view is $diff \n";
}
First of all, I am getting the error: Date::Calc::Delta_YMD(): not a valid date at rs.pl line 60. Please suggest, as I am really struck here.
|