#!/usr/bin/perl -w
#
# slideshow - continuous display of the latest image from the ccd camera
#             in the current working directory.
#
# author: Richard Jones
#         University of Connecticut
#         May 6, 2009

$pidis = 0;
$this1 = "";
while ($latest = `ls -t *.tif | head -n 1`) {
   chop $latest;
   if ($latest eq $this1) {
      sleep 2;
      next;
   }
   if ($pidis) {
      `kill $pidis`
   }
   `display $latest &`;
   $pidis = $$;
   $this1 = $latest;
}
