package My::Chain;

use strict;
use Apache::Constants 'OK';

sub handler {
    my $r = shift;
    for my $cv (\&header, \&body, \&footer) {
	$r->push_handlers(PerlHandler => $cv);
    }
    OK;
}

sub header {
    my $r = shift;
    $r->content_type('text/plain');
    $r->send_http_header;
    $r->print("header text\n");
    OK;
}

sub body {
    my $r = shift;
    $r->print("body text\n");
    OK;
}

sub footer {
    my $r = shift;
    $r->print("footer text\n");
    OK;
}

1;
__END__
