On Thu, 27 Mar 2008 12:36:18 +0200 Yossi Itzkovich <[EMAIL PROTECTED]> wrote:
> Tal,
> I work on Solaris. Isn't there a portable module around ?
>
> Yossi
>
Not as far as I can tell...
You could try using FAM[1] with SGI::FAM, but I suspect that would fall
back to polling.
A couple of other options might be to stat the directory, check
modification timestamp, rescan if needed.
This[2] discussion looks relevant, but I can't tell if the
file_events_notification thing there is usable.
Tal
[1] http://oss.sgi.com/projects/fam/
[2]
http://groups.google.ca/group/comp.lang.java.programmer/browse_thread/thread/c1db45121f5d8530/c826c6952326274b?lnk=raot
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Tal Kelrich
> Sent: Thursday, March 27, 2008 12:29 PM
> To: [email protected]
> Subject: Re: [Israel.pm] How to detect a new file in a directory
> without busy wait ?
>
> On Thu, 27 Mar 2008 11:50:35 +0200
> Yossi Itzkovich <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I have a script that should wait for a new file to be created, and
> > then start processing it. I don't know the filename, just the
> > pattern (known prefix). I can do it like this
> >
> > While (1)
> > {
> > get directory content
> > check each file for filename pattern. If found - last.
> > sleep for few 100ms
> > }
> >
> > But I guess there is a more elegant way. Is there ?
> >
>
> You should look at Win32::ChangeNotify and Linux::Inotify2, depending
> on your platform.
>
> Cheers,
> Tal
--
Tal Kelrich
PGP fingerprint: 3EDF FCC5 60BB 4729 AB2F CAE6 FEC1 9AAC 12B9 AA69
Key Available at: http://www.hasturkun.com/pub.txt
----
Homer: What?! Flanders! You're the Devil?
Devil Flanders:
Ho-oh, it's always the one you least suspect.
Treehouse of Horror IV
----
signature.asc
Description: PGP signature
_______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
