Thanks much, Gisle!
I now have some weird issue.
>
> If you use the HTTP::Request::Common module it will take care of the
> escaping for you.
>
> use HTTP::Request::Common qw(POST);
>
> my $reqq = POST('http://bla.foo/sbin/halt',
> [ a => "b",
> c => $d,
> e => "f",
> ]);
> print $reqq->as_string; #DEBUG
>
This produces a very different result from the following.
---------------------------
use HTTP::Request::Common qw(POST);
$d='&';
%A=(a,b,c,$d,e,f,location,test);
my $reqq = POST('http://bla.foo/sbin/halt',%A);
print $reqq->as_string; #DEBUG
-----------------------------
1. I had thought that what is in your example was
just a hash and thus my code. The reason I would like
to store form data in a hash is that there are checkboxes
and I won't *usually* be passing most of the values.
2. location is one of the name of the forms and it seems that
'location' is being treated in a special way. I suspect
that because location is put right at the top whereas
others are sorted alphabetically at the bottom.
3. The first letter of the names are being capitalized and
I wonder if that's causing my problem. I'm getting
method not implemented server error. It's a IIS server.
Ocassionally I would also get a script error saying
some values are not appropriate.
Thanks. Below are the outputs
Output of your example with a 'location' added
---------------------------
POST http://bla.foo/sbin/halt
Content-Length: 24
Content-Type: application/x-www-form-urlencoded
a=b&c=&e=f&location=test
------------------
Output of modified version with %A
--------------
POST http://bla.foo/sbin/halt
Location: test
Content-Type: application/x-www-form-urlencoded
A: b
C: &
E: f
----------------------
Notice the capitalization
-