为什么 Catalyst::Controller::WrapCGI 没有得到任何 post 数据?

How come Catalyst::Controller::WrapCGI doesn't get any post data?

每当我 POST 到带有 Catalyst::Controller::WrapCGI 的页面时,我注意到我的旧 CGI 脚本没有获得任何 POST 数据。HTTP 请求正文中的数据.我做错了什么,我该如何解决?

就我而言,这是因为我使用的是 Catalyst::Controller::WrapCGI v0.35 and Catalyst::Controller::REST。这造成了一个问题。我的配置是这样的,

package MyApp::Controller::REST;
__PACKAGE__->config(namespace => '');
BEGIN { extends 'Catalyst::Controller::REST' }

package MyApp::Controller::Root;
__PACKAGE__->config(namespace => '');
BEGIN { extends 'Catalyst::Controller::WrapCGI' }

但是,Catalyst::Controller::REST 安装 begin action on line 298

sub begin : ActionClass('Deserialize') { }

而且,就我而言,是委托给 Catalyst::Action::Deserialize::JSON which is smart enough to seek($body,0,0) but too dumb and inconsiderate to do that for the next guy down the chain.... Code below from here

if(openhandle $body) {
    seek($body, 0, 0); # in case something has already read from it
    while ( defined( my $line = <$body> ) ) {
        $rbody .= $line;
    }
}

而且,更糟糕的是,在这个例子中,链下的下一个人是 Catalyst::Controller::WrapCGI,它不仅无法为下一个人清理,而且无法为自己设置 (code from here),

if ($body) { # Slurp from body filehandle
  local $/; $body_content = <$body>;
}

应该看起来像(至少)

if ($body) { # Slurp from body filehandle
  local $/;
  seek($body,0,0);
  $body_content = <$body>;
}

这就是为什么我们不能拥有美好的东西...I opened a bug in C:C:WrapCGI to get this resolved.