I needed to print out the last modified date of PDFs that are linked in a DCR.
Originally I was getting this value this run-time on the production server using javascript on the generated jsp page, but because we are moving to using a different server setup for preview (Tomcat) than our production server (Websphere), and in order to hard-code these dates on the generated template, I have moved to getting the last-modify date in PERL on the presentation template as the page is generated.
Here's what I'm using:
$pdf = iwpt_dcr_value('dcr.vendors.vendor.vendorPDF');
$directory = ("y:/default/main/branchname/WORKAREA/workareaname/jsp_files/foldername/docs/filefoldername/");
$pdfpath = $directory . $pdf;
$lastmod = (stat($pdfpath))[9];
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime($lastmod);
$year = 1900 + $yearOffset;
$last_update_time = "$months[$month] $dayOfMonth, $year";
Not every item has a pdf attached, so this date is only being used for the items that have pdfs.
As the generating process iterates through the entries, most of the dates are correctly parsing.
But on the 10th and 11th of 11 items that have attached pdfs, the last modify date is coming up as Dec 31, 1969.
Looking directly at the files, one file's last modify date is July 28, 2010 and the other is May 13, 2010. Any ideas as to where I might be going wrong?