Is there any Polling mechanism in perl ?

2003-04-04 Thread Madhu Reddy
Hi,
  Is there any polling mechanism in perl ?
Following is my problem..
my program has to wait (poll) on particular
folder...
If any file arrived on that folder, my main program
has to invoke another program...

In Unix, we have poll() system call for waiting on 
particular event ?

is there any similar thing in perl to wait on
particular event ?
if event occurs trigger some job..

following is my algorithm...
i want to implement in better way...

here file arrived means, completely transfered...
Files will be FTPed to C:\temp on my local system...
once that FTP is completed, i want to know...
But i don't want to know in the middle of FTP.
I want to know after FTP done...
I think here we need unix lsof command?
Does anybody have any idea ? about that?


while(1) {
 if (file arrived on C:\temp\) {
 mail me the file name. 
  }

}




__
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Is there any Polling mechanism in perl ?

2003-04-04 Thread Wiggins d'Anconia
Madhu Reddy wrote:
Hi,
  Is there any polling mechanism in perl ?
Following is my problem..
my program has to wait (poll) on particular
folder...
If any file arrived on that folder, my main program
has to invoke another program...
In Unix, we have poll() system call for waiting on 
particular event ?

is there any similar thing in perl to wait on
particular event ?
if event occurs trigger some job..
following is my algorithm...
i want to implement in better way...
here file arrived means, completely transfered...
Files will be FTPed to C:\temp on my local system...
once that FTP is completed, i want to know...
But i don't want to know in the middle of FTP.
I want to know after FTP done...
I think here we need unix lsof command?
Does anybody have any idea ? about that?

while(1) {
 if (file arrived on C:\temp\) {
 mail me the file name. 
  }

}
You may run into limitations on the Win32 platform, but there are 
several places to start, check out:

http://search.cpan.org/author/JPRIT/Event-0.87/lib/Event.pod

Or for a higher level approach, check out POE:

http://poe.perl.org

There is a pre-built component for this very thing, 
POE::Component::Dirwatch which is not terribly robust, but it sounds 
adequate for your purposes.  I used it for several months before hacking 
a more specifically tailored version for our app that handles errors 
better and more specific file uses. POE has a relatively steep learning 
curve at the beginning but once over the hump it is incredibly powerful.

In both cases be sure to check out the Win32 compatibility I have no 
knowledge on this front

http://danconia.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]