S
still me
I am using LWP to do a POST. I need some help automating the passing
of parameters and getting the object reference to work.
Here's the (hard coded) version that works fine;
my $response = $browser->post( $url,['test1'=>'001', 'test2' => 'it
works']);
What I'd like to do is to set up an array (or hash) with the parameter
names and values so that I can change the parameters to be passed as
simply by altering the hash names/values. Then I'd just generate the
passed parameter string for as many values as are in the array.
Here's a hardcoded sample (no array for simplicity) that I tried as a
test just to figure out how to get the parameters passed:
my $param1 = "'test1'=>'001',";
my $param2 = "'test2'=>'002'";
my $response = $browser->post( $url,[$param1, $param2]);
But, it didn't pass the parameters. I assume that's because I
destroyed the object reference by doing what I did, but I don't
understand Perl objects and variable translation enough to know how to
construct a working object reference.
Thanks for any help,
of parameters and getting the object reference to work.
Here's the (hard coded) version that works fine;
my $response = $browser->post( $url,['test1'=>'001', 'test2' => 'it
works']);
What I'd like to do is to set up an array (or hash) with the parameter
names and values so that I can change the parameters to be passed as
simply by altering the hash names/values. Then I'd just generate the
passed parameter string for as many values as are in the array.
Here's a hardcoded sample (no array for simplicity) that I tried as a
test just to figure out how to get the parameters passed:
my $param1 = "'test1'=>'001',";
my $param2 = "'test2'=>'002'";
my $response = $browser->post( $url,[$param1, $param2]);
But, it didn't pass the parameters. I assume that's because I
destroyed the object reference by doing what I did, but I don't
understand Perl objects and variable translation enough to know how to
construct a working object reference.
Thanks for any help,