> I need to look at a directory for about 90 seconds, and if a certain
> file shows up, do something with it.  A pointer to a man page or any
> reference would be appreciated.
> 

perldoc -f opendir
perldoc -f readdir

A simple way to do this is to open the directory, loop over its contents
with readdir looking for your file. Then sleep for a second or some
interval, then read the contents again.  Set a counter for the number of
iterations and then kill the while when it hits 90 (aka 90 seconds). 
There are lots of ways this could be changed/improved, but it gets the
job done at least as well as the specification provided...

--pseudo code--

opendir or die
counter = 0
while counter < 90
  list = readdir
  if list contains file
     process file
     last
   
   counter+1
   sleep 1

close dir

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to