Thanks for the response, guys.  I'm pleased that I don't have to write
such a thing from scratch,
Especially as I'm fairly new to Perl!

Well, when I've been manually testing the file processing, it hasn't
taken much time (20->30secs).  And I'm not expecting much traffic, so I
can take it easy with the programming for now!

However on a later project, doing much the same thing, _that_ will be
more of a challenge (more traffic, huge audio files, lots of
directories), so thanks for the pointers!

Regs
Rupert Heesom
Asst Distribution Engineer
Adventist World Radio


-----Original Message-----
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: 02 July 2002 15:36
To: [EMAIL PROTECTED]
Subject: Re: How would I go about "watching a directory"?


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]

Reply via email to