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>)) {
                $result = $result . $content;
        }      

        if($result eq 'INVALID'){
                #do something...
        }

Thanks
Sumit


 

> -----Original Message-----
> From: Dondi M. Stroma [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, November 08, 2006 8:45 PM
> To: Sumit Shah
> Cc: modperl@perl.apache.org
> Subject: Re: Mod_perl and HTTP IO issue
> 
> if ($result ="INVALID"){
> Is that a single equal sign? Should be double equal sign. 
> Actually it should be eq because it's a string.
> 
> if ($result eq 'INVALID') {
> 
> ----- Original Message -----
> From: "Sumit Shah" <[EMAIL PROTECTED]>
> To: "Sumit Shah" <[EMAIL PROTECTED]>; <modperl@perl.apache.org>
> Sent: Wednesday, November 08, 2006 8:37 PM
> Subject: RE: Mod_perl and HTTP IO issue
> 
> 
> All,
> 
> I was able to figure out the issue below. However, I am now facing an
> issue where if the response is 'VALID' it is not fetching the 
> requested
> page as could be implied by the return statement. Also, sometimes I
> observed that even if the response is VALID, it still redirects to
> GOOGLE.
> 
> #Check the status
>   if ($result ="INVALID"){
>   my $url1 = 'http://www.google.com';
>   $r->content_type('text/html');
>   $r->headers_out->set('Location' => $url1);
>   $r->status(Apache::Constants::REDIRECT);
>          return Apache::Constants::REDIRECT;
>          }
>   return;
> 
> I would appreciate if you could point me to what I am doing wrong.
> 
> Thanks
> Sumit
> 
> 
> 

Reply via email to