[Catalyst] On Subrequests and XSLT

dorian taylor dorian.taylor.lists at gmail.com
Sat Mar 3 04:25:18 GMT 2012


I'm working on an alternative to Catalyst::View::XSLT which does
things like find the xml-stylesheet processing instruction, as well as
connect XML::LibXML's input callbacks to Catalyst's dispatcher. That
means I need to do subrequests.

I began earlier today using Catalyst::Plugin::SubRequest and it worked
fine under the development server, but I got a nasty surprise when I
tried to deploy, when I found that it simply won't work under mod_perl
or FastCGI. I suspect it hooks the underlying engines' I/O because at
least under mod_perl I get nothing until I HUP Apache.

I decided to look at RT and found this:
https://rt.cpan.org/Public/Bug/Display.html?id=57544 — a suggestion to
deprecate the module in favour of using $c->visit by ~perler. I went
and found the module he was talking about in his bug report that uses
$c->visit, found at
, which looks like this:

            local $c->{response} = $c->response_class->new({});
            local $c->{stash} = {};
            local $c->{request} = $c->req;
            local $c->{error} = undef;

            my %req = $route->request($req);
            $c->req($c->request_class->new(%{$c->req}, %req));
            eval {
                $c->visit($route->build_url( $req->{data} ));
                my $response = $c->res;


Now, it's clever and all but what concerns me is that I suspect
there's an in-interface way to do the same thing as those local
declarations by generating a new $c. Only thing is I don't know how
that's done.



Dorian Taylor

More information about the Catalyst mailing list