Since you probably need a handle, but you can't use STDOUT and don't want to use a real file, try
Tie::Handle::ToMemory which allows you to work with a handle, but collect the data in a scalar. Once the compressed output is in the scalar, you can print it as normal so mod_perl will be happy.
Phil