What you call atomic, most people call "error handling". die/eval is the standard Perl way of doing throwing and catching errors, similar to try/catch in Java. So, yes, die is what you want to do.

One more thing - you might want to look at named pipes instead of system. That way, you can parse the input of the command, if you want.

One more thing - you might want to take a look at the $? variable, which is set by the system() function. Read up on system.

One more thing - if the scripts are their own entities, it is a good thing. However, I would recommend looking at refactoring the functionality into various modules and packages, to benefit from code re-use.

One more thing - it looks like you're doing some sort of batch processing. There are very good applications that have already solved this problem, plus provide features you'll never think of. You might want to google for "batch process open source" and see what comes out. If your employer has the capital, I'd recommend either Oracle Scheduler or Control-M, for proprietary products. Stay away from Tivoli and SQL Scheduler.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose


In reply to Re: Is "die" the best way to be atomic? by dragonchild
in thread Is "die" the best way to be atomic? by BuddhaNature

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.