=encoding euc-jp =head1 名前 Thread::Serialize - スレッド間のデータ構造をシリアル化 =head1 概要 use Thread::Serialize; # freeze()とthaw()をエクスポート use Thread::Serialize (); # must call fully qualified subs my $frozen = freeze( any data structure ); any data structure = thaw( $frozen ); =head1 説明 *** A note of CAUTION *** This module only functions on Perl versions 5.8.0 and later. And then only when threads are enabled with -Dusethreads. It is of no use with any version of Perl before 5.8.0 or without threads enabled. ************************* *** 注 意 書 き *** このモジュールは、Perlのバージョン5.8.0以降で、かつ、-Dusethreads オプションでスレッドが有効になっている場合にのみ機能する。5.8.0以前、 あるいはスレッドが有効になっていない場合は、使うことができない。 ************************* The Thread::Serialize module is a library for centralizing the routines used to serialize data-structures between threads. Because of this central location, other modules such as L, L or L can benefit from the same optimilizations that may take place here in the future. Thread::Serializeモジュールは、スレッド間のデータ構造をシリアル化するのに 用いられる諸ルーチンを集中化するためのライブラリである。集中化することに よって、L、LあるいはLのような 他のモジュールは、将来これに取って代わる最適化から利益を得ることができる。 =head1 サブルーチン There are only two subroutines. 二つのサブルーチンがあるだけだ。 =head2 freeze my $frozen = freeze( $scalar ); my $frozen = freeze( @array ); The "freeze" subroutine takes all the parameters passed to it, freezes them and returns a frozen representation of what was given. The parameters can be scalar values or references to arrays or hashes. Use the L subroutine to obtain the original data-structure back. "freeze"サブルーチンは渡された全てのパラメータをとり、そららを凍結し、その 凍結したものを返す。パラメータはスカラー値か、配列またはハッシュのリファレンス が可能である。元のデータ構造に戻すにはLサブルーチンを使う。 =head2 thaw my $scalar = thaw( $frozen ); my @array = thaw( $frozen ); The "thaw" subroutine returns the data-structure that was frozen with a call to L. If called in a scalar context, only the first element of the data-structure that was passed, will be returned. Otherwise the entire data-structure will be returned. "thaw"サブルーチンはLによって凍結されたデータ構造を返す。 サブルーチンがスカラーコンテキストで呼ばれると、渡されたデータ構造の一番目の 要素だけが返される。それ以外のコンテキストでは完全なデータ構造が返される。 It is up to the developer to make sure that single argument calls to L are always matched by scalar context calls to L. 一つの引数によるLの呼び出しがスカラーコンテキストでのLの 呼び出しに対応するよう保証するのは、開発者の責任である。 =head1 最適化 To reduce memory and CPU usage, this module uses L. This causes subroutines only to be compiled in a thread when they are actually needed at the expense of more CPU when they need to be compiled. Simple benchmarks however revealed that the overhead of the compiling single routines is not much more (and sometimes a lot less) than the overhead of cloning a Perl interpreter with a lot of subroutines pre-loaded. メモリとCPUの使用を抑えるために、このモジュールはLを利用する。 このモジュールの利用により、サブルーチンが実際に必要になるときにだけ、 それらはスレッド内でコンパイルされるのだが、サブルーチンがコンパイル されると、より多くのCPUが犠牲になる。しかし単純なベンチマークにおいて、 一つのルーチンをコンパイルするオーバーヘッドは、あらかじめロードされた 多数のサブルーチンを伴うPerlインタプリタをクローンするオーバーヘッドよりも それほど大きくならない(そして時には大幅に減じる)ことが明らかである。 =head1 作者 Elizabeth Mattijsen, . Please report bugs to . =head1 著作権 Copyright (c) 2002-2003 Elizabeth Mattijsen . All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 参考 L, L, L, L.