how to make perl code executed automatically when new file comes out ???

i am done with most of the script, the script is converting files from one format to another , so i need the script to run when new files comes out ...

Recommended Answers

All 8 Replies

Um, how is the conversion script supposed to know when a new file comes out? (And what does 'new file comes out' mean?) Is it when it's uploaded to the server or is it being created by another process?

If the new file is being uploaded to the server from a form, then your form processing script should be able to trigger your conversion script.

I suggest you use a directory watcher, (if new files all end up in the same place) that way your PERl code will be able to respond when a new file "comes out" and act accordingly.

Does this goes the same with executing the code automatically when it detects a specific file changes? In my workplace, the machine updates a specific file when its status changes.

Yes, coded correctly, it will run on an updated file as well, it will treat an updated file just as if a file is "new"

I see... So comes the question, how do you do it?

I suggest you use a directory watcher, (if new files all end up in the same place) that way your PERl code will be able to respond when a new file "comes out" and act accordingly.

thanks!

Thanks for the links.

So, how do you implement this one in Perl/Tk?

I have a Perl/Tk program that displays the status of the machine, basing the status to a text file. When that text file changes or has been modified by the machine, I want to rerun my Perl/Tk program.

I have read some threads from the other forums that you could use the sleep function but in some other forum, you shouldn't use sleep on Perl/Tk.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.