The LWP::UserAgent
page tells you how to do this. You would set the handler request_prepare
on the user agent object. That will pass you in the request object before it posts.
Actually, anything you put as a list of key-value pairs before the key 'Content'
followed by the structure that you want to post, will translate into headers, per HTTP::Request::Common::POST
$ua->post( $URL, keep_alive => 1, Content => ['parm1'=>'val1']);
Or without the content tag, if you put the structure first, you can put header key-value pairs after:
$ua->post( $URL, ['parm1'=>'val1'], keep_alive => 1 );