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:

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.

Advertisements

still me wrote:
> 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]);

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!