CGI-Compress-Gzip

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    a little brittle. Most potential problems arise because STDOUT gets
    tweaked as soon as header() is called.

    If you use the CGI.pm header() API as specified in CGI.pm, then all
    should go well. But if you do anything unusual, this module may break.
    For example:

       # BROKEN CODE
       use CGI::Compress::Gzip;
       my $q = CGI::Compress::Gzip->new;
       print "Set-Cookie: foo=bar\n" . $q->header;
       print "Hello, world\n";

       # WORKAROUND 1 (preferred)
       use CGI::Compress::Gzip;
       my $q = CGI::Compress::Gzip->new;
       print $q->header("-Set_Cookie" => "foo=bar");
       print "Hello, world\n";

       # WORKAROUND 2
       use CGI::Compress::Gzip;
       my $q = CGI::Compress::Gzip->new;
       print "Set-Cookie: foo=bar\n";
       print $q->header;
       print "Hello, world\n";

    Future versions could try to parse the header to look for its end rather
    than insisting that the printed version match the version returned by
    header(). Patches would be very welcome.

SEE ALSO
    CGI::Compress::Gzip depends on CGI and IO::Zlib. Similar functionality
    is available from mod_gzip, Apache::Compress or Apache::GzipChain,

lib/CGI/Compress/Gzip.pm  view on Meta::CPAN

   my $content_type;

   # This search reproduces the header parsing done by CGI.pm
   if (@{$header} && $header->[0] =~ m/ \A [a-z] /xms) ## no critic (ProhibitEnumeratedClasses)
   {

      # Using unkeyed version of arguments - convert to the keyed version

      # arg order comes from the header() function in CGI.pm
      my @flags = qw(
         Content_Type Status Cookie Target Expires
         NPH Charset Attachment P3P
      );
      for my $i (0 .. $#{$header})
      {
         if ($i < @flags)
         {
            push @newheader, q{-} . $flags[$i], $header->[$i];
         }
         else
         {

lib/CGI/Compress/Gzip.pm  view on Meta::CPAN

code that is a little brittle.  Most potential problems arise because
STDOUT gets tweaked as soon as header() is called.

If you use the CGI.pm header() API as specified in CGI.pm, then all
should go well.  But if you do anything unusual, this module may
break.  For example:

   # BROKEN CODE
   use CGI::Compress::Gzip;
   my $q = CGI::Compress::Gzip->new;
   print "Set-Cookie: foo=bar\n" . $q->header;
   print "Hello, world\n";

   # WORKAROUND 1 (preferred)
   use CGI::Compress::Gzip;
   my $q = CGI::Compress::Gzip->new;
   print $q->header("-Set_Cookie" => "foo=bar");
   print "Hello, world\n";

   # WORKAROUND 2
   use CGI::Compress::Gzip;
   my $q = CGI::Compress::Gzip->new;
   print "Set-Cookie: foo=bar\n";
   print $q->header;
   print "Hello, world\n";

Future versions could try to parse the header to look for its end rather
than insisting that the printed version match the version returned by
header().  Patches would be very welcome.

=head1 SEE ALSO

CGI::Compress::Gzip depends on CGI and IO::Zlib.  Similar



( run in 0.233 second using v1.01-cache-2.11-cpan-e9199f4ba4c )