[Catalyst] C::P::SubRequest and $c->request->param

John Napiorkowski jjn1056 at yahoo.com
Mon Nov 20 16:40:11 GMT 2006


--- Renaud <renaud at linuxaddicts.com> wrote:

> Hello,
> 
> I am not sure whether this is a normal behaviour or
> a bug, but this is
> what I experienced using the SubRequest plugin:
> (everything's up to date)
> 
> sub bleh : Local {
> 
>     my ($self, $c) = @_;
> 
>     my $body = "Before subreq, foo == " .
> $c->req->param('foo');
>     $c->subreq('/index');
>     $body .= "\nAfter subreq, foo == " .
> $c->req->param('foo');
>     $c->res->body($body);
> 
> }
> 
> sub index : Private {
>     my ($self, $c) = @_;
>     $c->res->body("index");
> }
> 
> 
> When calling http://localhost:3000/bleh?foo=foo,
> this will output:
> 
> Before subreq, foo == foo
> After subreq, foo ==
> 
> Is this normal that SubRequest destroys the original
> parameters, am I
> doing something wrong?
> 
> Regards,
> Renaud

Hi,

I've also had this (and other) problems with the
current SubRequest plugin.  There is an update to
SubRequest in the Catalyst repository which is
supposed to be a lot better.  You might want to give
it a try.  I tried it out a month or so ago and got
some strange errors that I couldn't understand well
enough to contribute meaningfully.

The only hack around this I found is to use LWP to
create a full new request.  This will give you a
totally isolated request (and incidentally performs
pretty well if you are on a multicpu box) but of
course you'd have to add in any cgi params or post
bodies manually.  Also if you have authentication on
the server you'll need to handle that as well.

--john
> 
> 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



 
____________________________________________________________________________________
Sponsored Link

Degrees online in as fast as 1 Yr
MBA, Bachelor's, Master's, Assoc
http://yahoo.degrees.info



More information about the Catalyst mailing list