#!/usr/bin/perl use Pg; use Archive::Zip qw(:ERROR_CODES :CONSTANTS ); my $conn = Pg::connectdb("port=5432 dbname=ed user=ed password=jxtym1"); die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status; $conn->exec("set CLIENT_ENCODING to 'WIN'"); my $result = $conn->exec("select text,title from arhive where id=".$ARGV[0]); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; my @row = $result->fetchrow; my $zip = Archive::Zip->new(); print "Content-type: application/zip\n"; print "\n"; $|=1; my $member=$zip->addString('
'.$row[1].'