I am the programmer for a decent size company, we have over 50k people that use our system regularly. Because I do not want to shut the website off regularly to make changes, I made a 'upgrade' system that will use the 'mv' command to move the file and over-write the current file. If there are errors it ends up crashing the system so it is not as efficient as I would like it to be. My question is there a way that when I use my upgrade script which sees the files that are there available for upgrade, that can require those in a way that will not error out if there are errors, but will simply report any errors the file contains?

For example it detects the presence of /home/path/to/upgrade/files/my_code.conf
which could contain just perl code in this format:
#File Name: my_code.conf ## Subroutines in this file: ### sub1 ### sub2 ### sub3 sub sub1 { # Some code return 1; } sub sub2 { # Some code return 1; } sub sub3 { # Some code return 1; } 1;
That would be the file. So how can Perl just run a way to call a 'require' on that file to pull it in, but only for checking for errors and if it contains any just give me the results instead of actually doing a require and then getting a software error?

Sorry if that is hard to understand I can clarify it if you need me to.

Thanks,
Rich

In reply to question about checking a script for errors from within a perl program by Anonymous Monk

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.