in reply to LWP : Post Problem

Still the problem continues. When I tries to update like this its working fine.

use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use URI::Heuristic; use HTTP::Request::Common; $ua = LWP::UserAgent->new; my $res = $ua->request(POST $url, Content_Type=>'form-data', Content =>[ettablenr => '2',etcell2x1=>'Task',etcell2x2=>'1',etcell2 +x3=>'2',etcell2x4=>'3',etcell2x5=>'High',etcell2x6=>'CSS',etcell2x7=> +'CCCC',etcell2x8=>'Twiki Updation',etcell3x1=>'Task',etcell3x2=>'4',e +tcell3x3=>'5',etcell3x4=>'6',etcell3x5=>'High',etcell3x6=>'DSS',etcel +l3x7=>'DDDD',etcell3x8=>'Twiki CSV',etrows=>'3',etsave=>'Save table'] +);

When I tries to put the Values into a Variable and then its was not working

$postStr ="ettablenr => '2',etcell2x1=>'Task',etcell2x2=>'1',etcell2x3=>'2',etcell2x4=>'3', +etcell2x5=>'High',etcell2x6=>'CSS',etcell2x7=>'CCCC',etcell2x8=>'Twik +i Updation',etcell3x1=>'Task',etcell3x2=>'4',etcell3x3=>'5',etcell3x4 +=>'6',etcell3x5=>'High',etcell3x6=>'DSS',etcell3x7=>'DDDD',etcell3x8= +>'Twiki CSV',etrows=>'3',etsave=>'Save table'"; $ua = LWP::UserAgent->new; my $res = $ua->request(POST $url, Content_Type=>'form-data', Content =>[$postStr]);


Can u pls let me know what happening when i am trying to update with a String

Replies are listed 'Best First'.
Re^2: LWP : Post Problem
by borisz (Canon) on Sep 01, 2004 at 10:00 UTC
    The problem is that in the first example your Content is a reference to a array with all your content values.
    But in the second example your content is a reference to a array with only _ONE_ entry. anoteher way is to put your content data into a array or hash. Here is a example with a hash:
    my %data = ( ettablenr => '2', etcell2x1 => 'Task', etcell2x2 => '1', etcell2x3 => '2', etcell2x4 => '3', etcell2x5 => 'High', etcell2x6 => 'CSS', etcell2x7 => 'CCCC', etcell2x8 => 'Twiki Updation', etcell3x1 => 'Task', etcell3x2 => '4', etcell3x3 => '5', etcell3x4 => '6', etcell3x5 => 'High', etcell3x6 => 'DSS', etcell3x7 => 'DDDD', etcell3x8 => 'Twiki CSV', etrows => '3', etsave => 'Save table' ); # you change something with $data{etrows} = 4; my $res = $ua->request(POST $url, Content_Type=>'form-data', Content =>[ %data ] );
    Boris