#!/usr/bin/perl -w # encode0.pl - Don Yang (uguu.org) # # 05/10/09 use strict; use IO::Zlib; use IO::String; # Load input text my $input = join "", <>; # Compress using gzip my $output; my $outfile = IO::Zlib->new(IO::String->new($output), "wb"); print $outfile $input; close $outfile; # Uuencode compressed string my $data = pack 'u', $output; $data =~ s/\s//sg; # Output code print <<"EOT"; use IO::Zlib; use IO::String; my \$uncompressed = IO::Zlib->new(IO::String->new(unpack "u", q{$data}), "rb"); print join '', <\$uncompressed>; EOT