[Dancer-users] documentation for forward method
Naveed Massjouni
naveedm9 at gmail.com
Sat May 26 22:48:59 CEST 2012
On Sat, May 26, 2012 at 4:44 PM, GJ <gj at freeshell.org> wrote:
> Hi all,
>
> I am having trouble with the documentation for "forward" as found at:
>
> If you go to http://search.cpan.org/dist/Dancer/lib/Dancer.pm#forward
>
> In the first place, I am finding that the statement "forward doesn't
> parse GET arguments" seems to be untrue.
>
> presuming an HTTP request like:
>
> 'http://localhost/foo?quux=blah'
>
> and some routes like:
>
> ----
> get '/foo' => sub {
> return forward "/bar", { err => "from foo" };
> };
>
> get '/bar' => sub {
> my $f = param "quux";
> return $f;
> };
> ----
>
> Dancer *will* return "blah", which on my interpretation of the documentation
> should not be possible.
>
> Secondly and more importantly from my perspective, the documentation does not
> explain explicitly how to get at my optional parameters once in /bar (the '{
> err => "from foo" }' bit.)
>
> It's not an element of @_. Eventually, I figured out that I can use
> 'request->params->{err}', but this is not explicitly stated, and possibly not the
You can access that simply via param 'err'. The params in the hash
that you pass to forward are treated as http params.
-Naveed
> intended way to do it.
>
> I'm on 1.3095.
>
> Thanks
> GJ
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
More information about the Dancer-users
mailing list