### letssee.pl use strict; use warnings; use Mongo; my $buffer = Mongo::payload(); print $buffer; __END__ #### ### Mongo.pm use strict; use warnings; package Mongo; use PerlIO::gzip; 1; # appease require sub payload { binmode( DATA, ':gzip' ); local $/ = \4096; my $ret; $ret .= $_ while ; return $ret; } __DATA__ #### % echo 'hello world'| gzip -c - >> Mongo.pm #### % perl letssee.pl hello world