Wise Monks, I have a question about perl and CGI applications.

I have a CGI application which dynamically generates very large pages (up to arround 20 mb of html). Naturally this can take some time, not only to generate, but also to transmit across the web, and display on the client side. I am currently investigating ways to reduce the size of the HTML, but that is not what I want to ask here. I know there is a mod for apache which will gzip the output from a script, in a way which the browser will recognise and unzip automagically. I, however, have had no success in getting this plug-in to function properly. My question is: Is there a way to do this entirely on the perl side? I would like to build a string in perl, gzip it, and send it to the browser and have it automagically unzipped and displayed by the client browser. I'm sure there are modules on CPAN to gzip a string, but is there some header I need to send in order to tell the browser to unzip the data before trying to display it? I am working in perl 5.6.1 on Red Hat linux 8.0, with apache 1.27, and the application is designed to work in IE 5.0 and later.

May the Force be with you

In reply to OFT: Gzipping output from a CGI by JediWizard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.