perldelta - perl v5.9.4 更新情報
perldelta - what is new for perl v5.9.4

目次 TABLE OF CONTENTS


名前 NAME

perldelta - perl v5.9.4 更新情報 perldelta - what is new for perl v5.9.4


説明 DESCRIPTION

このドキュメントでは開発リリース 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.


互換性の無い変更点 Incompatible Changes

chdir FOO

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)

pmc ファイルの処理 Handling of pmc files

perl の古い機能で, requireuse が拡張子 .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.)

パターンでの @- 及び @+ @- and @+ in patterns

特殊配列 @- 及び @+ は正規表現の中に住み着かなくなりました. (Sadahiro Tomoyuki) The special arrays @- and @+ are no longer interpolated in regular expressions. (Sadahiro Tomoyuki)

$AUTOLOAD も taint が作用するようになります $AUTOLOAD can now be tainted

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)


コアの強化 Core Enhancements

state() 変数 state() variables

新しい変数の種類が導入されました. 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()

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].

定数畳み込み時の例外 Exceptions in constant folding

定数畳み込みルーチンは例外ハンドラに包まれるようになりました, そしてもし畳み込み時に例外が発生した場合には(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 でのソースフィルタ Source filters in @INC

ソースフィルタをフックで開かれて返されたファイルハンドルの 先頭に加えることで @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

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)


モジュールとプラグマ Modules and Pragmas

新しいコアモジュール New Core Modules


ユーティリティの変更点 Utility Changes

config_data

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.)


ドキュメント Documentation

新しいマニュアルページ, perlpragma New manpage, perlpragma

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 New manpage, perlreguts

perlreguts [CPAN] マニュアルページ, Yves Orton の作法, は Perl 正規表現エンジンの内部を説明しています. The perlreguts [CPAN] manpage, courtesy of Yves Orton, describes internals of the Perl regular expression engine.

新しいマニュアルページ, perlunitut New manpage, perlunitut

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.


パフォーマンス強化 Performance Enhancements

メモリの最適化 Memory optimisations

いくつかの内部データ構造 (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 キャッシュの最適化 UTF-8 cache optimisation

UTF-8 キャッシュコードはより効率的に, そしてより多く 使われるようになりました. (Nicholas Clark) The UTF-8 caching code is now more efficient, and used more often. (Nicholas Clark)

正規表現 Regular expressions

再帰展開エンジン Engine de-recursivised

正規表現エンジンは再帰しなくなりました, これはスタックを あふれさせるようなパターンはわかりやすい説明を出して 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文字の文字クラスはリテラルとして扱わるようになります Single char char-classes treated as literals

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)

リテラル文字列選択のトライ(Trie)最適化 Trie optimisation of literal string alternations

選択(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 法による開始位置の最適化 Aho-Corasick start-point optimisation

パターンがトライ化可能な選択で始まっていてよりよい最適化が なかった場合に正規表現エンジンは開始位置を探すために 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 によるルーズな stat Sloppy stat on Windows

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 の向上 Installation and Configuration Improvements

再配置可能なインストール Relocatable installations

新しい 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.

プラットフォーム別 Ports

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.

コンパイルの向上 Compilation improvements

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)

新しいチェック New probes

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)

Windows ビルドの向上 Windows build improvements

XS 拡張のビルド Building XS extensions

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)

64-bit コンパイラのサポート Support for 64-bit compiler

Microsoft の 64-bit コンパイラでのビルドのサポートが 向上しました. (ActiveState) Support for building perl with Microsoft's 64-bit compiler has been improved. (ActiveState)


バグ修正抜粋 Selected Bug Fixes

PERL5SHELL と taint PERL5SHELL and tainting

Windows において, PERL5SHELL 環境変数は taint 性を確認されるように なりました. (Rafael Garcia-Suarez) On Windows, the PERL5SHELL environment variable is now checked for taintedness. (Rafael Garcia-Suarez)

*FILE{IO} の使用 Using *FILE{IO}

stat() 及び -X ファイルテストは *FILE ファイルハンドルの ように *FILE{IO} ファイルハンドルを扱うようになりました. stat() and -X filetests now treat *FILE{IO} filehandles like *FILE filehandles. (Steve Peters)

オーバーロードと再bless Overloading and reblessing

リファレンスが他のクラスへと再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 Overloading and UTF-8

文字列化をオーバーロードしているオブジェクトでの UTF-8 処理に 関連したいくつかのバグが修正されました. (Nicholas Clark) A few bugs related to UTF-8 handling with objects that have stringification overloaded have been fixed. (Nicholas Clark)

eval メモリリークの修正 eval memory leaks fixed

以前より, 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)

Windows でのランダムデバイス Random device on Windows

これまでのバージョンではランダム生成の種を作るときに /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)


新しい及び変更された診断メッセージ New or Changed Diagnostics

State variable %s will be reinitialized

『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].


変更された内部処理 Changed Internals

新しいファイル, 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.


既知の問題 Known Problems

警告テストの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.


バグの報告方法 Reporting Bugs

もしバグと思われるものが見つかったら, 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.


関連項目 SEE ALSO

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.


和訳 TRANSALTE TO JAPANESE

 山科 氷魚 (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.

perldelta - perl v5.9.4 更新情報
perldelta - what is new for perl v5.9.4

索引 INDEX

perldelta - perl v5.9.4 更新情報
perldelta - what is new for perl v5.9.4