スクリプトPOST
からリクエストを送信しようとするとエラーが発生します。perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->credentials($netloc,$realm,$username,$password);
use HTTP::Request::Common;
my $req = HTTP::Request::Common::POST($url,'content' => $conf);
$req->as_string()
は
POST http:.....
Content-Length: 31003
Content-Type: application/x-www-form-urlencoded
.....&createTime=1361370652541¶meters=HASH(0x28fd658)¶meters=HASH(0x28fd670)¶meters=HASH(0x28fd6e8)¶meters=HASH(0x28fd760)&nodes=32&.....&alerts=HASH(0x632d00)&alerts=HASH(0x245abd0)&.....
私が得るエラーは
Unexpected character ('H' (code 72)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
これは、問題が繰り返される要素にあるparameters=HASH(...)
と私に思わせ
ます。alerts=HASH(...)
代わりに私は次のようなものを見たい
alerts=%5B%7B%22email%22%3A%22foo%40bar.com%22%2C%22type%22%3A%221%22%2C%22timeout%22%3A%22%22%7D%5D
$conf
はハッシュ参照であり、$conf->{"parameters"} and
$ conf-> {"alerts"} `は配列参照です(その要素はハッシュ参照です)。
私は何が間違っているのですか?