/usr/share/perl5/MIME/Decoder/Gzip64.pm is in libmime-tools-perl 5.503-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | package MIME::Decoder::Gzip64;
=head1 NAME
MIME::Decoder::Gzip64 - decode a "base64" gzip stream
=head1 SYNOPSIS
A generic decoder object; see L<MIME::Decoder> for usage.
=head1 DESCRIPTION
A MIME::Decoder::Base64 subclass for a nonstandard encoding whereby
data are gzipped, then the gzipped file is base64-encoded.
Common non-standard MIME encodings for this:
x-gzip64
Since this class relies on external programs which may not
exist on your machine, MIME-tools does not "install" it by default.
To use it, you need to say in your main program:
install MIME::Decoder::Gzip64 'x-gzip64';
Note: if this class isn't working for you, you may need to change the
commands it runs. In your main program, you can do so by setting up
the two commands which handle the compression/decompression.
use MIME::Decoder::Gzip64;
$MIME::Decoder::Gzip64::GZIP = 'gzip -c';
$MIME::Decoder::Gzip64::GUNZIP = 'gzip -d -c';
=head1 SEE ALSO
L<MIME::Decoder>
=head1 AUTHOR
Eryq (F<eryq@zeegee.com>), ZeeGee Software Inc (F<http://www.zeegee.com>).
All rights reserved. This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
=cut
require 5.002;
use strict;
use vars qw(@ISA $VERSION $GZIP $GUNZIP);
use MIME::Decoder;
use MIME::Base64;
use MIME::Decoder::Base64;
use MIME::Tools qw(tmpopen whine);
# Inheritance:
@ISA = qw(MIME::Decoder::Base64);
# The package version, both in 1.23 style *and* usable by MakeMaker:
$VERSION = "5.503";
# How to compress stdin to stdout:
$GZIP = "gzip -c";
# How to UNcompress stdin to stdout:
$GUNZIP = "gzip -d -c";
#------------------------------
#
# decode_it IN, OUT
#
sub decode_it {
my ($self, $in, $out) = @_;
# Open a temp file (assume the worst, that this is a big stream):
my $tmp = tmpopen() || die "can't get temp file";
# Stage 1: decode the base64'd stream into zipped data:
$self->SUPER::decode_it($in, $tmp) or die "base64 decoding failed!";
# Stage 2: un-zip the zipped data:
$tmp->seek(0, 0);
$self->filter($tmp, $out, $GUNZIP) or die "gzip decoding failed!";
}
#------------------------------
#
# encode_it IN, OUT
#
sub encode_it {
my ($self, $in, $out) = @_;
whine "Encoding ", $self->encoding, " is not standard MIME!";
# Open a temp file (assume the worst, that this is a big stream):
my $tmp = tmpopen() || die "can't get temp file";
# Stage 1: zip the raw data:
$self->filter($in, $tmp, $GZIP) or die "gzip encoding failed!";
# Stage 2: encode the zipped data via base64:
$tmp->seek(0, 0);
$self->SUPER::encode_it($tmp, $out) or die "base64 encoding failed!";
}
#------------------------------
1;
|