Automation Example: Processing Script

print 'The following sections describe the
schema of the database created through the SQL backend.';
while (<>) {
    if (/BEGIN AUTOSCHEMA/../END AUTOSCHEMA/) {
        if (/CREATE TABLE (\w+)\(.*\/\/ (.*)/) {
            print qq{
<h2>Table $1</h2>
<p>
$2.
</p>
<table border = "1">
<tr> <th>Field name</th> <th>Field type</th> <th>Value description</th> </tr>
            };
        } elsif (/^\s*\"(\w+).*\/\/ (.*)/) {
            $name = $1;
            $description = $2;
            $type = 'BOOLEAN' if (/booltype/);
            $type = 'CHARACTER VARYING' if (/varchar/);
            print "
<tr><td>$name</td><td>$type</td><td>$description</td></tr>
";
        } elsif (/\"\)\;\\n\"/) {
            print "</table>\n";
        }
    }
}