mod_perl-1.29_related > Apache::FakeCookie

名前

  Apache::FakeCookie - デバッグで使うフェイクリクエストオブジェクト

概要

  use Apache::FakeCookie;

 これは、Apache::FakeCookie を Apache::Cookie 名前空間の中へロードする(訳者補完;Apache::Cookie をフェイククッキー Apache::FakeCookie で上書きする)

説明

このモジュールは Apaceh::* モジュールの作者が一連の書き込みテストプログラムを書くの手助けをしてくれます。このモジュールを使えば、クッキーメソッドをテストする目的で実際にサーバーを走らせたりクエリーを発行することなく Apache::Cookie を使用することができるようになります。テストスクリプトの中で、あなたのApache モジュールをロードした後に Apache::FakeCookie をロードします。

このモジュールの利用法は、Apache::Cookie と同じです。

メソッド群

Apache::Cookie のメソッド全てを実行できる

詳しい利用方法は、 Apache::Cookie manページを参照。

remove -- (訳者補完;Apache::Cookie には無い)新規メソッド

名前付きクッキー、またはポインタで指し示しされたクッキーを消去する。

  $cookie->remove;

  Apache::Cookie->remove('name required');

  $cookie->remove('some name');
        テスト目的で使用、次と同じ:
    $cookie = Apache::Cookie->new($r,
        -name   => 'some name',
    );
    $cookie->bake;
new
  $cookie = Apache::Cookie->new($r,
        -name    => 'some name',
        -value   => 'my value',
        -expires => 'time or relative time,
        -path    => 'some path',
        -domain  => 'some.domain',
        -secure  => 1,
  );

Apache リクエスト、いわゆる $r 、はここでは使用しないし、おそらく undef であろう。

bake
  クッキーはローカルメモリに保存される。

  $cookie->bake;
fetch
  ローカルメモリからクッキーの値が返される。

  $cookies = Apache::Cookie->fetch;     # ハッシュリファレンス
  %cookies = Apache::Cookie->fetch;
as_string
  クッキーオブジェクトを文字列としてフォーマットする。
  これは、 Apache::Cookie オブジェクトと同じ。
parse
  クッキー文字列が存在しないならば、fetchと同じ動作をする。

  $cookies = Apache::Cookie->fetch(raw cookie string);
  %cookies = Apache::Cookie->fetch(raw cookie string)

  クッキーメモリーは消去されて、"raw cookie string"を
  パースした内容で置き換える。
name, value, domain, path, secure
  指定したクッキーの値を取得または設定する。
  テストが目的ならそれら値は単なる文字列だが、
  ”value" は 複数のスカラー、ハッシュのリファレンス、
  配列のリファレンスを受け取ることが出来る。
expires
  Apache::CookieやCGI::Cookie と同じフォーマットの
  有効期限 (expires) を取得・設定する。
  詳しくはそれらの man ページを参照。

SEE ALSO

Apache::Cookie(3)

作者

Michael Robinton michael@bizsystems.com Inspiration and code for subs (expires, expires_calc, parse) from CGI::Util by Lincoln Stein

COPYRIGHT and LICENSE

  Copyright 2003 Michael Robinton, BizSystems.

This module is free software; you can redistribute it and/or modify it under the terms of either:

  a) the GNU General Public License as published by the Free Software
  Foundation; either version 1, or (at your option) any later version,
  
  or

  b) the "Artistic License" which comes with this module.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

You should have received a copy of the Artistic License with this module, in the file ARTISTIC. If not, I'll be glad to provide one.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Translator into Japanese (訳者)

anahori (at users.sourceforge.jp)

Japanized Perl Resources Project (http://sourceforge.jp/projects/perldocjp/)