[Catalyst-commits] r6612 - in trunk/Catalyst-Runtime: .
lib/Catalyst t
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Fri Aug 3 02:53:17 GMT 2007
Author: andyg
Date: 2007-08-03 02:53:17 +0100 (Fri, 03 Aug 2007)
New Revision: 6612
Modified:
trunk/Catalyst-Runtime/Changes
trunk/Catalyst-Runtime/lib/Catalyst/Engine.pm
trunk/Catalyst-Runtime/lib/Catalyst/Request.pm
trunk/Catalyst-Runtime/t/live_engine_request_parameters.t
Log:
Added req->query_keywords method
Modified: trunk/Catalyst-Runtime/Changes
===================================================================
--- trunk/Catalyst-Runtime/Changes 2007-08-03 01:37:35 UTC (rev 6611)
+++ trunk/Catalyst-Runtime/Changes 2007-08-03 01:53:17 UTC (rev 6612)
@@ -1,18 +1,20 @@
This file documents the revision history for Perl extension Catalyst.
5.7008
- - Add undef warning for uri_for
- - Fix bug where a nested component would be setup twice
- - Make ensure_class_loaded behave better with malformed class name
- - Make _register_plugin use ensure_class_loaded
- - Remove 'Argument "??" isn't numeric in sprintf' warning
+ - Added $c->request->query_keywords for getting the keywords
+ (a query string with no parameters).
+ - Add undef warning for uri_for.
+ - Fix bug where a nested component would be setup twice.
+ - Make ensure_class_loaded behave better with malformed class name.
+ - Make _register_plugin use ensure_class_loaded.
+ - Remove 'Argument "??" isn't numeric in sprintf' warning.
(Emanuele Zeppieri)
- Fixed a bug where Content-Length could be set to 0 if a filehandle
object in $c->response->body did not report a size.
- Fixed issue where development server running in fork mode did not
properly exit after a write error.
(http://rt.cpan.org/Ticket/Display.html?id=27135)
- - Remove warning for captures that are undef
+ - Remove warning for captures that are undef.
5.7007 2007-03-13 14:18:00
- Many performance improvements by not using URI.pm:
Modified: trunk/Catalyst-Runtime/lib/Catalyst/Engine.pm
===================================================================
--- trunk/Catalyst-Runtime/lib/Catalyst/Engine.pm 2007-08-03 01:37:35 UTC (rev 6611)
+++ trunk/Catalyst-Runtime/lib/Catalyst/Engine.pm 2007-08-03 01:53:17 UTC (rev 6612)
@@ -447,8 +447,10 @@
sub prepare_query_parameters {
my ( $self, $c, $query_string ) = @_;
- # Make sure query has params
+ # Check for keywords (no = signs)
+ # (yes, index() is faster than a regex :))
if ( index( $query_string, '=' ) < 0 ) {
+ $c->request->query_keywords( $self->unescape_uri($query_string) );
return;
}
Modified: trunk/Catalyst-Runtime/lib/Catalyst/Request.pm
===================================================================
--- trunk/Catalyst-Runtime/lib/Catalyst/Request.pm 2007-08-03 01:37:35 UTC (rev 6611)
+++ trunk/Catalyst-Runtime/lib/Catalyst/Request.pm 2007-08-03 01:53:17 UTC (rev 6612)
@@ -9,7 +9,7 @@
use URI::QueryParam;
__PACKAGE__->mk_accessors(
- qw/action address arguments cookies headers match method
+ qw/action address arguments cookies headers query_keywords match method
protocol query_parameters secure captures uri user/
);
@@ -51,6 +51,7 @@
$req->headers;
$req->hostname;
$req->input;
+ $req->query_keywords;
$req->match;
$req->method;
$req->param;
@@ -259,6 +260,15 @@
Alias for $req->body.
+=head2 $req->query_keywords
+
+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
This contains the matching part of a Regex action. Otherwise
Modified: trunk/Catalyst-Runtime/t/live_engine_request_parameters.t
===================================================================
--- trunk/Catalyst-Runtime/t/live_engine_request_parameters.t 2007-08-03 01:37:35 UTC (rev 6611)
+++ trunk/Catalyst-Runtime/t/live_engine_request_parameters.t 2007-08-03 01:53:17 UTC (rev 6612)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 29;
+use Test::More tests => 30;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -103,14 +103,15 @@
};
my $request = POST(
- 'http://localhost/dump/request/a/b?query_string',
+ 'http://localhost/dump/request/a/b?query+string',
'Content' => $parameters,
'Content-Type' => 'application/x-www-form-urlencoded'
);
ok( my $response = request($request), 'Request' );
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
- is( $creq->{uri}->query, 'query_string', 'Catalyst::Request POST query_string' );
+ is( $creq->{uri}->query, 'query+string', 'Catalyst::Request POST query_string' );
+ is( $creq->query_keywords, 'query string', 'Catalyst::Request query_keywords' );
is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' );
ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' );
More information about the Catalyst-commits
mailing list