我正在尝试转换使用REST调用PHP的Perl脚本。我在下面的代码中遇到2行问题。
my $url = 'https://awebsite.com/apilink';
my $oauthurl = $url.'?'.$xoauth.'='.$oauthmail;
my $client = REST::Client->new();
my %retval = ();
my $request = Net::OAuth->request('consumer')->new(
consumer_key => $oauthkey,
consumer_secret => $oauthsec,
request_url => $url,
request_method => 'GET',
signature_method => $oauthsig,
timestamp => time,
nonce => nonce(),
extra_params => {
$xoauth => $oauthmail
}
);
$request->sign;
$client->addHeader('Content-type' => 'application/json');
$client->addHeader('Authorization' => $request->to_authorization_header);
$client->addHeader('Accept-Encoding' => 'identity');
$client->GET( $oauthurl );
这些线条给我带来了麻烦。
extra_params => { $xoauth => $oauthmail }
$client->addHeader('Authorization' => $request->to_authorization_header);
我不确定如何处理与'extra_params'一起使用的HASH或标题创建中的解除引用。