X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=b712e479ad4cf00c658d90618f14384da5650d5a;hb=87f504360777193d96945014faa1d058224fcb0e;hp=6d14c5bf21dc9b03366c89bc10aa4993ffd5ba9b;hpb=58889ece5ffe267a42384e206168edf52cceaa07;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 6d14c5b..b712e47 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -14,6 +14,17 @@ use namespace::clean -except => 'meta'; with 'MooseX::Emulate::Class::Accessor::Fast'; +has env => (is => 'ro', writer => '_set_env'); + +has _read_position => ( is => 'rw', default => 0 ); +has _read_length => ( is => 'ro', + default => sub { + my $self = shift; + $self->header('Content-Length') || 0; + }, + lazy => 1, +); + has action => (is => 'rw'); has address => (is => 'rw'); has arguments => (is => 'rw', default => sub { [] }); @@ -39,10 +50,15 @@ has headers => ( has _context => ( is => 'rw', weak_ref => 1, - handles => ['read'], + handles => ['read'], # XXX FIXME! clearer => '_clear_context', ); +sub read_chunk { + my $self = shift; + return $self->env->{'psgi.input'}->read(@_); +} + has body_parameters => ( is => 'rw', required => 1, @@ -480,6 +496,10 @@ Reads a chunk of data from the request body. This method is intended to be used in a while loop, reading $maxlength bytes on every call. $maxlength defaults to the size of the request if not specified. +=head2 $req->read_chunk(\$buff, $max) + +Reads a chunk.. + You have to set MyApp->config(parse_on_demand => 1) to use this directly. =head2 $req->referer