#
# Apache::Request Buffer Module
#
package iXML::Buffer::Apache;
use strict;
use Apache;
use Apache::Request;
use Apache::Debug;
use CGI::Carp qw(fatalsToBrowser);
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {
'r' => Apache->request,
'html' => undef,
'redir' => undef,
};
bless($self, $class);
$self->{apr} = Apache::Request->new(
$self->{r},
);
return $self;
}
sub html {
my ($self, $html) = @_;
$self->{html} = $html;
}
sub redir {
my ($self, $redir) = @_;
$self->{redir} = $redir;
}
sub output {
my $self = shift;
if ($self->{redir}) {
$self->{apr}->status(302);
$self->{apr}->header_out('Location', $self->{redir});
$self->{apr}->send_http_header('text/html');
$self->{apr}->print($self->{html});
}else{
$self->{apr}->send_http_header('text/html');
$self->{apr}->print($self->{html});
}
}
sub param {
my ($self) = shift;
return $self->{apr}->param;
}
sub debug {
my ($self) = shift;
Apache::Debug::dump($self->{r}, 'SERVER RESPONSE');
}
1;
####
#
# Code that calls the buffer and requests params;
#
use strict;
use iXML::Buffer::Apache;
$Buffer = iXML::Buffer::Apache->new();
$Params = $Buffer->param;
####
#
# Sample form code (my script uses HTML::Template
# but I filled in the stuff that counts.
#