Lwp Post Problem

S

Sure

Hello All,
I want to update a form using the LWP & HTTP method. It was
working fine when I am updating the values like this

$ua = LWP::UserAgent->new;
$url ='http://xxx.be/cgi-bin/viewauth/Tracking/TestProjectAgainInitialDevStory#edittable2';
use HTTP::Request::Common;

my $res = $ua->request(POST $url,
Content_Type =>'form-data',
Content => [
ettablenr => '2',
etcell2x1 =>'Task',
etcell2x2 =>'2',
etcell2x3 =>'3',
etcell2x4 =>'4',
etcell2x5 =>'High',
etcell2x6 =>'SureshC',
etcell2x7 =>'CSuresh',
etcell2x8 =>'Twiki Data Updation',
etrows => '2',
etsave =>'Save table']);


It was not working when I store the value into a Variable. Like This.

$postStr = ettablenr => '2', etcell2x1 =>'Task', etcell2x2 =>'2',
etcell2x3 =>'3', etcell2x4 =>'4', etcell2x5 =>'High', etcell2x6
=>'SureshC', etcell2x7 =>'CSuresh', etcell2x8 =>'Twiki Data
Updation', etrows => '2', etsave =>'Save table']);

$ua = LWP::UserAgent->new;
my $res = $ua->request(POST $url, Content_Type=>'form-data', Content
=>[$postStr]);

Can any one pls let me know what is the problem when i doing like
this.


Thanks in Advance
 
G

Gunnar Hjalmarsson

Sure said:
It was not working when I store the value into a Variable. Like
This.

$postStr = ettablenr => '2', etcell2x1 =>'Task', etcell2x2
=>'2', etcell2x3 =>'3', etcell2x4 =>'4', etcell2x5 =>'High',
etcell2x6 =>'SureshC', etcell2x7 =>'CSuresh', etcell2x8 =>'Twiki
Data Updation', etrows => '2', etsave =>'Save table']);

$ua = LWP::UserAgent->new;
my $res = $ua->request(POST $url, Content_Type=>'form-data',
Content =>[$postStr]);
------------^--------^

Assuming $postStr is an array reference:

my $postStr = [ ettablenr => '2', ... etsave =>'Save table' ];

this should work:

my $res = $ua->request(POST $url,
Content_Type =>'form-data',
Content => $postStr);
 
C

Charles DeRykus

Hello All,
I want to update a form using the LWP & HTTP method. It was
working fine when I am updating the values like this

$ua = LWP::UserAgent->new;
$url ='http://xxx.be/cgi-bin/viewauth/Tracking/TestProjectAgainInitialDevStory#edittable2';
use HTTP::Request::Common;

my $res = $ua->request(POST $url,
Content_Type =>'form-data',
Content => [
ettablenr => '2',
etcell2x1 =>'Task',
etcell2x2 =>'2',
etcell2x3 =>'3',
etcell2x4 =>'4',
etcell2x5 =>'High',
etcell2x6 =>'SureshC',
etcell2x7 =>'CSuresh',
etcell2x8 =>'Twiki Data Updation',
etrows => '2',
etsave =>'Save table']);


It was not working when I store the value into a Variable. Like This.

$postStr = ettablenr => '2', etcell2x1 =>'Task', etcell2x2 =>'2',
etcell2x3 =>'3', etcell2x4 =>'4', etcell2x5 =>'High', etcell2x6
=>'SureshC', etcell2x7 =>'CSuresh', etcell2x8 =>'Twiki Data
Updation', etrows => '2', etsave =>'Save table']);

The above statement won't compile...
$ua = LWP::UserAgent->new;
my $res = $ua->request(POST $url, Content_Type=>'form-data', Content
=>[$postStr]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top