我有一个CGI::Application
循环,如
while (my $q = new CGI::Fast){
S::W::Dispatch->dispatch(args_to_new => { QUERY => $q });
my $webapp = S::W::instance();
undef $CGI::Application::INSTANCE;
S::W::instance(undef);
S::clear_instance();
}
简而言之,我想把它作为一个新的催化剂发送......
所以我想做这样的事情
sub oldRoot :Local {
...
S::W::Dispatch->dispatch(args_to_new => { QUERY => $q });
}
所以我需要知道如何重建Catalyst中的$q
。这很容易吗?或者,我如何更轻松地实现这一目标?
答案 0 :(得分:2)
这实际上比我想象的容易得多。
只需让控制器扩展Catalyst::Controller::WrapCGI
,而不是Catalyst::Controller
BEGIN { extends 'Catalyst::Controller::WrapCGI' }
然后将这整件包裹起来..
$self->cgi_to_response($c, sub {
my $q = new CGI::Fast;
S::W::Dispatch->dispatch(args_to_new => { QUERY => $q });
my $webapp = S::W::instance();
undef $CGI::Application::INSTANCE;
S::W::instance(undef);
S::clear_instance();
} );
它刚刚起作用..