From: Felix Geerinckx <[EMAIL PROTECTED]>
> on Tue, 02 Jul 2002 13:57:59 GMT, Rupert Heesom wrote:
>
> > I want to set up a perl script under W2K to watch a set of
> > directories for new files.
>
> See Win32::ChangeNotify
+
use Win32::IPC qw(wait_any);
> > Another secondary question would be "How do I daemonise a script?"
> > under W2K?
>
> See
> <http://www.perlguy.com/articles/nt_service.html>
>
> to find out how to turn a perl program into an NT service (maybe it
> also works on W2K).
It does of course work on Win2k and WinXP. I woud not recommend using
srvany.exe though.
It's much better to use either ActiveState's PerlSvc (pert of Perl
Dev. Kit) or Dave Roth's Win32::Daemon ( should be instalable via PPM
)
There's another thing ... if the processing of the files takes a lot
of time it might be better to use two threads. One that would watch
the directories, the other that would process the files. You do not
need a lot of synchronization in this, a single one-way pipe should
be enough.
Jenda
P.S.: I made a service that translates our ASPs and web pages for
multilingual websites that does just this. One thread watches the
directories and tests the service status and sends commands like
"directory X changed", "reload initfile", "check for updated
translations" and "quit" to the worker thread. You might find handy
my Win32::BiggerPipe ( http://jenda.krynicky.cz/perl/BiggerPipe.pm )
in case the processing takes long and the changes happen too often.
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]