Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Guidance on updating apache config files

by davido (Cardinal)
on Mar 17, 2017 at 05:32 UTC ( [id://1184961] : note . print w/replies, xml ) Need Help??


in reply to Re: Guidance on updating apache config files
in thread Guidance on updating apache config files

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.


Dave

Replies are listed 'Best First'.
Re^3: Guidance on updating apache config files
by nysus (Parson) on Mar 17, 2017 at 12:30 UTC

    Good advice. I didn't consider these things.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks