X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=dfec6d09380b57157305c7b9c96d75ad2530f5fe;hp=e134fbebc0eea2e625f9cc20aaee79cdac115011;hb=e5ecd5bc38bac3e2fcfaf643ea2a4c6ab46d7e57;hpb=7fa2c9c1b85c98786655ad5169708d8dc84e8353 diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index e134fbe..dfec6d0 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -23,7 +23,7 @@ has captures => (is => 'rw', default => sub { [] }); has uri => (is => 'rw'); has user => (is => 'rw'); has headers => ( - is => 'rw', + is => 'rw', isa => 'HTTP::Headers', handles => [qw(content_encoding content_length content_type header referer user_agent)], ); @@ -68,7 +68,7 @@ before parameters => sub { my ($self, $params) = @_; $self->_context->prepare_body(); if ( $params && !ref $params ) { - $self->_context->log->warn( + $self->_context->log->warn( "Attempt to retrieve '$params' with req->params(), " . "you probably meant to call req->param('$params')" ); $params = undef; @@ -223,7 +223,7 @@ be either a scalar or an arrayref containing scalars. print $c->request->body_parameters->{field}->[0]; These are the parameters from the POST part of the request, if any. - + =head2 $req->body_params Shortcut for body_parameters. @@ -290,7 +290,7 @@ Returns an L object containing the headers for the current reques =head2 $req->hostname Returns the hostname of the client. - + =head2 $req->input Alias for $req->body. @@ -301,7 +301,7 @@ Contains the keywords portion of a query string, when no '=' signs are present. http://localhost/path?some+keywords - + $c->request->query_keywords will contain 'some keywords' =head2 $req->match @@ -316,7 +316,7 @@ Contains the request method (C, C, C, etc). =head2 $req->param -Returns GET and POST parameters with a CGI.pm-compatible param method. This +Returns GET and POST parameters with a CGI.pm-compatible param method. This is an alternative method for accessing parameters in $c->req->parameters. $value = $c->request->param( 'foo' ); @@ -425,7 +425,7 @@ be either a scalar or an arrayref containing scalars. print $c->request->query_parameters->{field}; print $c->request->query_parameters->{field}->[0]; - + =head2 $req->read( [$maxlength] ) Reads a chunk of data from the request body. This method is intended to be @@ -518,7 +518,7 @@ sub upload { =head2 $req->uploads Returns a reference to a hash containing uploads. Values can be either a -L object, or an arrayref of +L object, or an arrayref of L objects. my $upload = $c->request->uploads->{field}; @@ -538,7 +538,7 @@ preserved. sub uri_with { my( $self, $args ) = @_; - + carp( 'No arguments passed to uri_with()' ) unless $args; for my $value ( values %$args ) { @@ -548,9 +548,9 @@ sub uri_with { utf8::encode( $_ ) if utf8::is_utf8($_); } }; - + my $uri = $self->uri->clone; - + $uri->query_form( { %{ $uri->query_form_hash }, %$args @@ -585,4 +585,6 @@ it under the same terms as Perl itself. =cut +__PACKAGE__->meta->make_immutable; + 1;