Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 将带有第一个请求的html页面返回到在端口5000本地运行的Json Rpc Dispatcher服务器_Perl_Rpc_Json Rpc_Plack - Fatal编程技术网

Perl 将带有第一个请求的html页面返回到在端口5000本地运行的Json Rpc Dispatcher服务器

Perl 将带有第一个请求的html页面返回到在端口5000本地运行的Json Rpc Dispatcher服务器,perl,rpc,json-rpc,plack,Perl,Rpc,Json Rpc,Plack,我有Json Rpc Dispatcher服务器在我的本地主机上运行,端口为5000,我需要在访问时获得一个html索引页 http://localhost:5000 这是app.psgi 使用JSON::RPC::Dispatcher my $rpc = JSON::RPC::Dispatcher->new; $rpc->register( 'ping', sub { return 'pong' } ); $rpc->register( 'echo', sub { ret

我有Json Rpc Dispatcher服务器在我的本地主机上运行,端口为5000,我需要在访问时获得一个html索引页

http://localhost:5000
这是app.psgi 使用JSON::RPC::Dispatcher

my $rpc = JSON::RPC::Dispatcher->new;

$rpc->register( 'ping', sub { return 'pong' } );
$rpc->register( 'echo', sub { return $_[0] } );

sub add_em {
  my @params = @_;
  my $sum = 0;
  $sum += $_ for @params;
  return $sum;
}

$rpc->register( 'sum', \&add_em );

# Want to do some fancy error handling? 
sub guess {
  my ($guess) = @_;
  if ($guess == 10) {
    return 'Correct!';
  }
  elsif ($guess > 10) {
    die [ 986, 'Too high.', $guess];
  }
  else {
    die [ 987, 'Too low.', $guess ];
  }
}
$rpc->register( 'guess', \&guess );
目前,它只返回带有GET guess或sum方法请求的json

我需要有一个GET请求,它将返回一个html页面,并加载一些Javascript,可能还有根请求

http://localhost:5000/ 
根据报告:

在进行rpc调用时,服务器必须以响应进行响应,除非是在通知的情况下响应表示为单个JSON对象


因此,从JSON::RPC服务器获取html页面是不可能的。

好的,我会想办法解决这个问题。