I ran into this a while back, so the details are fuzzy; merlyn had an article in WebTechniques (I hope; found it Programming w/ Perl) which he talked about doing something like this, and the exercise to the reader was to improve it to use compress. I tried and ran up against the above problem. The Author of Archive::Tar was quite helpful, but I don't recall (sorry) the result (use a type glob?) but you could probably contact him for a fix. I believe I did something like the above, hide the seek (ahem) and lived w/ it.

Update I found the Author's reply (here for the heck of it):
--- quote
From: Stephen Zander gibreel@pobox.com>
To: Andy Bach root@wiwb.uscourts.gov>
Subject: Re: Archive::Tar

>> "Andy" == Andy Bach root@wiwb.uscourts.gov> writes:
We just send back an http header saying tar.gzip file to follow and dump the output to STDOUT and the browser handles the saving, but I couldn't get $tar->write() to use stdout easily, w/ compression on.

Try using ->write(\*STDOUT) to force the output to the pre-existing STDOUT handle. This should Just Work. If it doesn't I'd appreciate the output of any error logs from apache and information on your environment (eg, apache version perl version, Archive::Tar version, whether you're using mod_perl etc)

Thanks
Stephen

"Farcical aquatic ceremonies are no basis for a system of government!"
--- end quote

a


In reply to Re: The Problem & My Solution (please comment) by a
in thread Tar File To Web Browser by Hrunting

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.