X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=4f85d247c162dc7a83a7734091f74e70a9eaae79;hb=b7ce908fc5c404dcbc480c7ecf9a275b92fcc26f;hp=46e0df61bba40d9c1e9f700f1eaa9c6f1a1aeccb;hpb=3e22baa5ca02859b9180a0ec17d49fd204f5ba37;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 46e0df6..4f85d24 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -10,7 +10,7 @@ use URI::QueryParam; __PACKAGE__->mk_accessors( qw/action address arguments cookies headers match method - protocol query_parameters secure snippets uri user/ + protocol query_parameters secure captures uri user/ ); *args = \&arguments; @@ -19,6 +19,7 @@ __PACKAGE__->mk_accessors( *params = \¶meters; *query_params = \&query_parameters; *path_info = \&path; +*snippets = \&captures; sub content_encoding { shift->headers->content_encoding(@_) } sub content_length { shift->headers->content_length(@_) } @@ -61,7 +62,7 @@ Catalyst::Request - provides information about the current client request $req->read; $req->referer; $req->secure; - $req->snippets; + $req->captures; # previously knows as snippets $req->upload; $req->uploads; $req->uri; @@ -407,11 +408,16 @@ Shortcut for $req->headers->referer. Returns the referring page. Returns true or false, indicating whether the connection is secure (https). -=head2 $req->snippets +=head2 $req->captures + +Returns a reference to an array containing regex captures. -Returns a reference to an array containing regex snippets. + my @captures = @{ $c->request->captures }; + +=head2 $req->snippets - my @snippets = @{ $c->request->snippets }; +C used to be called snippets. This is still available for backwoards +compatibility, but is considered deprecated. =head2 $req->upload @@ -494,8 +500,9 @@ Returns a URI object for the current request. Stringifies to the URI text. =head2 $req->uri_with( { key => 'value' } ); -Returns a rewriten URI object for the current uri. Key/value pairs passed in -will override existing parameters. Unmodified pairs will be preserved. +Returns a rewritten URI object for the current request. Key/value pairs +passed in will override existing parameters. Unmodified pairs will be +preserved. =cut @@ -509,7 +516,7 @@ sub uri_with { if( $isa_ref and $isa_ref ne 'ARRAY' ) { croak( "Non-array reference ($isa_ref) passed to uri_with()" ); } - utf8::encode( $_ ) for $isa_ref ? @$value : $value; + utf8::encode( $_ ) for grep{ defined } $isa_ref ? @$value : $value; }; my $uri = $self->uri->clone;