Search code examples
perlhttpcpanlwp

While using LWP:UserAgent, $response->is_success returns blank


I am using LWP::UserAgent like below

my $ua = LWP::UserAgent->new;

my $response = $ua->request ( ...);

if ( $response->is_success() )
{
...
}
print $response->is_success();

Problem I am facing is that is_success() is returning blank. I was expecting 1 (TRUE) or 0 (FALSE). What am I doing wrong here? Is print statement right?


Solution

  • From the discussion in comments:

    $response->status_line 
    

    actually returned 500 Can't Connect to database.

    With $response->is_success(), I was unable to understand the response from db.

    Used $response->status_line to find out exactly where the code was failing.