[pod] [xml]

NAME

CGI::WebGzip - Perl extension for GZipping script output CGI::WebGzip - 文字出力をGZipにより圧縮するPerl拡張

SYNOPSIS

  # Usual code working with STDOUT:
  # 標準出力に使用される標準的なコードです:
  use CGI::WebGzip;
  print "Content-type: text/html\n\n";
  print "Hello, world!";
  # Lesser compression (by default 9, now - 5)
  # より小さい圧縮 (by default 9, now - 5)
  use CGI::WebGzip(5);
  # Set callback function which would be called after compressing,
  # but before any output. You may set cookie in this function to
  # display them later on the page (using JavaScript).
  # どんな出力の前にでも,圧縮された後に呼ばれるcallback関数設定して下さい.
  # あなたはこの関数の中でCookieをセットすことができる
  # 後でJavaScriptを使用してCookieを表示して下さい.
  use CGI::WebGzip;
  BEGIN {
      CGI::WebGzip::setCallback(sub {
          my ($nL, $oL) = (length $_[0], length $_[2]);
          print sprintf "Set-Cookie: page_size=%d,%d; path=/\n", $oL, $nL;
          return 1;
      });
  }
  # Working together with CGI::WebOut.
  # CGI::WebOutと一緒に動かす場合.
  use CGI::WebGzip;
  use CGI::WebOut;
  print "Hello, world!";
  # Work in FastCGI environment.
  # FastCGI環境で動かす場合.
  require CGI::WebGzip;
  while (read request) {
     CGI::WebGzip::import;  # captures output
     ...
     CGI::WebGzip::flush(); # releases output
  }

OVERVIEW

In PHP, you may write: ob_start("ob_gzhandler") and get all the output GZip-ed automatically. CGI::WebGzip does the same thing. Is you include this module in the beginning of your program, it whill capture all the output. When the script ends, CGI::WebGzip compresses captured data and send it to browser.

PHPではあなたはこのように書くことができます:ob_start("ob_gzhandler") そして GZipにより圧縮された出力を自動ですべて取得することができます. CGI::WebGzipは同じことをします. あなたのプログラムの開始時にこのモジュールを取り込むことにより, その間の全ての出力を得ることができます. スクリプトが終了するとCGI::WebGzipは取得したデータを圧縮しそれをブラウザに送ります.

If browser is incompatible with GZip encoding, output will not be captured, and data will not be compressed.

もしブラウザがGZipエンコーディングを実装していない場合,出力を得ず, データを圧縮しないでしょう.

DESCRIPTION

EXPORT

None by default.

デフォルトでは何もない.

DEPENDENCIES

CGI::WebGzip depends on Compress::Zlib only. If this library is not found, no error messages are generated.

CGI::WebGzipはCompress::Zlibだけに依存しています. もしこのライブラリが見つからない場合でもエラーメッセージは生成されません.

AUTHOR

Dmitry Koterov <koterov at cpan dot org>

SEE ALSO

Compress::Zlib, CGI::WebOut

翻訳者

 atsushi kobayashi(nekokak@users.sourceforge.jp)