Thread Probleme mit Compress::Zlib::memGzip (12 answers)
Opened by burnersk at 2008-07-15 16:13

pq
 2008-07-15 16:39
#112144 #112144
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
ich habe das skript mal etwas verkleinert bzw. lesbarer gemacht:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -t
use strict;
use warnings;

use Compress::Zlib;
use Digest::MD5 qw(md5_hex);
my $now = "Tue, 15 Jul 2008 12:06:38 GMT";
my $content = 'testtesttesttesttesttesttesttesttesttest';
$content = Compress::Zlib::memGzip("$content");
my $l = length($content);
my $md5 = md5_hex($content);
#HTTP/1.1 200 OK - das schickt doch der webserver eh
print <<"EOM";
Allow: GET, POST
Connection: close
Content-Encoding: gzip
Content-Length: $l
Content-MD5: $md5
Content-Type: text/plain; charset=UTF-8
Date: $now
Last-Modified: $now
Server: Neu1/1.0

EOM
print $content;
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Probleme mit Compress::Zlib::memGzip