in reply to Waiting For File Extension Changes

If, purchance, you are on Win32 and this only needs to run under Win32, then there is a native api that you can get at through Win32::ChangeNotify design for exactly this kind of thing. Very non-portable though, but worth a mention.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: Waiting For File Extension Changes
by Murpher (Initiate) on May 21, 2003 at 17:39 UTC
    I appreciate your suggestion but I'm on Solaris. Thanks anyway.

      Sorry. I guess 3-char extensions are pretty pervasive:)

      It might be a tad more efficient to use a hash instead of greping an array for the lookup.

      sub wait_for_files{ my %not_changed = %{ +shift }; while( sleep 1 and keys %not changed ) { -e and delete $not_changed{ $_ } for keys %not_changed; } }

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller