473,805 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use HTTP::Request:: Common Problem when Updating with String

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/TestProjectAgai nInitialDevStor y#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
Jul 19 '05 #1
1 5754
In article <ab************ **************@ posting.google. com>, Sure
<cs*******@yaho o.com> wrote:
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
Disclaimer: I have not used LWP, but I can see a possible problem with
your code.

$ua = LWP::UserAgent->new;
$url
='http://xxx.be/cgi-bin/viewauth/Tracking/TestProjectAgai nInitialDevStor y#edit
table2';
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']);
So request() expects a reference to an array following Content.


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']);
This contains a syntax error and will not compile. I presume you mean
$postStr = [ ... ];

$postStr is a scalar variable containing a reference to an anonymous
array. Please cut-and-paste code rather than retyping it.

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


You are passing Content => [ $postStr ] to request(). In other words,
you are passing a reference to an anonymous array with one element: a
reference to an anonymous array. You have one too many levels of
reference. Try changing this to: Content => $postStr
FYI: this newsgroup is defunct. Try comp.lang.perl. misc in the future.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7724
by: mike | last post by:
regards: Does each HTTP Request have "Host:" header? Any positive suggestion is welcome. thank you May goodness be with you all
5
6028
by: Henrik | last post by:
Hi, I am trying to read some industrial webservers using the HTTP/CGI webequest like this: wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string); mwst = (HttpWebResponse wrs.GetResponse(); str = mwst.GetResponseStream(); This usually works fine but on some servers i get:
1
5539
by: Kueishiong Tu | last post by:
I have a .net window form application but I have to get data from various web sites. How do I make Http request (preferrably via post method) from a window form to get the data from those web sites? What namespace and dll do I have to include? A walkthrough and coding example will be helpful. ...
1
3391
by: Robert Huie | last post by:
Hi all, I'm trying to use asp.net to code a chat window and I would like to make the http request delay as long as possible till the process/thread detects a new incoming message. basically something like the following: while(nonewmessages) { nonewmessages = checkfornewmessages();
1
2468
by: omantawy | last post by:
Hi, I have some legacy ASP web applications that use an unmanaged COM component to connect to a third party application. The third part application has moved to the managed code in the current release with backward compatibility with the unmanaged code. In the future releases, the vendor is going to drop backward compatibility and as a result of that all our legacy ASP applications will break.
16
2436
by: palm | last post by:
Hi There, I need to send some parameters from a Perl program to another Perl program that's in cgi-bin. I'm trying to do an http request, but it's not working properly. Any ideas? Palm.
1
3145
by: Shashank | last post by:
Hi all, I am a new member of this community. I am making a http request to a html file placed on a Apache server. On this page there is an embeded perl statement which requires reading environment variables from the server. When I am typing the url of the html page in my browser, I am able to read the Environment variables from the server and getting the desired results. But, when I am making Http request through my window application,...
1
3669
by: nkg1234567 | last post by:
I'm trying to extract HTML from a website in the form of a string, and then I want to extract particular elements from the string using the substr function: here is some sample code that I have thus far: use HTTP::Request::Common; use LWP::UserAgent; use LWP::Simple; $ua = LWP::UserAgent->new;
1
1201
by: erxuan | last post by:
Hi, I'm writing a program what given a homepage url, it can automatically navigate to the page that contains the query form, fill the form and submit it. mshtml.IHTMLInputElement zipCodeQueryBox = FindZipCodeQueryBox(inputElements); zipCodeQueryBox.value = "60616"; zipCodeQueryBox.form.submit();
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.