Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

Apache::ConfigFile does seem adequate for parsing, which is usually the hardest part. Its write method is documented in the POD as not working, but it probably wouldn't be too hard to just use a template approach to producing a correct file.

Now here's some advice that I've learned from a real adventure in debugging: Use proper locking that holds the lock from the time you read until the time you're done writing and have closed the output handle. Keep a copy of the original. Validate the newly written file with apachectl configtest and verify Syntax OK, and roll back to the original using the same sort of vigilance if it fails validation. Anything less can eventually get you a corrupted httpd.conf someday.


In reply to Re^2: Guidance on updating apache config files by davido
in thread Guidance on updating apache config files by nysus

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.