0
我使用REST ::客户端创建一个POST请求,并不断收到以下错误:POST请求::客户
回应:不是在一个标量引用/ nethome/perl5的/ lib目录/ perl5的// LWP /协议/ http.pm线254,< IFH>线1.
我的代码片断:
use warnings;
use diagnostics;
use strict;
use JSON::MaybeXS;
use REST::Client;
my $host = 'myurl';
my $hashref = {};
my $jsonEncode=JSON::MaybeXS->new->utf8(1)->pretty(1);
里面一个子程序,使用while循环
my @fields=split("\t",$_);
my $sample_id=$fields[0];
my $chr=$fields[1];
my $position=$fields[2];
my $alt=$fields[5];
my $hashref =("variant_request"=>{"searchParameters"=>{"sampleIds"=> ["$sample_id"],"genome"=>[{"loci"=>{"chromosome"=>"$chr","position"=>$position,"allele"=>"$alt"}}]}});
push (@meta,\%hashref);
printQuery (@meta,$encoded);
内PrintQuery子程序:
my $filename =$_[1];
my $hash = $jsonEncode->canonical->encode($_[0]);
$client->POST($hash,{'Content-Type'=>'application/json','Accept'=>'application/json'});
print 'Response:'.$client->responseContent()."\n";
print 'Response Status:'. $client->responseCode()."\n";
输入:
601 1 114872280 rs544699256 A G