Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Triggering Perl Scripts

by asiufy (Monk)
on Apr 24, 2001 at 19:52 UTC ( [id://75113]=note: print w/replies, xml ) Need Help??


in reply to Triggering Perl Scripts

Instead of using the CRON, you can have your own parsing/formatting script poll for the new files in the specific directory. Something like this:
while (1<2) { opendir (DIR, $dir) or die "cannot opendir $dir"; my @only_files = grep {-f "$dir/$_"} readdir(DIR); readdir DIR; closedir DIR; foreach $file (@only_files) { &process_file ($file); } sleep(10); }

This will poll $dir every 10 seconds (set in the sleep line) for any new files.

If your files are big, you might want to add some of the verification mentioned earlier, regarding the file size, etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://75113]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found