in reply to Re: XML::FeedPP Crashing Despite Eval
in thread XML::FeedPP Crashing Despite Eval

Thanks! But WTF? I've never heard of a feed being gzipped. Does anyone know if this is common? Also why didn't eval trap the error?
  • Comment on Re^2: XML::FeedPP Crashing Despite Eval

Replies are listed 'Best First'.
Re^3: XML::FeedPP Crashing Despite Eval
by davorg (Chancellor) on Jun 25, 2009 at 12:16 UTC

    Zipping responses from web servers is pretty common. Browsers handle zipped content seamlessly.

    --

    See the Copyright notice on my home node.

    Perl training courses

Re^3: XML::FeedPP Crashing Despite Eval
by Anonymous Monk on Jun 25, 2009 at 11:41 UTC
    eval traps die, doesn't stop warnings, exit ...
Re^3: XML::FeedPP Crashing Despite Eval
by afoken (Chancellor) on Jun 26, 2009 at 15:51 UTC

    You get back gzip compressed content because ...

    1. The server is able to compress the requested content on-the-fly (typically, because gzip_cnc or mod_gzip are installed), and
    2. your user-agent said that it could handle gzip-compressed content ("Accept-Encoding" header)

    or

    1. The server is able to compress the requested content on-the-fly, and
    2. the server does not care about the capabilities of the user-agent

    In the first case, make sure that the announced and the real capabilities of your user-agent match, i.e. don't send "Accept-Encoding: gzip" if you can't or don't want to handle gzip-compressed content.

    In the latter case, the server is misconfigured, either accidentally or intentionally. All currently and commonly used browsers can handle gzip compressed content, so not checking the capabilities at all save a few thousand CPU cycles and some lines of code. Of course, this is not what I would call a well-behaved server.

    See also http://schroepl.net/projekte/mod_gzip/encoding.htm

    Your eval "surprise" was already explained: eval traps die, nothing less, nothing more. It does not help you with code that exits or messes up perl's internal structures.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)