As a unix admin, I've played with a lot of systems to keep an eye on my servers to see if they're working correctly. One thing that's particularly irksome is making sure that all the customizations and features of your web servers are in place. For example, making sure that server side includes (ssi) works, but that ssi-exec is forbidden.

The obvious way to handle this is to write a web page that uses some normal ssi and also tries to run an ssi-exec command. Then you write a script that loads that page and checks for successfull ssi output from the normal command and also checks for the correct error message for the forbidden ssi exec.

This is a pain because you have to not only write the test pages but you also have to write the scripts that parse them.

The solution I've eventually reached is to write all my test web pages according to a strict format that not only encodes the tests but also the expected results. Then the scripts that I use to check the page don't have to know anything about the page to determine if the tests passed or failed.

The specific syntax I use for my test web pages isn't really that important, but here's what I use.

Heres an example:

<HTML> <HEAD><TITLE>SSI</TITLE></HEAD> <BODY> <H1>SSI TEST</H1> <H2>Basic SSI</H2> <H3>Foo</H3> <!--#set var="a_var" value="Foo"--> <H3><!--#echo var="a_var"--></H3> <H2>Exec Forbidden</H2> <H3>[an error occurred while processing this directive]</H3> <H3><!--#exec cmd="ls" --></H3> </BODY> </HTML>

I've written a perl module that I use internally that parses this kind of html and creates a handy object containing test results. It's still pretty rough, but it works. I've also written a nagios plugin that uses this module (and WOW does it make my job easier).

SO! My question to you monks is: is there any reason NOT to post this module to CPAN?


In reply to Module Idea by pileofrogs

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.