Started refactoring output
This commit is contained in:
parent
a866fd10f0
commit
191d4fc401
2 changed files with 12 additions and 20 deletions
1
TODO
1
TODO
|
|
@ -1,6 +1,7 @@
|
||||||
TODO
|
TODO
|
||||||
* Deprecate WebGUI::Session::HTTP - replace with WebGUI::Request/Response
|
* Deprecate WebGUI::Session::HTTP - replace with WebGUI::Request/Response
|
||||||
* Turn logger into $self->request->env->{'psgi.errors'}->print(join '', @stuff);
|
* Turn logger into $self->request->env->{'psgi.errors'}->print(join '', @stuff);
|
||||||
|
* Remove WebGUI::Session::Output
|
||||||
|
|
||||||
DONE
|
DONE
|
||||||
* $session->request is now a Plack::Request object
|
* $session->request is now a Plack::Request object
|
||||||
|
|
|
||||||
|
|
@ -90,27 +90,18 @@ sub print {
|
||||||
my $content = shift;
|
my $content = shift;
|
||||||
my $skipMacros = shift || !($self->session->http->getMimeType =~ /^text/);
|
my $skipMacros = shift || !($self->session->http->getMimeType =~ /^text/);
|
||||||
WebGUI::Macro::process($self->session, \$content) unless $skipMacros;
|
WebGUI::Macro::process($self->session, \$content) unless $skipMacros;
|
||||||
my $handle = $self->{_handle};
|
|
||||||
if (defined $handle) {
|
# Initialise response body if it's empty
|
||||||
print $handle $content;
|
$self->session->response->body([]) if !$self->session->response->body;
|
||||||
}
|
|
||||||
elsif ($self->session->request) {
|
my $body = $self->session->response->body;
|
||||||
# TODO - put in IO bound delayed response
|
if (ref $body ne 'ARRAY') {
|
||||||
$self->session->response->body( $self->session->response->body() . $content );
|
Carp::carp("Response body is not an ARRAY, it's a " . ref $body);
|
||||||
# if (ref $self->session->request->body eq 'ARRAY') {
|
return;
|
||||||
# push @{$self->session->request->body}, $content;
|
|
||||||
# } else {
|
|
||||||
# if ($self->session->request->logger) {
|
|
||||||
# $self->session->request->logger->({ level => 'warn', message => "dropping content: $content" });
|
|
||||||
# } else {
|
|
||||||
# warn "dropping content";#: $content";
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# $self->session->request->print($content);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print $content;
|
|
||||||
}
|
}
|
||||||
|
push @{ $body }, $content;
|
||||||
|
|
||||||
|
# TODO - put in IO bound delayed response
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue