Plack::Middleware::PathToQuery - Prepend converted PATH_INFO to QUERY_STRING
version v0.0.1
use Plack::Bulder; use Plack::Middleware::PathTuQuery; my $app = sub { ... }; builder { enable 'PathToQuery', 'debug' => 1; $app; };
Plack::Midleware::PathToQuery is a Plack middleware to prepend converted PATH_INFO to QUERY_STRING. The conversion rule is as follows:
Initial '/' character is stripped if exists.
'/' is converted to '&'.
The first '-' for each path component is converted to '='.
If '-' does not appear in a path component, '=' is appended.
Thus,
/key1-value1/key2/key3-value3-value4
is converted to
key1=value&key2=&key3=value3-value4
The converted string is prepended to QUERY_STRING. If QUERY_STRING is not empty, '&' is inserted between them. After the process of this middleware, PATH_INFO becomes empty.
If debug => 1 is specifed as argument, PATH_INFO/QUERY_STRING before/after the conversion are shown.
debug => 1
Yasutaka ATARASHI <yakex@cpan.org>
This software is copyright (c) 2013 by Yasutaka ATARASHI.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Plack::Middleware::PathToQuery, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::PathToQuery
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::PathToQuery
For more information on module installation, please visit the detailed CPAN module installation guide.