[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mod_perl and HTTP IO issue


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Nov 08, 2006 at 09:04:36PM -0500, Sumit Shah wrote:
> Thanks for pointing that out. Really silly of me. 
> 
> After correcting it, it seems that $result does not equate to 'INVALID'
> even though the server returned INVALID. I can see that if I output the
> value as:
> 
> $r->send_http_header('text/plain');
> print "This is the value for result------:$result\n";
> 
> 
> Does the socket NOT return a string? 
> 
> #READ THE RESPONSE BODY
> 	while (defined($content = <SOCK>)) {
                                  ^^^^^^^

This will read up to line separator...

> 		$result = $result . $content;
> 	}      
> 
> 	if($result eq 'INVALID'){
> 		#do something...
> 	}

So, if your line separator is, let me guess, "\n", $result might contain
now "INVALID\n". You might fare better either chomp()ing $result or
comparing ``if($result =~ /^INVALID/)''.

But I am guessing wildly.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFVV7BBcgs9XrR2kYRAtAlAJ49JXpXVdgtSdngoG0qbGG2swt9IwCaA1g5
oLxD7Sy1hYiXF0I7bE2SEbM=
=/A4S
-----END PGP SIGNATURE-----


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.