The test harness script (http://udell.roninhouse.com/examples/TestHarness.txt) relies on these CPAN modules:
The generic database driver
A driver for a specific datasource (e.g., DBD::ODBC
)
For web-client capability
By default, test-harness is set up to exercise the authorization
script (auth.asp
) from Chapter 12. Its configuration is governed by a
hashtable that looks like this:
%sequence = ( '000' => { 'Description' => 'No-header request fails access to docbase record', 'Request' => 'http://localhost/cgi/auth.asp?doc=1998-10-19-000001', 'HeaderNames' => [], 'HeaderValues' => [], }, ... '003' => { 'Description' => 'Valid basic-auth user fails feed registration', 'Request' => 'http://localhost/cgi/auth.asp?doc=1998-10-19-000001', 'HeaderNames' => ['Authorization'], 'HeaderValues' => ['Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='], 'Constructor' => 'unRegisterAladdinForNetscape', 'Destructor' => 'reRegisterAladdinForNetscape', },
To configure test-harness for some other web application, rewrite this hashtable. You might prefer to swap in your own stuff, since the authorizing docbase viewer used here is a bit complex to set up. Specify one or more requests, optionally with HTTP headers and optionally with the names of Constructor and Destructor routines that prepare the environment for a test and clean up after it.
To gather baseline data, run test-harness once in baseline mode, like this:
perl test-harness baseline
Then run it in test mode, like this:
perl test-harness test
The results, written to test.htm
in the current
directory, can be viewed in browser.
The NewsWire module (http://udell.roninhouse.com/examples/NewsWire.pm), which requires CPAN’s LWP, is configured for a half-dozen technology news sites. Because the URLs used to search these sites tend to evolve, as do the result pages sent back from them, you may need to tweak one or more of the sites enumerated in this module.
You can use a simple driver script (http://udell.roninhouse.com/examples/nw) to exercise the NewsWire module. To run a metasearch for XML stories, put NewsWire.pm and nw in a directory and type:
perl nw XML > xml-results.html
The LDAP aggregation example includes a CGI script (http://udell.roninhouse.com/examples/ldap_aggregator), which is the handler for an HTML form (http://udell.roninhouse.com/examples/ldap.html).
Instead of the Group::LdapGroup module in Chapter 11, which uses Net::LDAP, this example uses Mozilla::PerLDAP, which is available from http://developer.netscape.com/tech/directory/ or directly from the ActiveState site, if you’re running Win32 Perl.
To try this example, install PerLDAP, then load the form into a browser and try searching for names. Alternatively, if you’ve already installed Net::LDAP, you might want to convert the script to use that module instead.