magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 08 > Programming with Perl  

Archiving and Compression with CGI

By Randal L. Schwartz

Tens of thousands of compressed tar archives probably exist out there on the Web to download. I can't imagine how much time, even on a high speed connection, it would take to download them all. A major problem with compressed archives, whether tar, zip, or otherwise, is that even if the publisher of the information has carefully bundled only the most important files, sometimes I really want only part of the data. However, I'm forced to download the entire thing (perhaps over a slow connection in a hotel room, as I often am), to discard only the parts I don't want.

The Data publisher should provide a way to build a custom-compressed archive, with only the files or directories that I choose. That's what we have this month: A CGI program that lets a user choose individual distribution files, on an item-by-item basis. Once a user has made his or her choice, a specific tarred and gzipped file (.tar.gz) appears on the server for the user to download. The code for the script that does this is in Listing 1.

As a side note, this month's column idea was suggested by fellow Stonehenge Perl trainer and Usenet poster extraordinaire, the one and only Tom Phoenix (rootbeer@redcat.com). It's based on similar code he wrote for me to handle the downloads of exercise data and answers for our on-site training classes. I wrote the code in Listing 1 from scratch, though, so if it isn't exactly what he was suggesting, that's my fault.<>




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2