Hello Perl Folks,

i've got a general question concerning a little program I'm writing at the moment. The main purpose of it is, to be an "event triggered launcher". To give you an example - I would like to have the following job done:

scan a defineable list of directories, say d:\data\company1, d:\data\company2, d:\data\company3 ....
if the program detects a file (or more) in one of these directories it should check wether the file(s) is(are) completely written, something like flock "filehandle", ($LOCK_EX + $LOCK_NB) or return(1).
if yes, it should start a job "on" that particular file, e.g. move the file from that directory to a different one or send that file via ftp to host xyz or.....
That should be defineable for every directory (and/or perhaps for every file)!
And of course the program should do a good job in logging everything, one central log (normal and errors) and one log for each directory.

I've almost finished the tool but I'm not completely satisfied with it, the code looks a bit complex (300 lines, 20% comments -> perl feature or just me, being a beginner?).
My question now is, if there exist some special pieces of code, modules, libraries or functions it would be worth to have a look at, to simplify the task/code. Perhaps someone has already written something similar and I could snaffle some lines.

For example I would like to have the code to be runnable on Unix and Win32 but these back/forward slashes within the path names are driving me crazy........now it only runs on Win32 :-(

This is my first posting, so be forgiving about any newbie mistake (please correct me).

cheers

Bjoern

P.S.
The file-locking really works :-)

In reply to General Question: File triggered job launcher by Bjoern

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.