package Apache::Hello2;
# Apache::hello2
use strict;
use Apache::Constants qw(:common);
 
sub handler {
    my $r = shift;
    my %params = $r->method eq 'POST' ? $r->content : $r->args;
    my $user_name = $params{'user_name'} || 'Unknown User';

    $r->content_type('text/html');
    $r->send_http_header;
    return OK if $r->header_only;
 
    $r->print(<<END);
<HTML>
<HEADER>
<TITLE>Hello There</TITLE>
</HEADER>
<BODY>
<H1>Hello $user_name</H1>
Who would take this book seriously if the seventh example didn\'t
say "hello $user_name"?
<HR>
<FORM METHOD="POST">
Enter your name: <INPUT TYPE="text" NAME="user_name" VALUE="$user_name">
<INPUT TYPE="submit" VALUE="Set Name">
</FORM>
</BODY>
</HTML>
END

    return OK;
}

1;
__END__
