目次 TABLE OF CONTENTS
perldelta - perl v5.9.4 更新情報 perldelta - what is new for perl v5.9.4
このドキュメントでは開発リリース 5.9.3 と 5.9.4 の間での変更点を 説明します. 5.8.0 から 5.9.3 までの変更点は perl590delta [CPAN], perl591delta [CPAN], perl592delta [CPAN] そして perl593delta [CPAN] を 参照してください. This document describes differences between the 5.9.3 and the 5.9.4 development releases. See perl590delta [CPAN], perl591delta [CPAN], perl592delta [CPAN] and perl593delta [CPAN] for the differences between 5.8.0 and 5.9.3.
chdir() の裸の単語(bareword)引数はファイルハンドルとして 処理されるようになりました. これまでのリリースではbarewordは ディレクトリ名として処理されていました. A bareword argument to chdir() is now recognized as a file handle. Earlier releases interpreted the bareword as a directory name. (Gisle Aas)
perl の古い機能で, require や use が拡張子 .pm をもつ
ファイルを探す前に同じファイル名で拡張子 .pmc を持つファイルを
先に探していました. このファイルが見つかった時は .pm 拡張子で
終わるファイルの存在の代わりにロードされます.
An old feature of perl was that before require or use look for a
file with a .pm extension, they will first look for a similar filename
with a .pmc extension. If this file is found, it will be loaded in
place of any potentially existing file ending in a .pm extension.
これまでは, .pmc ファイルは .pm とり新しい場合にだけ ロードされました. 5.9.4 からはそれが存在する時は常にロード されるようになりました. (このトリックは Pugs で使われて います. ) Previously, .pmc files were loaded only if more recent than the matching .pm file. Starting with 5.9.4, they'll be always loaded if they exist. (This trick is used by Pugs.)
特殊配列 @- 及び @+ は正規表現の中に住み着かなくなりました.
(Sadahiro Tomoyuki)
The special arrays @- and @+ are no longer interpolated in regular
expressions. (Sadahiro Tomoyuki)
taint されている名前で関数を呼び出して, それが AUTOLOAD 関数を 呼び出したとき, $AUTOLOAD は(正しく) taint されるようになりました. (Rick Delaney) If you call a subroutine by a tainted name, and if it defers to an AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted. (Rick Delaney)
新しい変数の種類が導入されました. state 変数は my 変数と
似ていますが, my の代わりに state キーワードで宣言されます.
これはそのレキシカルスコープでのみ可視になりますが,
その値は永続します: my 変数とは異なりスコープに入ったときには
未定義ではなく, 以前の値を復元します. (Rafael Garcia-Suarez)
A new class of variables has been introduced. State variables are similar
to my variables, but are declared with the state keyword in place of
my. They're visible only in their lexical scope, but their value is
persistent: unlike my variables, they're not undefined at scope entry,
but retain their previous value. (Rafael Garcia-Suarez)
state 変数を使うには次のコード To use state variables, one needs to enable them by using
use feature "state";
かワンライナであれば -E コマンドラインスイッチで有効にする
必要があります.
or by using the -E command-line switch in one-liners.
perlsub 内 "Persistent variables via state()" [CPAN] を参照してください. See "Persistent variables via state()" in perlsub [CPAN].
UNIVERSAL クラスに新しいメソッド DOES() が追加されました.
これは isa() メソッドの抱えていた意味的な問題を解決するために
追加されていました. isa() は継承関係を調べますが, DOES() は
モジュールの作者が(継承に加えて)それ以外の種類のクラス間の関係を
オーバーライドすることができるように設計されています. (chromatic)
The UNIVERSAL class has a new method, DOES(). It has been added to
solve semantic problems with the isa() method. isa() checks for
inheritance, while DOES() has been designed to be overridden when
module authors use other types of relations between classes (in addition
to inheritance). (chromatic)
UNIVERSAL 内 "$obj->DOES( ROLE )" [CPAN] を参照してください. See "$obj->DOES( ROLE )" in UNIVERSAL [CPAN].
定数畳み込みルーチンは例外ハンドラに包まれるようになりました, そしてもし畳み込み時に例外が発生した場合には(0/0 を評価した等), perl プログラム全体をアボートするのではなくその時点の optree を 維持します. (Nicholas Clark, Dave Mitchell) The constant folding routine is now wrapped in an exception handler, and if folding throws an exception (such as attempting to evaluate 0/0), perl now retains the current optree, rather than aborting the whole program. (Nicholas Clark, Dave Mitchell)
ソースフィルタをフックで開かれて返されたファイルハンドルの 先頭に加えることで @INC での関数によるフックメカニズムを 拡張することが可能です. この機能はずいぶん前から計画されて いましたが, これまで全然手をつけられていませんでした. 詳細は perlfunc 内 "require" [CPAN] を参照してください. (Nicholas Clark) It's possible to enhance the mechanism of subroutine hooks in @INC by adding a source filter on top of the filehandle opened and returned by the hook. This feature was planned a long time ago, but wasn't quite working until now. See "require" in perlfunc [CPAN] for details. (Nicholas Clark)
MAD, いろいろな属性修飾 (Misc Attribute Decoration), は
Perl 5 から Perl 6 へのコンバータへと至る作業の開発段階に
あります. これを有効にするには Configure 引数に -Dmad 引数
を渡す必要があります. これによって作られる perl はふつうに作られた
perl 5.9.4 とはバイナリ互換がなく, また, 空間, 速度にペナルティを
もちます; さらにはまだ全てのレグレッションテストには通過していま
せん. (Larry Wall, Nicholas Clark)
MAD, which stands for Misc Attribute Decoration, is a
still-in-development work leading to a Perl 5 to Perl 6 converter. To
enable it, it's necessary to pass the argument -Dmad to Configure. The
obtained perl isn't binary compatible with a regular perl 5.9.4, and has
space and speed penalties; moreover not all regression tests still pass
with it. (Larry Wall, Nicholas Clark)
encoding::warnings はレキシカルプラグマになりました.
(しかしレキシカルプラグマをサポートしていない古い perl では
グローバルな振る舞いのままです.) (Audrey Tang)
encoding::warnings is now a lexical pragma. (Although on older perls,
which don't have support for lexical pragmas, it keeps its global
behaviour.) (Audrey Tang)
threads はデュアルライフなモジュールになり, CPAN からも
提供されるようになりました. これはいくつかの方法で拡張されて
います. スレッドに対してシグナルを送る kill() メソッドが提供
されるようになりました. スレッドのステータスや実行されている,
若しくは join 可能なスレッドの一覧を取得できるようになりました.
threads is now a dual-life module, also available on CPAN. It has been
expanded in many ways. A kill() method is available for thread signalling.
One can get thread status, or the list of running or joinable threads.
新しい threads->exit() メソッドはアプリケーションから exit
するためや(これは main スレッドのデフォルトです), 現在のスレッド
のみから exit するため(これはそれ以外のスレッドのデフォルトです)に
使うことができます. 言い換えると, exit() 組み込み関数は常に
アプリケーション全体を終了させます. (Jerry D. Hedden)
A new threads->exit() method is used to exit from the application
(this is the default for the main thread) or from the current thread only
(this is the default for all other threads). On the other hand, the exit()
built-in now always causes the whole application to terminate. (Jerry
D. Hedden)
Anno Siegel による Hash::Util::FieldHash が追加されました.
このモジュールは field hash のサポートを提供します:
これはスレッドセーフでガーベジコレクトされる形で,
リファレンスの値との関係を保持します.
Hash::Util::FieldHash, by Anno Siegel, has been added. This module
provides support for field hashes: hashes that maintain an association
of a reference with a value, in a thread-safe garbage-collected way.
Ken Williams による Module::Build が追加されました.
これは perl モジュールをビルド及びインストールするための
ExtUtils::MakeMaker の代替です.
Module::Build, by Ken Williams, has been added. It's an alternative to
ExtUtils::MakeMaker to build and install perl modules.
Jos Boumans による Module::Load が追加されました. これは
Perl モジュールと .pl ファイルをロードする単一のインターフェース
を提供します.
Module::Load, by Jos Boumans, has been added. It provides a single
interface to load Perl modules and .pl files.
Jos Boumans による Module::Loaded が追加されました. これは
モジュールがロードされているかいないかを調べるのに役立ちます.
Module::Loaded, by Jos Boumans, has been added. It's used to mark
modules as loaded or unloaded.
Jos Boumans による Package::Constants が追加されました.
これは指定されたパッケージで宣言されている全ての定数をリストアップ
する簡単なヘルパーです.
Package::Constants, by Jos Boumans, has been added. It's a simple
helper to list all constants declared in a given package.
McQueen による Win32API::File が(Windows ビルドに)追加されました.
このモジュールはファイル/ディレクトリに対する Win32 システム API
呼び出しへの低レベルなアクセスを提供します.
Win32API::File, by Tye McQueen, has been added (for Windows builds).
This module provides low-level access to Win32 system API calls for
files/dirs.
Module::Build から config_data ユーティリティが新しく
加わりました. これは configure 可能な Module::Build のフレーム
ワークを使っている Perl モジュール(つまり, 親モジュールに対する
ローカルな設定情報を含んでいる *::ConfigData モジュール)の
設定をするためのコマンドラインインターフェースを提供します.
config_data is a new utility that comes with Module::Build. It
provides a command-line interface to the configuration of Perl modules
that use Module::Build's framework of configurability (that is,
*::ConfigData modules that contain local configuration information for
their parent modules.)
perlpragma [CPAN] マニュアルページは自分のレキシカルなプラグマを pure Perl でどうやって書くかを説明しています(5.9.4 から可能です). The perlpragma [CPAN] manpage documents how to write one's own lexical pragmas in pure Perl (something that is possible starting with 5.9.4).
perlreguts [CPAN] マニュアルページ, Yves Orton の作法, は Perl 正規表現エンジンの内部を説明しています. The perlreguts [CPAN] manpage, courtesy of Yves Orton, describes internals of the Perl regular expression engine.
perlunitut [CPAN] マニュアルページは Perl での Unicode 及び 文字列縁故ーでゅイングを使ったプログラム方法のチュートリアルで, Juerd Waalboer の作法です. The perlunitut [CPAN] manpage is an tutorial for programming with Unicode and string encodings in Perl, courtesy of Juerd Waalboer.
いくつかの内部データ構造 (typeglobs, GV, CV, format)は よりメモリ消費の少ない構造に再設計されました. (Nicholas Clark) Several internal data structures (typeglobs, GVs, CVs, formats) have been restructured to use less memory. (Nicholas Clark)
UTF-8 キャッシュコードはより効率的に, そしてより多く 使われるようになりました. (Nicholas Clark) The UTF-8 caching code is now more efficient, and used more often. (Nicholas Clark)
正規表現エンジンは再帰しなくなりました, これはスタックを あふれさせるようなパターンはわかりやすい説明を出して die するか, スタックを前もって吹き飛ばすことができても終了までにとても 長い時間がかかります. もし不定期なスタックオーバーフロー(もしくは segfault)が起こるのであればハングする代わりに生成を分離した 正規表現を見つける perl を見つけ出すためにアップグレードして ください. The regular expression engine is no longer recursive, meaning that patterns that used to overflow the stack will either die with useful explanations, or run to completion, which, since they were able to blow the stack before, will likely take a very long time to happen. If you were experiencing the occasional stack overflow (or segfault) and upgrade to discover that now perl apparently hangs instead, look for a degenerate regex. (Dave Mitchell)
1文字からなるクラスはリテラルとして使われている文字と同一に 扱われるようになりました, これは文字クラスをエスケープとして使っている コードのスピードアップを意味します. (Yves Orton) Classes of a single character are now treated the same as if the character had been used as a literal, meaning that code that uses char-classes as an escaping mechanism will see a speedup. (Yves Orton)
選択(Alternations; "|")は, 可能であればより効率的なマッチング 構造へと最適化されるようになりました. 文字列リテラルの選択は トライへとマージされ, 同時にマッチが行われるようになります. これはある場所で N 個の選択マッチがあった場合に O(N) ではなく 新しいコードでは O(1) で処理されるようになります. (Yves Orton) Alternations, where possible, are optimised into more efficient matching structures. String literal alternations are merged into a trie and are matched simultaneously. This means that instead of O(N) time for matching N alternations at a given point the new code performs in O(1) time. (Yves Orton)
捕捉: perl の歴史的な貧弱な選択パフォーマンスに関連する多くの コードが残っています. それの為にしばしば使われているトリックは 新しい最適化では無効になります. 幸運にもこの目的で使われている ユーティリティモジュールは 5.10 がリリースされるまでこの 新しい最適化についての教育を受けるでしょう. Note: Much code exists that works around perl's historic poor performance on alternations. Often the tricks used to do so will disable the new optimisations. Hopefully the utility modules used for this purpose will be educated about these new optimisations by the time 5.10 is released.
パターンがトライ化可能な選択で始まっていてよりよい最適化が なかった場合に正規表現エンジンは開始位置を探すために Aho-Corasick マッチを使います. (Yves Orton) When a pattern starts with a trie-able alternation and there aren't better optimisations available the regex engine will use Aho-Corasick matching to find the start point. (Yves Orton)
Windows において, perl の stat() 関数は通常リンク回数を 決定してハードリンクを通して変更されたかもしれない属性を更新するために ファイルを開きます. ${^WIN32_SLOPPY_STAT} に真を設定すると この処理を行わなくなり stat() の速度が向上します. On Windows, perl's stat() function normally opens the file to determine the link count and update attributes that may have been changed through hard links. Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up stat() by not performing this operation. (Jan Dubois)
新しい Configure で再配置可能な perl ツリーの生成がサポート
されました. Configure に -Duserelocatableinc を指定することで
@INC (及び %Config にあるそれ以外の全て)は perl 実行形式の
パスからその位置を選択可能になりました.
There is now Configure support for creating a relocatable perl tree. If
you Configure with -Duserelocatableinc, then the paths in @INC (and
everything else in %Config) can be optionally located via the path of the
perl executable.
これはパスの始まりに文字列 ".../" が見つかると, それは $^X の
ディレクトリで置き換えられるということです. これによって,
-Duserelocatableinc によるデフォルトでは全てが再配置されますが,
再配置はディレクトリベースで行われます. 最初のインストールは最初に
configure で行った prefix へと行われます.
That means that, if the string ".../" is found at the start of any
path, it's substituted with the directory of $^X. So, the relocation can
be configured on a per-directory basis, although the default with
-Duserelocatableinc is that everything is relocated. The initial
install is done to the original configured prefix.
z/OS で正しく動作する Perl を作るために多くの向上が行われ ました. Many improvements have been made towards making Perl work correctly on z/OS.
Perl は DragonFlyBSD での動作が報告されました. Perl has been reported to work on DragonFlyBSD.
perl とバンドルされている XS モジュールにある全ての ppport.h ファイルはビルド時に生成されるようになりました. (Marcus Holland-Moritz) All ppport.h files in the XS modules bundled with perl are now autogenerated at build time. (Marcus Holland-Moritz)
configure プロセスで strlcat() 及び strlcpy() が提供されているか を検出するようになりました. これらが提供されていなかった場合には perl の独自版が使われます(Russ Allbery によるパブリックドメイン実装). perl インタプリタの様々な場所でこれらを使うようになりました. (Steve Peters) The configuration process now detects whether strlcat() and strlcpy() are available. When they are not available, perl's own version is used (from Russ Allbery's public domain implementation). Various places in the perl interpreter now use them. (Steve Peters)
Perl 自身が Microsoft VC++ コンパイラでビルドされていた場合の MinGW コンパイラによる XS 拡張モジュールのビルドサポートが向上されました. (ActiveState) Support for building XS extension modules with the free MinGW compiler has been improved in the case where perl itself was built with the Microsoft VC++ compiler. (ActiveState)
Microsoft の 64-bit コンパイラでのビルドのサポートが 向上しました. (ActiveState) Support for building perl with Microsoft's 64-bit compiler has been improved. (ActiveState)
Windows において, PERL5SHELL 環境変数は taint 性を確認されるように なりました. (Rafael Garcia-Suarez) On Windows, the PERL5SHELL environment variable is now checked for taintedness. (Rafael Garcia-Suarez)
stat() 及び -X ファイルテストは *FILE ファイルハンドルの
ように *FILE{IO} ファイルハンドルを扱うようになりました.
stat() and -X filetests now treat *FILE{IO} filehandles like *FILE
filehandles. (Steve Peters)
リファレンスが他のクラスへと再blessされてもオーバーロードは 動作するようになりました. 内部的にはこれは"オーバーロードされている" というフラグがリファレンスから論理的に常に存在しているべき場所である その参照先へと移動することで実装されています. (Nicholas Clark) Overloading now works when references are reblessed into another class. Internally, this has been implemented by moving the flag for "overloading" from the reference to the referent, which logically is where it should always have been. (Nicholas Clark)
文字列化をオーバーロードしているオブジェクトでの UTF-8 処理に 関連したいくつかのバグが修正されました. (Nicholas Clark) A few bugs related to UTF-8 handling with objects that have stringification overloaded have been fixed. (Nicholas Clark)
以前より, eval 'syntax error' は悪いことにリークを起こしていました.
いくつかの(けど全てではない)これらのリークは削除若しくは削減されました.
(Dave Mitchell)
Traditionally, eval 'syntax error' has leaked badly. Many (but not all)
of these leaks have now been eliminated or reduced. (Dave Mitchell)
これまでのバージョンではランダム生成の種を作るときに /dev/urandom が存在すればそこから読んでいました. このファイルが Windows で 間の悪いことに存在していても適切なデータを持っていないため, Windows ではこのファイルからは読まないようになりました. (Alex Davies) In previous versions, perl would read the file /dev/urandom if it existed when seeding its random number generator. That file is unlikely to exist on Windows, and if it did would probably not contain appropriate data, so perl no longer tries to read it on Windows. (Alex Davies)
『state変数 %s は再初期化されます』 state 変数に初期値を割り当てることはできますが, それはリスト代入の 一部として宣言されていないときです. perldiag [CPAN] を参照してください. One can assign initial values to state variables, but not when they're declared as a sub-part of a list assignment. See perldiag [CPAN].
新しいファイル, mathoms.c には perl コアではもう使われていない 関数を含んでいます, これらは他のモジュールで使っているかもしれないため 保持はしています. これらは因数分解の努力からきています: 例えば多くの PP 関数はいくつかの ops で共有されています. A new file, mathoms.c, contains functions that aren't used anymore in the perl core, but remain around because modules out there might still use them. They come from a factorization effort: for example, many PP functions are now shared for several ops.
特殊変数 $^H 及び %^H の実装は pure perl でレキシカル プラグマを実装できるようにするために変更されました. The implementation of the special variables $^H and %^H has changed, to allow implementing lexical pragmas in pure perl.
警告テストの1つ (lib/warnings.t の 263 番)は UTF-8 ロケール で失敗します. One warning test (number 263 in lib/warnings.t) fails under UTF-8 locales.
いくつかのプラットフォームで Bytecode テストは失敗します. 私たちは 5.10.0 のリリースの前に byteloader と compiler の サポートを外すことを考えています. Bytecode tests fail under several platforms. We are considering removing support for byteloader and compiler before the 5.10.0 release.
もしバグと思われるものが見つかったら, comp.lang.perl.misc ニュース グループに最近投稿された記事や http://rt.perl.org/rt3/ にある perl バグデータベースを確認してください. Perl ホームページ, http://www.perl.org にも情報はあります. If you find what you think is a bug, you might check the articles recently posted to the comp.lang.perl.misc newsgroup and the perl bug database at http://rt.perl.org/rt3/ . There may also be information at http://www.perl.org/ , the Perl Home Page.
もしまだ報告されていないバグだと確信したら, そのリリースに含まれている
perlbug プログラムをを実行してください. バグの再現スクリプトを
十分小さく, しかし有効なコードに切りつめることを意識してください.
バグレポートは perl -V の出力と一緒に perlbug@perl.org に送られ
Perl porting チームによって解析されます.
If you believe you have an unreported bug, please run the perlbug
program included with your release. Be sure to trim your bug down
to a tiny but sufficient test case. Your bug report, along with the
output of perl -V, will be sent off to perlbug@perl.org to be
analysed by the Perl porting team.
Changes には完全な変更箇所があります. The Changes file for exhaustive details on what changed.
INSTALL には Perl をビルドする方法があります. The INSTALL file for how to build Perl.
README には一般的な事項があります. The README file for general stuff.
Artistic 及び Copying には著作権情報があります. The Artistic and Copying files for copyright information.
山科 氷魚 (YAMASHINA Hio) <hio@hio.jp>
原典: perl VERSION 5.9.4. 翻訳日: 2007-03-21. Origlnal distribution is perl VERSION 5.9.4. Translated at 2007-03-21.