|Do you know where your variables are?
Re^2: Guidance on updating apache config filesby davido (Cardinal)
|on Mar 17, 2017 at 05:32 UTC
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.