Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   xml & stdin (http://www.velocityreviews.com/forums/t24121-xml-and-stdin.html)

Robyn Mylius 06-27-2003 03:38 AM

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;



Sator Arepo 06-27-2003 01:19 PM

Re: xml & stdin
 
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.



nobull@mail.com 06-27-2003 04:15 PM

Re: xml & stdin
 
"Robyn Mylius" <someone@somewhare.com> wrote in message news:<3efbbc32$0$26634$afc38c87@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.


All times are GMT. The time now is 10:39 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57