return to first page linux journal archive
keywordscontents

Listing 1. PerlHandler Module

#!/usr/bin/perl -w
# Set the package
package Apache::TestModule;
# Give us maximum debugging and strictness
use strict;
use diagnostics;
# Import constants for mod_perl
use Apache::Constants qw(OK);
# Default handler subroutine name
sub handler
{
	# Get the Apache request object
	my $r = shift;
	# Send an appropriate MIME header
	$r->content_type("text/html");
	$r->send_http_header;
	# Send the output
	$r->print("<HTML><Head><Title>");
	$r->print("Testing, testing!");
	$r->print("</Title></Head>");
	$r->print("<Body>");
	$r->print("<H1>Testing, testing!</H1>");
	$r->print("</Body></HTML>");
	# Now send a response code
	return OK;
}
1;