[Catalyst] + in GET param

Gavin Henry ghenry at perl.me.uk
Wed Sep 12 11:07:31 GMT 2007


Tatsuhiko Miyagawa wrote:
> I tested but couldn't reproduce. So I wouldn't say this is a Cat bug.
> 
> % catalyst.pl TestApp
> % cd TestApp
> % vi lib/TestApp/Controller/Root.pm
> 
> sub default : Private {
>     my ( $self, $c ) = @_;
> 
>     # Hello World
>     $c->response->body("Hello " . ($c->req->param('username') || "(default)"));
> }
> 
> % ./script/testapp_server.pl
> 
> Access http://localhost:3000/?username=first.last%2Bme%40gmail.com
> 
> It prints out "Hello first.last+me at gmail.com".
> 
> [info] *** Request 1 (0.167/s) [1194] [Tue Sep 11 19:54:11 2007] ***
> [debug] Query Parameters are:
> .-------------------------------------+--------------------------------------.
> | Parameter                           | Value                                |
> +-------------------------------------+--------------------------------------+
> | username                            | first.last+me at gmail.com              |
> '-------------------------------------+--------------------------------------'
> [debug] "GET" request for "/" from "192.168.70.1"
> [info] Request took 0.068512s (14.596/s)
> .----------------------------------------------------------------+-----------.
> | Action                                                         | Time      |
> +----------------------------------------------------------------+-----------+
> | /default                                                       | 0.000100s |
> | /end                                                           | 0.000818s |
> '----------------------------------------------------------------+-----------'
> 
> Check Catalyst::Engine versions or whatever plugins you use that
> messes something with request parameters?
> 
> 

Very strange.

I've just put this in Root.pm

 85 sub param : Local {
 86     my ( $self, $c ) = @_;
 87
 88     # Hello World
 89     $c->response->body(
 90         "Hello " . ( $c->req->param('username') || "(default)" ) );
 91 }

and gone to:

http://suretec:3000/param/?username=first.last%2Bme%40gmail.com

And the same result as before:

Hello first.last me at gmail.com

[info] FTM powered by Catalyst 5.7010
You can connect to your server at http://suretec:3000
[info] *** Request 1 (0.143/s) [5885] [Wed Sep 12 11:05:15 2007] ***
[debug] Query Parameters are:
.---------------------------------+------------------------------.
| Parameter                           | Value                    |
+---------------------------------+------------------------------+
| username                            | first.last me at gmail.com  |
'---------------------------------+------------------------------'
[debug] "GET" request for "param/" from "127.0.0.1"
[debug] Path is "param"
[info] Request took 0.091166s (10.969/s)
.----------------------------------------------------+-----------.
| Action                                             | Time      |
+----------------------------------------------------+-----------+
| /begin                                             | 0.000203s |
| /param                                             | 0.000136s |
| /end                                               | 0.000285s |
'----------------------------------------------------+-----------'





More information about the Catalyst mailing list