3
Perl的HTTP POST請求我需要發送與下列HTTP頭的HTTP POST請求:與內容類型和授權令牌
Content-type: 'application/atom+xml'
Authorization: MyLogin auth=$token
的令牌從一個授權子例程來。這裏是Perl在進行實際請求後,子程序是成功的:在運行時
my $ua = LWP::UserAgent->new;
my $req = $ua->post ($url);
$req = header('Content-type' => 'application/atom+xml');
$req = header('Authorization' => "MyLogin auth=$token");
不過,我收到以下錯誤:
Undefined subroutine &main::header called ...
我怎樣才能做到這一點?