I have various Perl programs that access a database. My question is do I use File::Slurp to read the SQL into the program or do I just put the SQL into the Perl program?

I think it makes the program cleaner but I am worried about someone deleting the SQL files

File Slurp

$sql = read_file("$ref->{config}->{SQLDIR}/USPS.sql"); &getOrders($ref,$sql);

File in program

my $sql = " select ORDER_ID, BATCH_ID, FIRST_NAME, LAST_NAME, TITLE, ADDRESS1, ADDRESS2, CITY, STATE, POSTAL_CODE, PHONE, EMAIL_ADDRESS, STORE_NUMBER, DELIVERY_METHOD, DELIVERY_ERROR, VALUE, CRM_REFERENCE, ASSIGNED_CARD_ID, CARD_ACTIVE_DATE, CARD_EXPIRED_DATE, REQUEST, ORDER_DATE, ITEM_CODE, CONVERT_ELIGIBLE, PROCESS_BATCH_ID, RESPONSE, PASSPHRASE, CONVERSION_SERIAL from INTEGRATION.OL_ORDER WHERE CLIENT_ID = 97 AND BATCH_ID = (SELECT * FROM (SELECT BATCH_ID FROM OL_ORDER WHERE CLIENT_ID = 97 AND DELIVERY_METHOD ='USPS' GROUP BY BATCH_ID ORDER BY BATCH_ID DESC NULLS LAST) WHERE ROWNUM <= 1)"; &getOrders($ref,$sql);

In reply to SQL in files or File::Slurp? by crusty_collins

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.