in reply to using LWP::UserAgent and DBI together

I guess your http server is not responding the request made by $ua and $ua just waits for that response.

Sourav, you should primarily decide, what do you want - if your goal is direct connection with some sql database engine (rdbms), DBI and proper DBD:: driver is a good choice. You can connect local rdbms (the software running on the same computer as your perl code), or you can connect remote rdbms, typically via pure tcp/ip protocol.

But if you want to establish communication with http server (local or remote, which is evident from url), you can use LWP::UserAgent and related modules.

Update: I apologize if I did not understand you correctly, perhaps you want to do both, http request and some sql command...

  • Comment on Re: using LWP::UserAgent and DBI together

Replies are listed 'Best First'.
Re^2: using LWP::UserAgent and DBI together
by sourav (Initiate) on Nov 09, 2009 at 15:42 UTC
    That's right, I'd like to use both a http request and a database connection. My main requirement is - send a post request to a http server and see what the response is, if it's a success, then run a stored proc at the backend to update a table with the response from the http server. The code I posted is a simplfied form of the actual code, which curently waits infinitely during the $dbh->selectall_arrayref() execution (and not the $ua = LWP::UserAgent->new() call). I guess there are some problems when you are using both these two modules in a single script, however, I could not find any specific document describing the source of the problem or anything to solve it (that is, to have a http request and a dbi call in the same script). Any help?
      One more thing I might add... I tried replicating the same problem with ActivePerl 5.8, here it seems to be working fine without a glitch... but I can't use this version at work (that's only 5.6 there)....