Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > xml & stdin

Reply
Thread Tools

xml & stdin

 
 
Robyn Mylius
Guest
Posts: n/a
 
      06-27-2003
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:umper;
#print Dumper($config);
print $ENV{"Request_Method"} . "\n";
print $ENV{"CONTENT_LENGTH"};

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


 
Reply With Quote
 
 
 
 
Sator Arepo
Guest
Posts: n/a
 
      06-27-2003
Robyn Mylius wrote:

> use XML::Simple;
> #my $config = XMLin("-");
>
> print "Content-type: text/xml\n\n";
> #use Data:umper;
> #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.


 
Reply With Quote
 
 
 
 
nobull@mail.com
Guest
Posts: n/a
 
      06-27-2003
"Robyn Mylius" <> wrote in message news:<3efbbc32$0$26634$. 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
peek at stdin, flush stdin Johnathan Doe C Programming 5 4 Weeks Ago 04:30 PM
How to pass stdin of a C++ program to the stdin of a process createdwith ShellExecute() Ben C Programming 2 08-29-2009 09:47 PM
STDIN, OUT, ERR and $stdin, out, err - Differences? Terry Cooper Ruby 7 06-09-2009 05:48 AM
Reading from stdin then launching a program that reads from stdin strange behaviour Stefano Sabatini Perl Misc 6 07-29-2007 10:38 PM
Reading stdin once confuses second stdin read Charlie Zender C Programming 6 06-21-2004 01:39 PM



Advertisments