Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: lib/Catalyst/Request.pm
- ===================================================================
- --- lib/Catalyst/Request.pm (revision 10738)
- +++ lib/Catalyst/Request.pm (working copy)
- @@ -571,6 +571,34 @@
- Returns a URI object for the current request. Stringifies to the URI text.
- +=head2 $req->uri_append( { key => 'value' } );
- +
- +Returns a rewritten URI object for the current request. Key/value pairs
- +passed in will be appended to existing parameters. You can remove an existing
- +parameter by passing in an undef value. Unmodified pairs will be preserved.
- +
- +Compare this to C<uri_with> which replaces existing parameters.
- +
- +=cut
- +
- +sub uri_append {
- + my ($self, $args) = @_;
- +
- + carp('No arguments passed to uri_append()') unless $args;
- +
- + my $uri = $self->uri->clone;
- + foreach my $key (keys %{ $args }) {
- + my $val = $args->{$key};
- + if(defined($val)) {
- + $uri->query_param_append($key, $val);
- + } else {
- + $uri->query_param_delete($key);
- + }
- + }
- +
- + return $uri;
- +}
- +
- =head2 $req->uri_with( { key => 'value' } );
- Returns a rewritten URI object for the current request. Key/value pairs
- @@ -578,6 +606,8 @@
- parameter by passing in an undef value. Unmodified pairs will be
- preserved.
- +Compare this to C<uri_append> which appends to existing parameters.
- +
- =cut
- sub uri_with {
Add Comment
Please, Sign In to add comment