On Wed, Dec 27, 2000 at 09:16:34AM -0800, Alfred Perlstein wrote:
> * Dan Langille <[EMAIL PROTECTED]> [001226 23:50] wrote:
> > 
> > My idea is to have a daemon, or something resembling one, sitting on 
> > the box watching the directory.  When a new file appears, it starts a perl 
> > script.  This perl script is beyound the scope of my question, but it  
> > processes all the files in the directory.  When finished, it looks for any 
> > more files and repeats as necessary.  If no more files, it exits.
> > 
> 
> This isn't an answer to your main question (i see it's already been
> discussed), but you may be able to use setup a kevent on the
> directory which should inform you if any files are added to it.

Unfortunately, I gather that Dan intends to write most of the FreshPorts
code in Perl, and AFAIK, Perl has no kqueue/kevent interface :(
Thus, to make use of kevent (which I certainly agree would be a better
FreeBSD-specific solution), he'd have to either 1. have a C program
which spawns Perl and his script on every change, or 2. have a C program
which spawns Perl once and signals it on every change.

The first way would be downright stupid IMHO..  The second one may
very well be more efficient than the readdir, sleep solution which
I proposed in other postings, seeing that Dan wants to process
the cvs-all mailings, which certainly do not arrive every few seconds :)

As a side-point - does Perl really have a kqueue/kevent interface?
If not, how hard would it be to write a litte Perl module to implement
that?  (Unfortunately, I am a complete stranger to Perl modules..)
A Perl script which uses kevent to wait on a directory would certainly
be more efficient than any of the above solutions :)

G'luck,
Peter

-- 
I am jealous of the first word in this sentence.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to