Hi! I have a challenge for all you perl monks.

Let's assume I have thousands of corrupted perl files, like so:

Good file:
print "hello world!\n";

Corrupt file:
pr;int "hello world!\n";

except that they are each hundreds of lines long and I have some that work and many more that don't. I don't care about salvaging the broken files, all I'm trying to do (ha) is modify the perl compiler so that it deletes or lists any file that is broken. If I have a list, then I can use a script to delete the files. If the compiler can delete the file itself then that is fine too. Also, (here's the fun part) if the file isn't broken then I would like the script to run.

I'm asking you monks here because although I've tried to modify the compiler (I replaced a line that printed an error message with a delete command), there are so many errors that perl checks for and tries to fix on its own (one of the many things I love about perl) that I can't find and replace every instance within the compiler (/usr/bin/perl).

Any ideas? Thanks in advance for any docs you might point me to or tips on modifying the compiler itself.


In reply to Deleting corrupted perl files - modifying the perl runtime by kylespitz

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.