473,386 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

xml & stdin

i'm trying to read an xml document sent to a cgi script, but the script just
seems to be hanging, not using CPU or memory, just no responce.
i'm just working with simple test scripts at the moment, i want to use the
xml::Simple module but even that hanging so i'm trying to read it from stdin
and just write the xml back out.
what am i doing wrong?
bellow is the script:

XML File:
<config logdir="/var/log/foo/" debugfile="/tmp/foo.debug">
<server name="sahara" osname="solaris" osversion="2.6">
<address>10.0.0.101</address>
<address>10.0.1.101</address>
</server>
<server name="gobi" osname="irix" osversion="6.5">
<address>10.0.0.102</address>
</server>
<server name="kalahari" osname="linux" osversion="2.0.34">
<address>10.0.0.103</address>
<address>10.0.1.103</address>
</server>
</config>

perl script:
use XML::Simple;
#my $config = XMLin("-");

print "Content-type: text/xml\n\n";
#use Data::Dumper;
#print Dumper($config);
print $ENV{"Request_Method"} . "\n";
print $ENV{"CONTENT_LENGTH"};

my $query;
read( STDIN, $query, $ENV{"CONTENT_LENGTH"} )
print $query;
Jul 19 '05 #1
2 4164
Robyn Mylius wrote:
use XML::Simple;
#my $config = XMLin("-");

print "Content-type: text/xml\n\n";
#use Data::Dumper;
#print Dumper($config);
print $ENV{"Request_Method"} . "\n";
print $ENV{"CONTENT_LENGTH"};

my $query;
read( STDIN, $query, $ENV{"CONTENT_LENGTH"} )
print $query;

I understand you're entering the XML data on the keyboard.

The 'read' function call attempts to read characters from STDIN until
it encounters end-of-file or 'CONTENT_LENGTH' characters have been
read. It probably hangs because you have entered less than the
specified number of characters.
Jul 19 '05 #2
"Robyn Mylius" <so*****@somewhare.com> wrote in message news:<3e***********************@news.optusnet.com. au>...
i'm trying to read an xml document sent to a cgi script, but the script just
seems to be hanging, not using CPU or memory, just no responce.
i'm just working with simple test scripts at the moment, i want to use the
xml::Simple module but even that hanging so i'm trying to read it from stdin
and just write the xml back out.
what am i doing wrong?


Confusing your problem domains.

Rolling your own CGI implementation.

Emiting a CGI response with a content-type header of text/xml but an
entity body that is not XML.

Not enabling strctures and warnings.

Posting to a non-existant newsgroup.
Jul 19 '05 #3

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

Similar topics

10
by: Des Small | last post by:
Lately I have found myself using a pattern to make new dictionaries quite often, by which I mean twice: def invert(d): nd = {} ).append(key) for k, v in d] return nd def count(l): d = {}
6
by: Tsai Li Ming | last post by:
Dear all, I have a problem with a redirecting stdout and stderr. I am a top level module and has no control over the imported modules that are making system calls such as os.system or popen2.* ....
0
by: Brano Zarnovican | last post by:
Hi ! I'd like to init curses and still have working Python interactive command line. I found that you can replace stdin/stdout/stderr like this: #!/usr/bin/python -i import curses import...
39
by: n00m | last post by:
Given a list of N arbitrarily permutated integers from set {1..N}. Need to find the ordering numbers of each integer in the LONGEST increasing sequence to which this number belongs. Sample: ...
42
by: Andy | last post by:
and so far I'm loving it, I like the the authors don't beat around the bush and just come straight out and say what the book is sopposed to be. They assume the you have computer experience. I'm...
12
by: Merrill & Michele | last post by:
It's very difficult to do an exercise with elementary tools. It took me about fifteen minutes to get exercise 1-7: #include <stdio.h> int main(int orange, char **apple) { int c; c=-5;...
2
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to...
46
by: Sensei | last post by:
I was having an interesting discussion about the ANSI C and some ``weird inconsistencies'', or at least what at first sight can be seen as an imbalance. I hope someone can satisfy my curiosity. ...
0
by: grbCPPUsr | last post by:
I am new to Python. I would like to use Python for the specialized purpose of dynamic expressions parsing & evaluation in my C++ application. I would like to encapsulate the expressions to be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...

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.