in reply to LWP and server-side exception propogation

When an exception is thrown on the server, I always get back an HTTP 400 (bad request) and nothing else about the problem.

No, you get back a HTTP::Response object, you should print $resp->dump;

Replies are listed 'Best First'.
Re^2: LWP and server-side exception propogation
by amazotron (Novice) on Oct 08, 2009 at 03:17 UTC
    Yeah, I had it under a graphical debugger (from ActiveState's PDK) and saw the dump there. There was nothing showing anything but the 400.

    I originally thought it might be a server configuration issue until I saw the desired error details shown by the CURL client tool.

      One difference between LWP and curl is the User-Agent header in the request. Some servers and server-side applications look at that header (stupid idea, as the client can fake any user agent) and try to block some user agents (more stupid), either using a blacklist of "evil" ones or a whitelist of "good" ones (even more stupid).

      I don't think your code behaves like this, but perhaps a library you use on the server side has this nonsense behaviour. Try sending the request from LWP with curl's User-Agent header. If that works, look at your code, the library documentations for the server side, and finally the web server configuration and documentation.

      As a side note, I don't generally trust debuggers and rich IDEs. Try adding $response->dump() to your client code. Note that this method behaves like print $response->dump() when called in void context. So, if you want the dump on STDERR or in a log file, call it in a non-void context and write out the dump manually.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      I originally thought it might be a server configuration issue until I saw the desired error details shown by the CURL client tool.

      Right, sure, absolutely, whatever you say :D

        Well just to close this issue, this ended up being my problem. The error was in the content but was buried inside a ton of HTML code.