perldelta - perl 5.10.0 の新機能
perldelta - what is new for perl 5.10.0

目次 TABLE OF CONTENTS


名前 NAME

perldelta - perl 5.10.0 の新機能 perldelta - what is new for perl 5.10.0


説明 DESCRIPTION

このドキュメントでは 5.8.8 リリースと 5.10.0 リリースとでの相異点を 説明します. This document describes the differences between the 5.8.8 release and the 5.10.0 release.

5.10.0 でのバグ修正の多くは既に 5.8.X メンテナンスリリースで見ることができます; それらはここには重複しないで, perl58[1-8]?delta の マニュアルページ群に記載しています. Many of the bug fixes in 5.10.0 were already seen in the 5.8.X maintenance releases; they are not duplicated here and are documented in the set of man pages named perl58[1-8]?delta.


コアの機能拡張 Core Enhancements

feature プラグマ The feature pragma

feature プラグマは Perl のこれまでのリリースとの 後方互換性がなくなってしまう新しい構文を有効にするために 使われます. これは strictwarnings と同様 レキシカルなプラグマです. The feature pragma is used to enable new syntax that would break Perl's backwards-compatibility with older releases of the language. It's a lexical pragma, like strict or warnings.

現在, 以下の新しい機能が提供されています: switch (switch 文を追加), say (say 組み込み関数を追加), そして state ("静的な"変数を宣言するためのstate キーワードを追加). これらの機能はこのドキュメントのそれぞれのセクションに 記述されています. Currently the following new features are available: switch (adds a switch statement), say (adds a say built-in function), and state (adds a state keyword for declaring "static" variables). Those features are described in their own sections of this document.

feature プラグマは必要な perl のバージョンを 5.9.5 以降で (use VERSION構成子を使って) 要求したときにも 暗黙にロードされます. 詳細は feature を参照してください. The feature pragma is also implicitly loaded when you require a minimal perl version (with the use VERSION construct) greater than, or equal to, 5.9.5. See feature for details.

新しい -E コマンドラインスイッチ New -E command-line switch

-E-e と等価ですが, 暗黙にすべての追加できる feature を 有効にします(use feature ":5.10" のように). -E is equivalent to -e, but it implicitly enables all optional features (like use feature ":5.10").

Defined-or 演算子 Defined-or operator

新しい演算子 // (defined-or) が実装されました. 次の式: A new operator // (defined-or) has been implemented. The following expression:

    $a // $b

単純に次の式と等価です, is merely equivalent to

   defined $a ? $a : $b

そして次の文 and the statement

   $c //= $d;

は, 以下の代わりに使うことができます. can now be used instead of

   $c = $d unless defined $c;

// 演算子は || と同じ優先順位及び 結合性を持ちます. この演算子が古いコードを壊さずに貴方の意図通りのことを行うことを保証するように 特別注意を払っていますが, 幾つかの空の正規表現を呼び出すエッジケースでは 異なったパースをしてしまうこともあります. 詳細は perlop を参照してください. The // operator has the same precedence and associativity as ||. Special care has been taken to ensure that this operator Do What You Mean while not breaking old code, but some edge cases involving the empty regular expression may now parse differently. See perlop for details.

switch 及びスマートマッチ演算子 Switch and Smart Match operator

Perl 5 にも switch 文が実装されました. use feature 'switch' の影響下で利用することが できます. この機能は3つの新しいキーワード, given, when, 及び default を導入します: Perl 5 now has a switch statement. It's available when use feature 'switch' is in effect. This feature introduces three new keywords, given, when, and default:

    given ($foo) {
	when (/^abc/) { $abc = 1; }
	when (/^def/) { $def = 1; }
	when (/^xyz/) { $xyz = 1; }
	default { $nothing = 1; }
    }

Perl が switch 変数をどのように when 条件に マッチさせるかのより詳細な説明は, perlsyn 内 "Switch statements" にあります. A more complete description of how Perl matches the switch variable against the when conditions is given in "Switch statements" in perlsyn.

この種類のマッチは スマートマッチ と呼ばれ, これは switch 文以外でも新しい ~~ 演算子で使うことが できます. perlsyn 内 "Smart matching in detail" を参照してください. This kind of match is called smart match, and it's also possible to use it outside of switch statements, via the new ~~ operator. See "Smart matching in detail" in perlsyn.

この機能は Robin Houston より寄稿されました. This feature was contributed by Robin Houston.

正規表現 Regular expressions

再帰するパターン Recursive Patterns

再帰するパターンを (??{}) を使うことなく 記述できるようになりました. この新しい方法はより効率的で, 多くの場合可読性にも 優れています. It is now possible to write recursive patterns without using the (??{}) construct. This new way is more efficient, and in many cases easier to read.

それぞれのキャプチャ括弧は, (?PARNO) 構文を使って突入できる 独立したパターンとして扱われます (PARNO は "parenthesis number (括弧番号)" を 表します). 例えば, 以下のパターンはネストしたバランスのとれた角括弧にマッチします: Each capturing parenthesis can now be treated as an independent pattern that can be entered by using the (?PARNO) syntax (PARNO standing for "parenthesis number"). For example, the following pattern will match nested balanced angle brackets:

    /
     ^                      # start of line
     (                      # start capture buffer 1
	<                   #   match an opening angle bracket
	(?:                 #   match one of:
	    (?>             #     don't backtrack over the inside of this group
		[^<>]+      #       one or more non angle brackets
	    )               #     end non backtracking group
	|                   #     ... or ...
	    (?1)            #     recurse to bracket 1 and try it again
	)*                  #   0 or more times.
	>                   #   match a closing angle bracket
     )                      # end capture buffer one
     $                      # end of line
    /x

PCRE ユーザは, PCRE の再帰はアトミック若しくは自然に "強欲"ですが, Perl の再帰正規表現の機能は 再帰されたパターンの中へのバックトラックを許している という点に気をつけてください. 上に書いた例のように, この振る舞いを選んで使いたいときには (?>) を 加えることで制御できます. PCRE users should note that Perl's recursive regex feature allows backtracking into a recursed pattern, whereas in PCRE the recursion is atomic or "possessive" in nature. As in the example above, you can add (?>) to control this selectively. (Yves Orton)

名前付きキャプチャバッファ Named Capture Buffers

パターンにおいて名前付きのキャプチャ括弧と キャプチャされた内容への名前による参照ができるように なりました. 名前をつける構文は (?<NAME>....) です. 名前をつけたバッファへの後方参照は \k<NAME> 構文によって 行えます. コード中では, キャプチャされたバッファの内容に アクセスするために新しいマジカルハッシュ %+ 及び %- が使えるようになります. It is now possible to name capturing parenthesis in a pattern and refer to the captured contents by name. The naming syntax is (?<NAME>....). It's possible to backreference to a named buffer with the \k<NAME> syntax. In code, the new magical hashes %+ and %- can be used to access the contents of the capture buffers.

これによって, すべての連続する文字を1文字に置き換えるのに次のように 書くことができます Thus, to replace all doubled chars with a single copy, one could write

    s/(?<letter>.)\k<letter>/$+{letter}/g

%+ ハッシュには内容の決定したバッファのみが "見える"ようになるので, 次のようにすることができます Only buffers with defined contents will be "visible" in the %+ hash, so it's possible to do something like

    foreach my $name (keys %+) {
        print "content of buffer '$name' is $+{$name}\n";
    }

%- ハッシュはもう少し複雑です, これには名前のついているすべてのキャプチャバッファの 値を複数あったとしても保持している配列リファレンスを含んでいます. The %- hash is a bit more complete, since it will contain array refs holding values from all capture buffers similarly named, if there should be many of them.

%+ 及び %- は新しいモジュール Tie::Hash::NamedCapture に tie されたハッシュとして 実装されています. %+ and %- are implemented as tied hashes through the new module Tie::Hash::NamedCapture.

.NET 正規表現にさられてきたユーザは, perl の実装が "まずは名前なし, それから名前付き"ではなく 順番になっていることに気付くでしょう. 従って次のパターンにおいて Users exposed to the .NET regex engine will find that the perl implementation differs in that the numerical ordering of the buffers is sequential, and not "unnamed first, then named". Thus in the pattern

   /(A)(?<B>B)(C)(?<D>D)/

$1 は 'A', $2 は 'B', $3 は 'C' そして $4 は 'D' になり, .NET プログラマが予期したような $1 が 'A', $2 が 'C' そして $3 が 'B' そして $4 が 'D' にはなりません. これは仕様と考えています. :-) (Yves Orton) $1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not $1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer would expect. This is considered a feature. :-) (Yves Orton)

強欲な量指定子 Possessive Quantifiers

Perl は "アトミックマッチ"パターンの "強欲な量指定子"構文をサポートしました. 基本的に強欲な量指定子は可能なだけ多くにマッチし, そして後退しません. 従ってこれはバックトラックの制御に 使うことができます. その構文は貪欲でないマッチと似ていますが, 修飾子として '?' の代わりに '+' を使います. 従って, ?+, *+, ++, {min,max}+ は正しい 量指定子になります. (Yves Orton) Perl now supports the "possessive quantifier" syntax of the "atomic match" pattern. Basically a possessive quantifier matches as much as it can and never gives any back. Thus it can be used to control backtracking. The syntax is similar to non-greedy matching, except instead of using a '?' as the modifier the '+' is used. Thus ?+, *+, ++, {min,max}+ are now legal quantifiers. (Yves Orton)

バックトラック制御記号 Backtracking control verbs

正規表現エンジンはいくつかの特殊な目的のための バックトラック制御記号をサポートします: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL) 及び (*ACCEPT). これらの説明は perlre を 参照してください. (Yves Orton) The regex engine now supports a number of special-purpose backtrack control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL) and (*ACCEPT). See perlre for their descriptions. (Yves Orton)

相対後方参照 Relative backreferences

新しい構文 \g{N} 若しくは \gN ("N" は10進整数) によって相対的な後方参照と同様の安全な形式での 後方参照ができるようになりました. これによって後方参照を含んだ パターンの生成がより簡単に行えるようになります. perlre 内 "Capture buffers" を参照してください. (Yves Orton) A new syntax \g{N} or \gN where "N" is a decimal integer allows a safer form of back-reference notation as well as allowing relative backreferences. This should make it easier to generate and embed patterns that contain backreferences. See "Capture buffers" in perlre. (Yves Orton)

\K エスケープ \K escape

Jeff Pinyan によるモジュール Regexp::Keep の機能が コアに追加されました. これによって正規表現内で 可変長の正の後読みの言明のようなものとして 特殊なエスケープ \K を使うことができます. これは次のような置換で便利です: The functionality of Jeff Pinyan's module Regexp::Keep has been added to the core. In regular expressions you can now use the special escape \K as a way to do something like floating length positive lookbehind. It is also useful in substitutions like:

  s/(foo)bar/$1/g

これは次のように書き換えることができ that can now be converted to

  s/foo\Kbar//g

これはより効率的です. (Yves Orton) which is much more efficient. (Yves Orton)

垂直及び水平白空白, 及び行区切り Vertical and horizontal whitespace, and linebreak

正規表現は \v 及び \h エスケープを認識するようになりました, これらはそれぞれ垂直及び水平白空白にマッチします. \V 及び \H はその補集合に論理的にマッチします. Regular expressions now recognize the \v and \h escapes that match vertical and horizontal whitespace, respectively. \V and \H logically match their complements.

\R は一般的な行区切りにマッチします, つまり, 垂直白空白, それと複数文字のシーケンス "\x0D\x0A" です. \R matches a generic linebreak, that is, vertical whitespace, plus the multi-character sequence "\x0D\x0A".

say()

say() は新しい組み込み関数で, これは use feature 'say' の 影響下でのみ提供され, print() とにていますが 出力される文字列に改行を暗黙に追加します. perlfunc 内 "say" を参照してください. (Robin Houston) say() is a new built-in, only available when use feature 'say' is in effect, that is similar to print(), but that implicitly appends a newline to the printed string. See "say" in perlfunc. (Robin Houston)

レキシカルな $_ Lexical $_

デフォルト変数 $_ を他のレキシカル変数と同じように 次のように宣言することでレキシカルにできるようになりました The default variable $_ can now be lexicalized, by declaring it like any other lexical variable, with a simple

    my $_;

デフォルトで $_ を使う演算子はレキシカルな $_ があれば, グローバルな $_ の代わりに それを使うようになります. The operations that default on $_ will use the lexically-scoped version of $_ when it exists, instead of the global $_.

map 若しくは grep ブロックでは, $_ が先に my されていたら内側のブロックでも 同じようにレキシカルです(そしてそのブロックのスコープです). In a map or a grep block, if $_ was previously my'ed, then the $_ inside the block is lexical as well (and scoped to the block).

$_ がレキシカル化されたスコープでは, $::_ によって, 若しくは, より簡単に, our $_ で レキシカル宣言を上書きすることで グローバル版の $_ に アクセスすることができます. (Rafael Garcia-Suarez) In a scope where $_ has been lexicalized, you can still have access to the global version of $_ by using $::_, or, more simply, by overriding the lexical declaration with our $_. (Rafael Garcia-Suarez)

_ プロトタイプ The _ prototype

新しいプロトタイプ文字が追加されました. _$ と等価ですが, 対応する引数が渡されなかったときに デフォルトで $_ をとるようになります. ($_ も共にスカラーを意味します.) 省略可能な引数として, これはプロトタイプの最後か, セミコロンの前でのみ使うことができます. A new prototype character has been added. _ is equivalent to $ but defaults to $_ if the corresponding argument isn't supplied. (both $ and _ denote a scalar). Due to the optional nature of the argument, you can only use it at the end of a prototype, or before a semicolon.

これは小さな非互換を生じます: prototype() 関数はいくつかの適応する組み込み関数で _ を返すようになります(例えば prototype('CORE::rmdir')). (Rafael Garcia-Suarez) This has a small incompatible consequence: the prototype() function has been adjusted to return _ for some built-ins in appropriate cases (for example, prototype('CORE::rmdir')). (Rafael Garcia-Suarez)

UNITCHECK ブロック UNITCHECK blocks

UNITCHECKBEGIN, CHECK, INIT そして END に加えて新しく導入された特殊コードブロックです. UNITCHECK, a new special code block has been introduced, in addition to BEGIN, CHECK, INIT and END.

いくつかの特殊な目的で便利な CHECK 及び INIT ブロックは 常にメインプログラムのコンパイルと実行の間で実行され, 従ってこれは実行時にロードされるコードには役に立ちません. これに対して, UNITCHECK はそれが定義されている単位が コンパイルされた直後に実行されます. 詳細な情報は perlmod を参照してください. (Alex Gough) CHECK and INIT blocks, while useful for some specialized purposes, are always executed at the transition between the compilation and the execution of the main program, and thus are useless whenever code is loaded at runtime. On the other hand, UNITCHECK blocks are executed just after the unit which defined them has been compiled. See perlmod for more information. (Alex Gough)

新しいプラグマ, mro New Pragma, mro

新しいプラグマ, mro (Method Resolution Order; メソッド解決順序)が追加されました. これを使うことで複数の継承階層がある場合に perl が継承されたメソッドを探索するときに使うアルゴリズムを クラス毎に切り替えることができます. デフォルトの MRO は変更されません(DFS; Depth First Search, 深さ優先探索). 提供されている MRO にはもう一つ, C3 アルゴリズムがあります. より詳しい情報は mro を参照してください. (Brandon Black) A new pragma, mro (for Method Resolution Order) has been added. It permits to switch, on a per-class basis, the algorithm that perl uses to find inherited methods in case of a multiple inheritance hierarchy. The default MRO hasn't changed (DFS, for Depth First Search). Another MRO is available: the C3 algorithm. See mro for more information. (Brandon Black)

クラス階層探索の実装変更に伴って, *ISA グロブを undef していたコードは 恐らく動かないことに注意してください. *ISA を undef することは @ISA 配列の magic を 削除してしまう副作用を発生させるため, まず第一に それをするべきではありません. また, *::ISA::CACHE:: はもはや存在しません; @ISA キャッシュを 強制的にリセットしたいときには mro API を使うか, より巻単位は @ISA に代入を行う必要があります (例えば @ISA = @ISA). Note that, due to changes in the implementation of class hierarchy search, code that used to undef the *ISA glob will most probably break. Anyway, undef'ing *ISA had the side-effect of removing the magic on the @ISA array and should not have been done in the first place. Also, the cache *::ISA::CACHE:: no longer exists; to force reset the @ISA cache, you now need to use the mro API, or more simply to assign to @ISA (e.g. with @ISA = @ISA).

Windows 上に於いて readdir() が"短いファイル名"を返すことがあります readdir() may return a "short filename" on Windows

長いファイル名(long filename)が ANSI コードページ外の 文字を含んでいる時に readdir() 関数は "短いファイル名 (short filename)" を返すことがあります. 同様に, Cwd::cwd() もまた短いディレクトリ名を, そして glob() も 短い名前を同様に返すことがあります. NTFS ファイルシステム 上であればこれらの短い名前は常に ANSI コードページで 表現されます. これは他のシステムドライバでは必ずしも 当てはまりません; 例えば FAT ファイルシステムは 短いファイル名を OEM コードページで格納しているので, FAT ボリューム上のいくつかのファイルは ANSI API では 以前アクセスできないままです. The readdir() function may return a "short filename" when the long filename contains characters outside the ANSI codepage. Similarly Cwd::cwd() may return a short directory name, and glob() may return short names as well. On the NTFS file system these short names can always be represented in the ANSI codepage. This will not be true for all other file system drivers; e.g. the FAT filesystem stores short filenames in the OEM codepage, so some files on FAT volumes remain unaccessible through the ANSI APIs.

同様に, $^X, @INC, 及び $ENV{PATH} は全てのパスが (可能であれば)有効な ANSI コードページで表現されたパスと なるように起動時に前処理されます. Similarly, $^X, @INC, and $ENV{PATH} are preprocessed at startup to make sure all paths are valid in the ANSI codepage (if possible).

Win32::GetLongPathName() 関数は置換文字を使って名前を強制的に ANSI コードページとするのではなく, UTF-8 エンコードされた 正しい長いファイル名を返すようになります. 新しい WIn32::GetANSIPathName() 関数は長いパス名が ANSI コードページで表現できないときにのみ, 長いパス名を短いパス名へと変換するために使うことができます. The Win32::GetLongPathName() function now returns the UTF-8 encoded correct long file name instead of using replacement characters to force the name into the ANSI codepage. The new Win32::GetANSIPathName() function can be used to turn a long pathname into a short one only if the long one cannot be represented in the ANSI codepage.

Win32 モジュールの他の多くの関数は UTF-8 エンコードされた引数を受け取ることができるように 改善されました. 詳細は Win32 を参照してください. Many other functions in the Win32 module have been improved to accept UTF-8 encoded arguments. Please see Win32 for details.

readpipe() がオーバーライド可能になりました readpipe() is now overridable

組み込み関数 readpipe() がオーバーライド可能になりました. これによってこれに対応する演算子, qx// (a.k.a. ``) もオーバーライドすることができます. さらに, これは引数が渡されなかったときに $_ を デフォルトの引数とするようになりました. (Rafael Garcia-Suarez) The built-in function readpipe() is now overridable. Overriding it permits also to override its operator counterpart, qx// (a.k.a. ``). Moreover, it now defaults to $_ if no argument is provided. (Rafael Garcia-Suarez)

readline() のデフォルトの引数 Default argument for readline()

readline() は引数が渡されなかったときにデフォルトの 引数として *ARGV をとるようになりました. (Rafael Garcia-Suarez) readline() now defaults to *ARGV if no argument is provided. (Rafael Garcia-Suarez)

state() 変数 state() variables

新しい変数の分類が導入されました. state 変数は my 変数とにていますが, my の代わりに state キーワードを使って宣言します. 変数はそのレキシカルスコープで見ることができますが, my 変数とは異なりその値は維持され, スコープに入ったときに未定義にされる代わりに以前の値を 再び得ます. (Rafael Garcia-Suarez, Nicholas Clark) 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, Nicholas Clark)

state 変数を使うためには次の文で To use state variables, one needs to enable them by using

    use feature 'state';

若しくはワンライナーであれば -E コマンドラインスイッチ を使うことでそれを有効にする必要があります. perlsub 内 "Persistent variables via state()" を参照してください. or by using the -E command-line switch in one-liners. See "Persistent variables via state()" in perlsub.

スタックされたファイルテスト演算子 Stacked filetest operators

新しい構文糖として, ファイルテスト演算子を 積み重ねることができるようになりました. -x $file && -w _ && -f _ の意味で -f -w -x $file と一列にかけるようになりました. perlfunc 内 "-X" を参照してください. As a new form of syntactic sugar, it's now possible to stack up filetest operators. You can now write -f -w -x $file in a row to mean -x $file && -w _ && -f _. See "-X" in perlfunc.

UNIVERSAL::DOES()

UNIVERSAL は新しいメソッド, DOES を持つようになりました. これは isa() メソッドでの意味的(sematic)な 問題を解決するために追加されました. 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 )" を参照してください. See "$obj->DOES( ROLE )" in UNIVERSAL.

フォーマット Formats

フォーマットはいくつかの点で改善されました. 可変幅, 一回で一行?(one-line-at-a-time)のテキストのために 新しいフィールド ^* が使えるようになりました. picture 行で Null 文字が正しく処理されるようになりました. @#~~ の併用はこれらの整形フィールドに互換がないため コンパイルエラーを生成するようになりました. perlform も改善され, 雑多なバグが修正されました. Formats were improved in several ways. A new field, ^*, can be used for variable-width, one-line-at-a-time text. Null characters are now handled correctly in picture lines. Using @# and ~~ together will now produce a compile-time error, as those format fields are incompatible. perlform has been improved, and miscellaneous bugs fixed.

pack() 及び unpack() でのバイト順序修飾子 Byte-order modifiers for pack() and unpack()

多くの pack() 及び unpack() テンプレート文字及び グループでそのタイプ若しくはグループに対して特定の バイト順序を強制するための2つの新しいバイト順序修飾子, > (ビッグエンディアン) 及び < (リトルエンディアン) が追加されました. 詳細は perlfunc 内 "pack" 及び perlpacktut を参照してください. There are two new byte-order modifiers, > (big-endian) and < (little-endian), that can be appended to most pack() and unpack() template characters and groups to force a certain byte-order for that type or group. See "pack" in perlfunc and perlpacktut for details.

no VERSION

no のバージョン番号を続けることで, 指定したバージョンより 古いバージョンの perl を使いたいこと表現できるように なりました. You can now use no followed by a version number to specify that you want to use a version of perl older than the specified one.

ファイルハンドルに対する chdir, chmod 及び chown chdir, chmod and chown on filehandles

chdir, chmod 及び chown はシステムでぞれぞれ fchdir, fchmod 及び fchown がサポートされいたら ファイル名と同様にファイルハンドルでも動作するように なりました, Gisle Aas から提供されたパッチに感謝します. chdir, chmod and chown can now work on filehandles as well as filenames, if the system supports respectively fchdir, fchmod and fchown, thanks to a patch provided by Gisle Aas.

OS のグループ OS groups

$( 及び $) は OS から返された順番でグループを 返すようになりました, Gisle Aas に感謝します. これは以前はそうなっていませんでした. $( and $) now return groups in the order where the OS returns them, thanks to Gisle Aas. This wasn't previously the case.

再帰する sort 用関数 Recursive sort subs

sort() で再帰する関数を使えるようになりました, Robin Houston に感謝します. You can now use recursive subroutines with sort(), thanks to Robin Houston.

定数畳み込み込み時の例外 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. Without this change, programs would not compile if they had expressions that happened to generate exceptions, even though those expressions were in code that could never be reached at runtime. (Nicholas Clark, Dave Mitchell)

@INC でのソースフィルタ Source filters in @INC

@INC での関数フックメカニズムに於いて, フックから返された開いているファイルハンドルの先頭に ソースフィルタを加えることで強化できるようになりました. この機能はだいぶ以前から計画されていましたが, これまであまり作業されていませんでした. 詳細は perlfunc 内 "require" を参照してください. (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 for details. (Nicholas Clark)

新しい内部変数 New internal variables

${^RE_DEBUG_FLAGS}

この変数は use re "debug" で実行されている時に その正規表現エンジンで影響を持っているデバッグフラグを 制御します. 詳細は re を参照してください. This variable controls what debug flags are in effect for the regular expression engine when running under use re "debug". See re for details.

${^CHILD_ERROR_NATIVE}

この変数は最後の pipe close, バックティックコマンド, wait() 若しくは waitpid() の成功した呼び出し, 若しくは system() 演算子から返されたネイティブなステータスを 与えます. This variable gives the native status returned by the last pipe close, backtick command, successful call to wait() or waitpid(), or from the system() operator. See perlrun for details. (Contributed by Gisle Aas.)

${^RE_TRIE_MAXBUF}

"Trie optimisation of literal string alternations" 参照. See "Trie optimisation of literal string alternations".

${^WIN32_SLOPPY_STAT}

"Sloppy stat on Windows" 参照. See "Sloppy stat on Windows".

その他の事項 Miscellaneous

unpack() はデフォルトで $_ 変数を unpack するように なりました. unpack() now defaults to unpacking the $_ variable.

引数の無い mkdir()$_ をデフォルトと するようになりました. mkdir() without arguments now defaults to $_.

内部ダンプ出力が改善されました, これによって改行やバックスペースといった 表示できない文字は8進数でなく \x 記法で出力されるようになります. The internal dump output has been improved, so that non-printable characters such as newline and backspace are output in \x notation, rather than octal.

-C オプションは #! 行で使えなくなりました. どのみち, 標準入出力は perl インタプリタの実行に於いて その時点では既にセットアップ済みであるためそこでは動作しません. その振る舞いを希望する代わりに binmode() を使ってください. The -C option can no longer be used on the #! line. It wasn't working there anyway, since the standard streams are already set up at this point in the execution of the perl interpreter. You can use binmode() instead to get the desired behaviour.

UCD 5.0.0

Perl 5 に含まれているユニコード文字データベースは バージョン 5.0.0 にアップデートされました. The copy of the Unicode Character Database included in Perl 5 has been updated to version 5.0.0.

MAD

MAD (Miscellaneous Attribute Decoration)は Perl 5 から Perl 6 への コンバータに向けて今だ開発継続中です. これを有効にするには Configure の引数に -Dmad を渡す必要があります. これによって得られる perl は通常の perl 5.10 とのバイナリ互換性が ありません, そして空間と速度ともにペナルティをとります; それに加えてまだパスできていないレグレッションテスとが残っています. (Larry Wall, Nicholas Clark) MAD, which stands for Miscellaneous 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.10, and has space and speed penalties; moreover not all regression tests still pass with it. (Larry Wall, Nicholas Clark)

Windows での kill() kill() on Windows

Windows プラットフォームにおいて, kill(-9, $pid) は プロセスツリーを kill するようになります. (UNIX ではこれは同じプロセスグループに属するすべてのプロセスに シグナルを伝達します. On Windows platforms, kill(-9, $pid) now kills a process tree. (On UNIX, this delivers the signal to all processes in the same process group.)


非互換となる修正 Incompatible Changes

pack と UTF-8 文字列 Packing and UTF-8 strings

UTF-8 エンコードされたデータにおける pack() 及び unpack() のセマンティクスが変更されました. 処理はデフォルトで 基礎となっているエンコーディングにおいて バイト毎ではなく文字毎になりました. 特に, 文字列のエンコーディングを通して見るために pack("a*", $string) といったかんじで使っているコードは 単純にオリジナルの $string を得るようになります. アップグレードされている文字を格納したときには pack された文字列もまたアップグレードされています. use bytes を使うことで以前の振る舞いをとることもできます. The semantics of pack() and unpack() regarding UTF-8-encoded data has been changed. Processing is now by default character per character instead of byte per byte on the underlying encoding. Notably, code that used things like pack("a*", $string) to see through the encoding of string will now simply get back the original $string. Packed strings can also get upgraded during processing when you store upgraded characters. You can get the old behaviour by using use bytes.

pack() と同じように, unpack() での C0 テンプレートも 文字モードで, つまり文字毎に処理されることを示します; これに対して unpack() での U0 は pack された文字列が バイト毎の処理を基盤とした環境での UTF-8 エンコードされた ユニコード形式で処理されたと, UTF-8 モードを示します. これは perl 5.8.X と逆になりますが, これによって pack() と unpack() での矛盾が解消されます. To be consistent with pack(), the C0 in unpack() templates indicates that the data is to be processed in character mode, i.e. character by character; on the contrary, U0 in unpack() indicates UTF-8 mode, where the packed string is processed in its UTF-8-encoded Unicode form on a byte by byte basis. This is reversed with regard to perl 5.8.X, but now consistent between pack() and unpack().

さらに, pack() での C0 及び U0 はそれぞれ文字及び バイトモードのテンプレートとなります. Moreover, C0 and U0 can also be used in pack() templates to specify respectively character and byte modes.

pack 及び unpack フォーマットの途中にある C0 及び U0 は 括弧グループに於いての 指定されたエンコーディングモードへの切り替えとなります. これまでは, 括弧は無視されていました. C0 and U0 in the middle of a pack or unpack format now switch to the specified encoding mode, honoring parens grouping. Previously, parens were ignored.

また, 新しい pack() 文字形式, W が追加されました, これは以前の C の置き換えを意図しています. C は文字列の内部表現でのバイト列を unsigned char 列で 保持します. W は符号なし(論理)文字の値を表現し, これは 255 より大きい値もとれます. これによって UTF-8 エンコードされているかもしれないデータに対して より強靱になります(Cは文字エンコーディングを 考えないので 0..255 の範囲外の値は wrap してしまします). Also, there is a new pack() character format, W, which is intended to replace the old C. C is kept for unsigned chars coded as bytes in the strings internal representation. W represents unsigned (logical) character values, which can be greater than 255. It is therefore more robust when dealing with potentially UTF-8-encoded data (as C will wrap values outside the range 0..255, and not respect the string encoding).

実際のところ, これは pack フォーマットが C 以外は エンコーディング対応になったことを意味します. In practice, that means that pack formats are now encoding-neutral, except C.

一貫性のために, unpack() での A フォーマットは 文字列の末尾のすべてのユニコード白空白を取り除く ようになりました. perl 5.9.2 以前では, 伝統的な ASCII 空白文字のみを取り除いていました. For consistency, A in unpack() format now trims all Unicode whitespace from the end of the string. Before perl 5.9.2, it used to strip only the classical ASCII space characters.

unpack() でのバイト/文字カウント機能 Byte/character count feature in unpack()

新しい unpack() テンプレート文字, ".", これはそれまでに読み込まれたバイト数若しくは文字数を返します (選択されているエンコーディングモードに依る, 前述). A new unpack() template character, ".", returns the number of bytes or characters (depending on the selected encoding mode, see above) read so far.

$* 及び $# 変数は削除されました The $* and $# variables have been removed

/s 及び /m 正規表現修飾子が導入されたことで 非推奨となっていた $* は削除されました. $*, which was deprecated in favor of the /s and /m regexp modifiers, has been removed.

非推奨となっていた $# 変数 (数値の出力形式)は 削除されました. (編注: 配列の最後の添字を取得する $#VAR ではないです) The deprecated $# variable (output format for numbers) has been removed.

2つの厳しい警告, $#/$* is no longer supported が 追加されました. Two new severe warnings, $#/$* is no longer supported, have been added.

substr() の lvalue は固定長でなくなりました substr() lvalues are no longer fixed-length

3引数形式の substr() から返される lvalue 値は オリジナルの文字列での"固定長のウィンドウ"を持っていました. いくつかのケースにおいてこれは離れた場所でのびっくりする動作や 他の未定義な振る舞いとなっていました. このウィンドウの長さはそれに代入された文字列の長さに 調整されるようになりました. (編注:$x="1234";$y=(substr($x,1,2)="ABCD"); とした時, これまでは $x="1ABCD4", $y="AB" となっていたけれど, 5.10 以降は $x="1ABCD4", $y="ABCD" になる.) The lvalues returned by the three argument form of substr() used to be a "fixed length window" on the original string. In some cases this could cause surprising action at distance or other undefined behaviour. Now the length of the window adjusts itself to the length of the string assigned to it.

-f _ のパース Parsing of -f _

識別子 _ は, ファイルテスト演算子の後ではベアワードとして 強制されるようにありました. これはグローバルな _ 関数が 定義されている時の misparsing な動作を改善します. The identifier _ is now forced to be a bareword after a filetest operator. This solves a number of misparsing issues when a global _ subroutine is defined.

:unique

:unique アトリビュートは no-op になりました, この現在の実装が本質的に問題がある上にスレッドセーフで ないためです. The :unique attribute has been made a no-op, since its current implementation was fundamentally flawed and not threadsafe.

eval 内のプラグマの影響 Effect of pragmas in eval

%^H ヒント変数のコンパイル時の値は eval("") されたコードにも 伝播するようになりました. これはレキシカルプラグマを実装するのに より一層役立ちます. The compile-time value of the %^H hint variable can now propagate into eval("")uated code. This makes it more useful to implement lexical pragmas.

この副作用として, 定数のオーバーロードされ具合も eval("") に 伝播するようになりました. As a side-effect of this, the overloaded-ness of constants now propagates into eval("").

chdir FOO

chdir() へのベアワード引数はファイルハンドルとして 認識されるようになりました. これまでのリリースでは ベアワードはディレクトリ名として処理されていました. (Gisle Aas) 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 の古くからある機能で, 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 からはこれは存在していれば常にロードされるようになります. 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.

$^V は v-string ではなく version オブジェクトになります $^V is now a version object instead of a v-string

$^V は printf における %vd 形式で使うことができますが, 文字レベルでの操作は version オブジェクトの 文字列表現へのアクセスとなり, v-string のではありません. substr($^V, 0, 2)split //, $^V といった式はもはや動作せず, 書き直さなければなりません. $^V can still be used with the %vd format in printf, but any character-level operations will now access the string representation of the version object and not the ordinals of a v-string. Expressions like substr($^V, 0, 2) or split //, $^V no longer work and must be rewritten.

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

特殊配列 @- 及び @+ はもはや正規表現の中に入り込んで(interpolate) いません. (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)

taint と printf Tainting and printf

perl が taint モードで実行されている時, printf() 及び sprintf() は taint された書式引数を拒否するようになります. (Rafael Garcia-Suarez) When perl is run under taint mode, printf() and sprintf() will now reject any tainted format argument. (Rafael Garcia-Suarez)

undef とシグナルハンドラ undef and signal handlers

シグナルハンドラの undef $SIG{FOO} による未定義化 若しくは削除は 'DEFAULT' の設定と等価になります. (Rafael Garcia-Suarez) Undefining or deleting a signal handler via undef $SIG{FOO} is now equivalent to setting it to 'DEFAULT'. (Rafael Garcia-Suarez)

strict と defined() 内のデリファレンス strictures and dereferencing in defined()

use strict 'refs' は次のような defined() の引数でのハードリファレンスを 無視していました: use strict 'refs' was ignoring taking a hard reference in an argument to defined(), as in :

    use strict 'refs';
    my $x = 'foo';
    if (defined $$x) {...}

これは適切に実行時エラー Can't use string as a SCALAR ref while "strict refs" in use ("struct refs" の影響下では文字列を SCALAR リファレンスとして使うことは出来ません)を生成するようになります. This now correctly produces the run-time error Can't use string as a SCALAR ref while "strict refs" in use.

defined @$foo 及び defined %$barstrict 'refs' にも従うようになります(つまり $foo 及び $bar はその場所において 適切なリファレンスであるべきです). (defined(@foo) 及び defined(%bar) は推奨されない形ですが.) (Nicholas Clark) defined @$foo and defined %$bar are now also subject to strict 'refs' (that is, $foo and $bar shall be proper references there.) (defined(@foo) and defined(%bar) are discouraged constructs anyway.) (Nicholas Clark)

(?p{}) は削除されました (?p{}) has been removed

perl 5.8 で非推奨となっていた正規表現構築子 (?p{}) は 削除されました. かわりに (??{}) を使うようにしてください. (Rafael Garcia-Suarez) The regular expression construct (?p{}), which was deprecated in perl 5.8, has been removed. Use (??{}) instead. (Rafael Garcia-Suarez)

仮想ハッシュは削除されました Pseudo-hashes have been removed

仮想ハッシュのサポートは Perl 5.9 から削除されました. (fields プラグマは引き続き残りますが, 違う実装を使っています). Support for pseudo-hashes has been removed from Perl 5.9. (The fields pragma remains here, but uses an alternate implementation.)

perlcc とバイトコードコンパイラの削除 Removal of the bytecode compiler and of perlcc

perlcc, バイトローダ及びそのサポートモジュール(B::C, B::CC, B::Bytecode, etc.)は perl ソースと一緒には配布されなくなりました. これらの実験的なツールは信頼した動作を行えず, そして, perl インタプリタの開発ラインに於いてそれを維持するボランティアの 不足により, 壊れたバージョンを送り出すよりは削除されることとなりました. 最後のバージョンは perl 5.9.4 にあります. perlcc, the byteloader and the supporting modules (B::C, B::CC, B::Bytecode, etc.) are no longer distributed with the perl sources. Those experimental tools have never worked reliably, and, due to the lack of volunteers to keep them in line with the perl interpreter developments, it was decided to remove them instead of shipping a broken version of those. The last version of those modules can be found with perl 5.9.4.

とはいっても B コンパイラフレームワークは, それによって可能となる 便利なモジュール(とりわけ B::Deparse 及び B::Concise)と共に perl コアでのサポートが継続されます. However the B compiler framework stays supported in the perl core, as with the more useful modules it has permitted (among others, B::Deparse and B::Concise).

JPL の削除 Removal of the JPL

JPL (Java-Perl Lingo) は perl ソース tarball から削除されます. The JPL (Java-Perl Lingo) has been removed from the perl sources tarball.

再帰継承の早期検出 Recursive inheritance detected earlier

Perl はどこかのパッケージで再帰継承となる @ISA の変更を 行うと直ぐに例外を投げるようになります. Perl will now immediately throw an exception if you modify any package's @ISA in such a way that it would cause recursive inheritance.

これまでは, Perl がメソッドの解決や $foo->isa($bar) の 探索を行うために再帰継承を使おうとするまでは例外は発生していま せんでした. Previously, the exception would not occur until Perl attempted to make use of the recursive inheritance while resolving a method or doing a $foo->isa($bar) lookup.


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

個々のコアモジュールのアップグレード Upgrading individual core modules

より多くのコアモジュールが CPAN を通して分離しても提供されています. もしこれのらのモジュールのうち一つをアップデートしたいのであれば, 新しい perl のリリースを待つ必要はありません. cpan シェルから, 'r' コマンドを実行することでアップグレードの 提供されているモジュールが一覧されます. 詳細は perldoc CPAN を参照してください. Even more core modules are now also available separately through the CPAN. If you wish to update one of these modules, you don't need to wait for a new perl release. From within the cpan shell, running the 'r' command will report on modules with upgrades available. See perldoc CPAN for more information.

プラグマの変更点 Pragmata Changes

feature

新しいプラグマ feature は古いコードが動かなくなるかもしれない 新しい機能を有効にするために使われます. 前述の "The C<feature> pragma" を参照してください. The new pragma feature is used to enable new features that might break old code. See "The C<feature> pragma" above.

mro

この新しいプラグマは継承されたメソッドを解決するのに使う アルゴリズムの変更を可能にします. 前述の "New Pragma, C<mro>" を 参照してください. This new pragma enables to change the algorithm used to resolve inherited methods. See "New Pragma, C<mro>" above.

sort プラグマのスコープ Scoping of the sort pragma

sort プラグマはレキシカルスコープになります. この影響はかつてはグローバルでした. The sort pragma is now lexically scoped. Its effect used to be global.

bignum, bigint, bigrat のスコープ Scoping of bignum, bigint, bigrat

3つの数値関連のプラグマ bignum, bigint 及び bigrat は レキシカルスコープになります. (Tels) The three numeric pragmas bignum, bigint and bigrat are now lexically scoped. (Tels)

base

base プラグマはあるクラスがそれ自身を継承しようとした時に 警告をするようになります. (Curtis "Ovid" Poe) The base pragma now warns if a class tries to inherit from itself. (Curtis "Ovid" Poe)

strict 及び warnings strict and warnings

strict 及び warnings は大文字小文字が不適切な形で ロードされると(例えば use Strict;)大声で訴えるように なります. (Johan Vromans) strict and warnings will now complain loudly if they are loaded via incorrect casing (as in use Strict;). (Johan Vromans)

version version

version モジュールは version オブジェクトのサポートを提供します. The version module provides support for version objects.

warnings

warnings プラグマは Carp をロードしなくなります. これによってコンパイル時に Carp のルーティンをロードすることなく 使っていたコードは調整する必要があります; 典型的には, 次のような(間違った)コードは動作しなくなり, 関数名の後に括弧をつける 必要があります: The warnings pragma doesn't load Carp anymore. That means that code that used Carp routines without having loaded it at compile time might need to be adjusted; typically, the following (faulty) code won't work anymore, and will require parentheses to be added after the function name:

    use warnings;
    require Carp;
    Carp::confess 'argh';
less

less は便利な何かを行うようになります(若しくは少なくとも 行おうとはします). 実際に, これはレキシカルプラグマです. なので, 貴方のモジュールに於いて, ユーザがより少ない CPU, メモリ, 魔法, さらには脂肪分を要求しているのかどうかを チェックすることができます. 詳細は less を参照してください. (Joshua ben Jore) less now does something useful (or at least it tries to). In fact, it has been turned into a lexical pragma. So, in your modules, you can now test whether your users have requested to use less CPU, or less memory, less magic, or maybe even less fat. See less for more. (Joshua ben Jore)

新しいモジュール New modules

コアモジュール変更点のピックアップ Selected Changes to Core Modules

Attribute::Handlers

Attribute::Handlers は呼び出し元のファイル及び行番号を 報告てきるようになりました. (David Feldman) Attribute::Handlers can now report the caller's file and line number. (David Feldman)

全ての処理された属性は配列リファレンスとして渡されるように なりまshちあ. (Damian Conway) All interpreted attributes are now passed as array references. (Damian Conway)

B::Lint

B::LintModule::Pluggable を基底とするようになりました, これによってプラグインで拡張できるようになりました. (Joshua ben Jore) B::Lint is now based on Module::Pluggable, and so can be extended with plugins. (Joshua ben Jore)

B

レキシカルプラグマヒント(%^H)に B::COP::hints_hash() メソッドを使うことでアクセスできるようになりました. これは B::RHE オブジェクトを返し, さらに B::RHE::HASH() メソッドを 通してhハッシュリファレンスを取得するために使うことができます. (Joshua ben Jore) It's now possible to access the lexical pragma hints (%^H) by using the method B::COP::hints_hash(). It returns a B::RHE object, which in turn can be used to get a hash reference via the method B::RHE::HASH(). (Joshua ben Jore)

Thread

古い 5005thread スレッドモデルは削除されました, ithread スキームによって, Thread モジュールはそれを使っている 古いコードのみのための互換ラッパになります. これはダイナミック 拡張のデフォルトリストから削除されます. As the old 5005thread threading model has been removed, in favor of the ithreads scheme, the Thread module is now a compatibility wrapper, to be used in old code only. It has been removed from the default list of dynamic extensions.


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

perl -d

Perl デバッガは後で利用するための全てのデバッガコマンドを 保存するようになりました; とりわけ, リスタートしてこの保存されたコマンド履歴から 最後のコマンドの前まで再度実行することで, 後退をエミュレートできるように なりあした. The Perl debugger can now save all debugger commands for sourcing later; notably, it can now emulate stepping backwards, by restarting and rerunning all bar the last command from a saved command history.

また与えたクラスの親継承ツリーを i コマンドで表示できるように なりました. It can also display the parent inheritance tree of a given class, with the i command.

ptar

ptartar のピュアperl実装です, Archive::Tar と共に 導入されます. ptar is a pure perl implementation of tar that comes with Archive::Tar.

ptardiff

ptardiff は tar アーカイブとディレクトリツリーとの内容の diff を とるための小さなユーティリティです, Archive::Tar と共に 導入されます. ptardiff is a small utility used to generate a diff between the contents of a tar archive and a directory tree. Like ptar, it comes with Archive::Tar.

shasum

shasum は SHA ダイジェストを表示, 若しくは検証するための コマンドラインユーティリティです. Digest::SHA モジュールと共に 導入されます. shasum is a command-line utility, used to print or to check SHA digests. It comes with the new Digest::SHA module.

corelist

corelist ユーティリティが perl と共にインストールされるように なります("New modules" 参照). The corelist utility is now installed with perl (see "New modules" above).

h2ph and h2xs

h2ph 及び h2xs は"今風の" C コードを出力することで より強靭になります. h2ph and h2xs have been made more robust with regard to "modern" C code.

h2xs に後方互換モジュールであっても XSLoader の使用を 強制させる --use-xsloader オプションが新しく実装されます. h2xs implements a new option --use-xsloader to force use of XSLoader even in backwards compatible modules.

アポストロフィを含んだ作者名の処理が修正されました. The handling of authors' names that had apostrophes has been fixed.

負の値の enum シンボルはスキップされるようになりました. Any enums with negative values are now skipped.

perlivp

perlivp はデフォルトで *.ph をチェックしなくなりました. 全てのテストを実行するには新しく出来た -a オプションを 使うようにしてください. perlivp no longer checks for *.ph files by default. Use the new -a option to run all tests.

find2perl

find2perl-print をデフォルトの動作とするようになりました. これまではこれを明示的に指定する必要がありました. find2perl now assumes -print as a default action. Previously, it needed to be specified explicitly.

-exec 及び -eval に関する find2perl の幾つかのバグは修正 されました. またオプション -path, -ipath 及び -iname が 追加されました. Several bugs have been fixed in find2perl, regarding -exec and -eval. Also the options -path, -ipath and -iname have been added.

config_data

config_dataModule::Build と共に導入される新しい ユーティリティです. これは Module::Build の設定フレームワーク (つまり, その親モジュールのためのローカル設定情報を *::ConfigData が 持つ)を使っている Perl モジュールの設定のためのコマンドライン インターフェースを提供します. 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.)

cpanp

cpanp CPANPLUS シェルが追加されました. (CPANPLUS 操作のためのヘルパ, cpanp-run-perl, も追加されていますが, これは直接の利用を意図しているものではありません). cpanp, the CPANPLUS shell, has been added. (cpanp-run-perl, a helper for CPANPLUS operation, has been added too, but isn't intended for direct use).

cpan2dist

cpan2dist は CPANPLUS と共に導入される新しいユーティリティです. これは CPAN モジュールから配布物(若しくはパッケージ)を作るための ツールです. cpan2dist is a new utility that comes with CPANPLUS. It's a tool to create distributions (or packages) from CPAN modules.

pod2html

pod2html の出力が CSS でカスタマイズでよりカスタマイズ できるように強化されました. 幾つかの整形上の問題も修正されました. (Jari Aalto) The output of pod2html has been enhanced to be more customizable via CSS. Some formatting problems were also corrected. (Jari Aalto)


新しいドキュメント New Documentation

perlpragma マニュアルページには自分用の レキシカルプラグマを Perl のみで書く方法が記載されています (これは 5.9.4 から可能です). The perlpragma manpage documents how to write one's own lexical pragmas in pure Perl (something that is possible starting with 5.9.4).

perlglossary は Perl ドキュメントで使われている技術的, 及びその他の 単語の用語集です, 親切な O'Reilly Media, Inc. から提供されました. The new perlglossary manpage is a glossary of terms used in the Perl documentation, technical and otherwise, kindly provided by O'Reilly Media, Inc.

Yves Orton の好意による perlreguts マニュアルページには Perl 正規表現エンジンの内部が記述されています. The perlreguts manpage, courtesy of Yves Orton, describes internals of the Perl regular expression engine.

perlreapi マニュアルページにはプラガブルな 正規表現エンジンを書くための perl インタプリタへの インターフェースが記述されています. (by Ævar Arnfjörð Bjarmason). The perlreapi manpage describes the interface to the perl interpreter used to write pluggable regular expression engines (by Ævar Arnfjörð Bjarmason).

perlunitut マニュアルページは Perl での Unicode 及び 文字列エンコーディングを使ったプログラミングのための チュートリアルです, Juerd Waalboer の好意によります. The perlunitut manpage is an tutorial for programming with Unicode and string encodings in Perl, courtesy of Juerd Waalboer.

perlunifaq (Perl Unicode FAQ) が追加されました (Juerd Waalboer). A new manual page, perlunifaq (the Perl Unicode FAQ), has been added (Juerd Waalboer).

perlcommunity マニュアルページではインターネット上及び 実生活上での Perl コミュニティについての説明がされています. (Edgar "Trizor" Bering) The perlcommunity manpage gives a description of the Perl community on the Internet and in real life. (Edgar "Trizor" Bering)

CORE マニュアルページには CORE:: 名前空間について記述されています. The CORE manual page documents the CORE:: namespace. (Tels)

だいぶ前から存在していた /(?{...})/ 正規表現が $_ 及び pos() を設定する機能がドキュメント化されました. The long-existing feature of /(?{...})/ regexps setting $_ and pos() is now documented.


パフォーマンスの強化 Performance Enhancements

インプレースなソート In-place sorting

配列のインプレースなソート (@a = sort @a) は 配列の一時的な複製を作らないよう最適化されるようになりました. Sorting arrays in place (@a = sort @a) is now optimized to avoid making a temporary copy of the array.

同じように, reverse sort ... も一時的な中間リストの生成を押さえて 逆順にソートするように最適化されました. Likewise, reverse sort ... is now optimized to sort in reverse, avoiding the generation of a temporary intermediate list.

レキシカルな配列へのアクセス Lexical array access

0 から 255 の間で数値定数によってレキシカルな配列の要素に アクセスするのが高速になりました. (これはグローバルな配列でのみ行われていました) Access to elements of lexical arrays via a numeric constant between 0 and 255 is now faster. (This used to be only the case for global arrays.)

XS による SWASHGET XS-assisted SWASHGET

Unicode 属性及び変換マップを取得するために使われていた幾つかのpure-perlコードは XS で再実装されました. Some pure-perl code that perl was using to retrieve Unicode properties and transliteration mappings has been reimplemented in XS.

定数関数 Constant subroutines

インタプリタ内部に於いてよりメモリ効率の良いインライン定数の形式が サポートされました. シンボルテーブルに定数のリファレンスを格納すると, それは定数関数を参照する完全なタイプグロブと等価ですが, およそ 400 バイトメモリを節約します. この代理定数関数は 必要であれば関数を持った実際のタイプグロブに 自動的にアップグレードされます. ここで採用しているアプローチは, 関数スタブの宣言で使われている, 完全なタイプグロブの代わりに プレインなスカラーを格納するという既存の空間最適化と似たものです. The interpreter internals now support a far more memory efficient form of inlineable constants. Storing a reference to a constant value in a symbol table is equivalent to a full typeglob referencing a constant subroutine, but using about 400 bytes less memory. This proxy constant subroutine is automatically upgraded to a real typeglob with subroutine if necessary. The approach taken is analogous to the existing space optimisation for subroutine stub declarations, which are stored as plain scalars in place of the full typeglob.

幾つかのコアモジュールがシステムに依存する定数において この機能を使うように変換されました - この結果 use POSIX; はおよそ 200K 程メモリ消費が削減されました. Several of the core modules have been converted to use this feature for their system dependent constants - as a result use POSIX; now takes about 200K less memory.

PERL_DONT_CREATE_GVSV

perl 5.8.8 で任意として導入された新しいコンパイルフラグ PERL_DONT_CREATE_GVSV は perl 5.9.3 からデフォルトで使われるように なりました. これは新しいタイプグロブに対して空のスカラーを生成していたのを 抑制するようになります. 詳細は perl588delta を参照してください. The new compilation flag PERL_DONT_CREATE_GVSV, introduced as an option in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl from creating an empty scalar with every new typeglob. See perl588delta for details.

弱い参照のコスト減少 Weak references are cheaper

Nicholas Clark の好意により, 弱い参照は O(n) ではなく O(1) で作成できるようになりました. 削除は O(n) のままですが, 削除がプログラムの終了でのみ発生するのなら, これは完全にスキップされます. Weak reference creation is now O(1) rather than O(n), courtesy of Nicholas Clark. Weak reference deletion remains O(n), but if deletion only happens at program exit, it may be skipped completely.

sort() の強化 sort() enhancements

Salvador Fandiño は sort のメモリ抑制と幾つかのケースでの 高速化の実装を提供してくれました. Salvador Fandiño provided improvements to reduce the memory usage of sort and to speed up some cases.

メモリの最適化 Memory optimisations

幾つかの内部データ構造(タイプグロブ, GV, CV, フォーマット)は メモリ効率が良くなるよう再構成されました. (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)

Windows でのおおざっぱな stat Sloppy stat on Windows

Windows において, perl の stat() 関数はリンク数を調べるため及び ハードリンクによって属性が変更されていないかを調べるために 通常はファイルをオープンしています. ${^WIN32_SLOPPY_STAT} を 真にするとこの処理を抑制することで stat() の速度が改善します. (Jan Dubois) 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)

正規表現の最適化 Regular expressions optimisations

エンジンの非再帰化 Engine de-recursivised

正規表現エンジンは再帰を行わなくなりました, これによってスタックを使い果たしていたようなパターンは もっと役に立つ説明を伴って die するか, ちゃんと実行できるように なりました, それらは以前であればスタックを打ちのめすことが できましたが, それにはとても長い時間がかかるでしょう. もしそのようなスタックあふれ(若しくはsegfault)を経験していて 今の perl もどうやらハングするらしいことを見つけたら, 悪化した正規表現を探してみてください. (Dave Mitchell) 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 optimisation of literal string alternations

代替は, 可能であれば, より効率的なマッチング構造へと 最適化されるようになりました. 文字列リテラル代替は トライへとメージされ, 同時にマッチが行われます. これはある地点で N 個の代替のマッチを行うのに O(N) かかっていたのに対し, 新しいコードでは O(1) で処理 されるようになります. 新しい特殊変数, ${^RE_TRIE_MAXBUF} が, この最適化を 調整するために追加されました. (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. A new special variable, ${^RE_TRIE_MAXBUF}, has been added to fine-tune this optimization. (Yves Orton)

補足: 代替において perl の経験的で貧弱な パフォーマンスに対処させているコードはたくさんあります. それを行うためにしばしば使われているトリックは 新しい最適化では効果がなくなるでしょう. 願わくば, この目的のために使われているユーティリティモジュールが 新しい最適化についての教育を受けますように. 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.

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)


インストールとコンフィグレーションの改善 Installation and Configuration Improvements

設定の向上 Configuration improvements

-Dusesitecustomize

@INC の実行時カスタマイズは Configure に -Dusesitecustomize を渡すことで有効になります. これが有効になると, すべてに先立って $sitelibexp/sitecustomize.pl を実行するようになります. このスクリプトで @INC に 追加の項目を加えるようなセットアップができます. Run-time customization of @INC can be enabled by passing the -Dusesitecustomize flag to Configure. When enabled, this will make perl run $sitelibexp/sitecustomize.pl before anything else. This script can then be set up to add additional entries to @INC.

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

再配置可能な perl ツリーを作るための新しい Configure サポートができました. -Duserelocatableinc で Configure を行うと, @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.

strlcat() 及び strlcpy() strlcat() and strlcpy()

configuration プロセスで 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)

d_pseudofork 及び d_printf_format_null d_pseudofork and d_printf_format_null

新しい設定変数, $Config{d_pseudofork}Config モジュールに 追加されました, これによって実際の fork() のサポートを Windows プラットフォームにおいて使われている疑似forkと 区別することができるようになります. A new configuration variable, available as $Config{d_pseudofork} in the Config module, has been added, to distinguish real fork() support from fake pseudofork used on Windows platforms.

新しい設定変数 d_printf_format_null が追加され, これによって printf-ライクの書式で NULL が許されるかを 確認することができます. A new configuration variable, d_printf_format_null, has been added, to see if printf-like formats are allowed to be NULL.

設定のヘルプ Configure help

Configure -h はよく使われるオプションに 拡張されました. Configure -h has been extended with the most commonly used options.

コンパイルの向上 Compilation improvements

並列ビルド Parallel build

並列 make が適切に動作するようになります, けれども make test は並列に実行されるとまだ問題があります. Parallel makes should work properly now, although there may still be problems if make test is instructed to run in parallel.

Borland コンパイラのサポート Borland's compilers support

Borland の Win32 でのコンパイラがよりスムーズに 動作するようになりました. 特に Steve Hay はそれらの コンパイラで発行される多くの警告と, 少なくとも1つの C コンパイラの内部エラーを取り除いてくれました. Building with Borland's compilers on Win32 should work more smoothly. In particular Steve Hay has worked to side step many warnings emitted by their compilers and at least one C compiler internal error.

Windows でのスタティックビルド Static build on Windows

Windows での Perl 拡張は Perl DLL に静的にビルドできるように なりました. Perl extensions on Windows now can be statically built into the Perl DLL.

また, Win32 において Perl DLL に依存しない perl-static.exe をビルドできるようにもなりました. 詳細は Win32 makefile群を 参照してください. (Vadim Konovalov) Also, it's now possible to build a perl-static.exe that doesn't depend on the Perl DLL on Win32. See the Win32 makefiles for details. (Vadim Konovalov)

ppport.h ファイル ppport.h files

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)

C++ との互換性 C++ compatibility

perl 及びコアとなる XS モジュールが様々な C++ コンパイラと 互換がとれるように取り組みが行われました(けれども テストされた幾つかのプラットフォームでの幾つかの コンパイラでは完全はありません) Efforts have been made to make perl and the core XS modules compilable with various C++ compilers (although the situation is not perfect with some of the compilers on some of the platforms tested.)

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

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

Visual C++

Perl は Microsoft Visual C++ 2005 (及び 2008 Beta 2) で コンパイルできるようになりました. Perl can now be compiled with Microsoft Visual C++ 2005 (and 2008 Beta 2).

Win32 ビルド Win32 builds

全ての win32 ビルド (MS-Win, WinCE)は統合され, 整理されました. All win32 builds (MS-Win, WinCE) have been merged and cleaned up.

インストールの向上 Installation improvements

モジュール補助ファイル Module auxiliary files

perl に同梱されている CPAN モジュールの README ファイル及び changelog はもはやインストールされなくなりました. README files and changelogs for CPAN modules bundled with perl are no longer installed.

新しい及び向上したプラットフォーム New Or Improved Platforms

Symbian OS での Perl の稼働が報告されました. 詳細は perlsymbian を参照してください. Perl has been reported to work on Symbian OS. See perlsymbian for more information.

z/OS で Perl を正しく動作させるようにする多くの改善が 行われました. Many improvements have been made towards making Perl work correctly on z/OS.

DragonFlyBSD 及び MidnightBSD での Perl の稼働が報告されました. Perl has been reported to work on DragonFlyBSD and MidnightBSD.

NexentaOS での Perl 動作報告も受けました ( http://www.gnusolaris.org/ ). Perl has also been reported to work on NexentaOS ( http://www.gnusolaris.org/ ).

VMS ポートが改善しました. perlvms を参照してください. The VMS port has been improved. See perlvms.

Cray XT4 Catamount/Qk のサポートが追加されました. 詳細はソース配布物内の hints/catamount.sh を 参照してください. Support for Cray XT4 Catamount/Qk has been added. See hints/catamount.sh in the source code distribution for more information.

RedHat 及び Gentoo のベンダーパッチがマージされました. Vendor patches have been merged for RedHat and Gentoo.

DynaLoader::dl_unload_file() が Windows でも 動作するようになりました. DynaLoader::dl_unload_file() now works on Windows.


バグ修正のピックアップ Selected Bug Fixes

regexp-eval ブロックにおける strict strictures in regexp-eval blocks

strict は regexp-eval ブロック (/(?{...})/) には影響していませんでした. strict wasn't in effect in regexp-eval blocks (/(?{...})/).

CORE::require() の呼び出し Calling CORE::require()

CORE::require() 及び CORE::do() はオーバーライドされている時は require() and do() に常にパースされていました. これは修正されました. CORE::require() and CORE::do() were always parsed as require() and do() when they were overridden. This is now fixed.

スライスの添字 Subscripts of slices

次のように, リストスライスの後は添字のチェインに矢印の無い形式を 使えるようになりました: You can now use a non-arrowed form for chained subscripts after a list slice, like in:

    ({foo => "bar"})[0]{foo}

これはこれまでは構文エラー; -> が必要です(a -> was required) となっていました. This used to be a syntax error; a -> was required.

no warnings 'category' は -w でも正しく動作するようになりました no warnings 'category' works correctly with -w

これまでは-wによって全体的に警告が有効な状態で実行していると, 特定の警告カテゴリの選択的無効化は実際には全ての警告を 解除していました. これは修正されました; no warnings 'io';io クラスに属する警告のみを解除するようになりました. これまでは誤って全ての警告を解除していました. Previously when running with warnings enabled globally via -w, selective disabling of specific warning categories would actually turn off all warnings. This is now fixed; now no warnings 'io'; will only turn off warnings in the io class. Previously it would erroneously turn off all warnings.

スレッドの改善 threads improvements

ithreads における幾つかのメモリリークは収束しました. また, メモリ消費量具合が減少しました. Several memory leaks in ithreads were closed. Also, ithreads were made less memory-intensive.

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() 組み込み関数は, 常にアプリケーション全体を終了させるようになります. (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)

chr() と負の値 chr() and negative values

負の値での chr() は \x{FFFD}, Unicode 置き換え文字を 返すようになります, bytes プラグマの影響下ではそうではなく, 下位 8 ビットの値が使われます. chr() on a negative value now gives \x{FFFD}, the Unicode replacement character, unless when the bytes pragma is in effect, where the low eight bits of the value are used.

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} ファイルハンドルを扱います. (Steve Peters) 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)

PERLIO_DEBUG

PERLIO_DEBUG 環境変数は setuid スクリプト及び -T で実行されているスクリプトでは影響を持たなくなりました. The PERLIO_DEBUG environment variable no longer has any effect for setuid scripts and for scripts run with -T.

さらに, スレッドが有効な perl において, PERLIO_DEBUG の利用は内部的なバッファオーバーフローの 元となっていました. これは修正されました. Moreover, with a thread-enabled perl, using PERLIO_DEBUG could lead to an internal buffer overflow. This has been fixed.

PerlIO::scalar と読み込み専用のスカラー PerlIO::scalar and read-only scalars

PerlIO::scalar は読み込み専用のスカラーに書き込まないように なりました. さらに, PerlIO::scalar ベースのファイルハンドルで seek() がサポートされるようになりました, 元となっている文字列は 必要であればゼロで埋められます. (Rafael, Jarkko Hietaniemi) PerlIO::scalar will now prevent writing to read-only scalars. Moreover, seek() is now supported with PerlIO::scalar-based filehandles, the underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi)

study() 及び UTF-8 study() and UTF-8

study() は UTF-8 文字列では動作しておらず, 間違った結果を 返すだけでした. これは UTF-8 データではなにもしないように なりました. (Yves Orton) study() never worked for UTF-8 strings, but could lead to false results. It's now a no-op on UTF-8 data. (Yves Orton)

致命的なシグナル Critical signals

SIGILL, SIGBUS 及び SIGSEGV の各シグナルは, 常に"安全でない"形式で配送されるようになります (perl インタプリタが安定した状態に達するまで 遅延させる他のシグナルとは異なります; perlipc 内 "Deferred Signals (Safe Signals)" を 参照してください). (Rafael) The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an "unsafe" manner (contrary to other signals, that are deferred until the perl interpreter reaches a reasonably stable state; see "Deferred Signals (Safe Signals)" in perlipc). (Rafael)

@INC-フックの修正 @INC-hook fix

@INC フックを通してモジュール若しくはファイルがロードされた時, 及びこのフックが %INC にファイル名を設定したとき, そのモジュールのための __FILE__ は %INC エントリの内容に即したものが 設定されます. (Rafael) When a module or a file is loaded through an @INC-hook, and when this hook has set a filename entry in %INC, __FILE__ is now set for this module accordingly to the contents of that %INC entry. (Rafael)

-t スイッチの修正 -t switch fix

-w 及び -t スイッチを一緒に使った時に 有効になる警告のカテゴリを失うこと無く使えるようになります. (Rafael) The -w and -t switches can now be used together without messing up which categories of warnings are activated. (Rafael)

UTF-8 ファイルハンドルの dup Duping UTF-8 filehandles

:utf8 PerlIO レイヤを持っているファイルハンドルを dup した時に dup されたファイルハンドルのレイヤにも 適切に運ぶようになります. (Rafael) Duping a filehandle which has the :utf8 PerlIO layer set will now properly carry that layer on the duped filehandle. (Rafael)

ハッシュ要素の local 化 Localisation of hash elements

ハッシュの要素を変数をキーとして local 化したとき, local() の効果のあるうちにキーとした変数の値が 変更された時に(local $h{$x}; ++$x のように) 正しく動作していませんでした. (Bo Lindbergh) Localizing a hash element whose key was given as a variable didn't work correctly if the variable was changed while the local() was in effect (as in local $h{$x}; ++$x). (Bo Lindbergh)


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

初期化されていない値の使用 Use of uninitialized value

Perl は未定義だった変数の名前を(もしあれば)伝えようと 試みるようになります. Perl will now try to tell you the name of the variable (if any) that was undefined.

廃止された到達しない条件下での my() の使用 Deprecated use of my() in false conditional

新しい廃止警告, Deprecated use of my() in false conditional (廃止された, 到達しない条件下での my() の使用)が追加されました, これは曖昧で廃止された構築に対して警告します. A new deprecation warning, Deprecated use of my() in false conditional, has been added, to warn against the use of the dubious and deprecated construct

    my $x if 0;

perldiag を参照してください. 代わりに state 変数を使ってください. See perldiag. Use state variables instead.

!=~ は !~ とするべきです !=~ should be !~

否定マッチ演算子のスペルミスを防止するために, 新しい警告, !=~ should be !~, が発行されます. A new warning, !=~ should be !~, is emitted to prevent this misspelling of the non-matching operator.

左詰めの文字列の改行 Newline in left-justified string

警告 Newline in left-justified string は削除されました. The warning Newline in left-justified string has been removed.

"-T" オプションには遅すぎます Too late for "-T" option

エラー Too late for "-T" option はより分かり易くするために 再編成されました. The error Too late for "-T" option has been reformulated to be more descriptive.

"%s" 変数 %s は以前の宣言を隠します "%s" variable %s masks earlier declaration

この警告はより矛盾の無いケースで発行されます; 簡単に言うと, 呼び出される宣言は my 変数です: This warning is now emitted in more consistent cases; in short, when one of the declarations involved is a my variable:

    my $x;   my $x;	# warns
    my $x;  our $x;	# warns
    our $x;  my $x;	# warns

一方, On the other hand, the following:

    our $x; our $x;

これは "our" variable %s redeclared 警告となります. now gives a "our" variable %s redeclared warning.

readdir()/closedir()/etc. 無効なディレクトリハンドルで処理されました readdir()/closedir()/etc. attempted on invalid dirhandle

ディレクトリハンドルが使われているけれど閉じているか実際には ディレクトリハンドルでは無い時に これらの新しい警告が発行されます. These new warnings are now emitted when a dirhandle is used but is either closed or not really a dirhandle.

開こうとしている dirhandle/filehandle %s は file/directory でもあります Opening dirhandle/filehandle %s also as a file/directory

2つの廃止警告が追加されました: (Rafael) Two deprecation warnings have been added: (Rafael)

    Opening dirhandle %s also as a file
    Opening filehandle %s also as a directory
-P の使用は廃止されます Use of -P is deprecated

Perl のコマンドラインスイッチ -P は廃止されます. Perl's command-line switch -P is now deprecated.

use/require での v-string はポータブルではありません v-string in use/require is non-portable

use VERSION 構文での潜在的な後方互換問題を警告するようになります. Perl will warn you against potential backwards compatibility problems with the use VERSION syntax.

perl -V

perl -V で幾つか改善があります, シェルスクリプトから設定変数の値を取り出し易くしています. 詳細は perlrun を参照してください. perl -V has several improvements, making it more useable from shell scripts to get the value of configuration variables. See perlrun for details.


内部処理の変更 Changed Internals

一般的に, perl のソースコードは様々な場所でリファクタリングされ, 整頓され, そして最適化されました. また, メモリ管理及び 確保は幾つかの点で改善されました. In general, the source code of perl has been refactored, tidied up, and optimized in many places. Also, memory management and allocation has been improved in several points.

perl コアを gcc でコンパイルするとき, そのプラットフォームで可能なだけの gcc 警告フラグが 有効にされます. (この清潔探訪は XS コードには 適用されません, なぜなら私たちが書いたわけではないコードの きれいさは保証できないからです.) 他の C コンパイラでは strict フラグのようなものが追加もしくは適用されます. When compiling the perl core with gcc, as many gcc warning flags are turned on as is possible on the platform. (This quest for cleanliness doesn't extend to XS code because we cannot guarantee the tidiness of code we didn't write.) Similar strictness flags have been added or tightened for various other C compilers.

SVt_* 定数の再配置 Reordering of SVt_* constants

幾つかのタイプの SV を定義する定数の相対的な順序が変更されました; 特に, SVt_PVGVSVt_PVLV, SVt_PVAV, SVt_PVHV そして SVt_PVCV の前に移動しました. これは明示的にその順序を前提としている コードを持っているのでなければ何らかの違いを作るでしょう. (B::* オブジェクトの継承階層はこれを反映して変更されました.) The relative ordering of constants that define the various types of SV have changed; in particular, SVt_PVGV has been moved before SVt_PVLV, SVt_PVAV, SVt_PVHV and SVt_PVCV. This is unlikely to make any difference unless you have code that explicitly makes assumptions about that ordering. (The inheritance hierarchy of B::* objects has been changed to reflect this.)

SVt_PVBM の除去 Elimination of SVt_PVBM

これに関連して, 内部的なタイプ SVt_PVBM は削除されました. この SV の献身的なタイプは index 演算子と正規表現エンジンの 一部で, 高速な Boyer-Moore マッチを補助するために使われていました. この利用は内部的にタイプ SVt_PVGVSV によって置き換えられました. Related to this, the internal type SVt_PVBM has been been removed. This dedicated type of SV was used by the index operator and parts of the regexp engine to facilitate fast Boyer-Moore matches. Its use internally has been replaced by SVs of type SVt_PVGV.

新しいタイプ SVt_BIND New type SVt_BIND

新しいタイプ SVt_BIND が追加されました, Perl 5 で Perl 6 を 実装するプロジェクトを考慮してです. これは意図的に実装されていません, そして作成も破棄もされません. A new type SVt_BIND has been added, in readiness for the project to implement Perl 6 on 5. There deliberately is no implementation yet, and they cannot yet be created or destroyed.

CPP シンボルの除去 Removal of CPP symbols

渡したバージョンに対して一番古いバイナリ互換のある perl のバージョンを 与えると推測される C プリプロセッサシンボル PERL_PM_APIVERSION 及び PERL_XS_APIVERSION は利用されておらず, 時々間違った値を返しています. これらは削除されます. The C preprocessor symbols PERL_PM_APIVERSION and PERL_XS_APIVERSION, which were supposed to give the version number of the oldest perl binary-compatible (resp. source-compatible) with the present one, were not used, and sometimes had misleading values. They have been removed.

op に必要な空間の削減 Less space is used by ops

BASEOP 構造はより省スペースになりました. op_seq フィールドは削除され, 1ビットのビットフィールド op_opt に沖かられました. op_type は 9 bit 長になりました. この結果, B::OP クラスは seq メソッドを提供しなくなります.) The BASEOP structure now uses less space. The op_seq field has been removed and replaced by a single bit bit-field op_opt. op_type is now 9 bits long. (Consequently, the B::OP class doesn't provide an seq method anymore.)

新しいパーサ New parser

perl のパーサが bison で生成されるようになりました (これまでは byacc で生成されていました). この結果, ちょこっと強靭になると思います. perl's parser is now generated by bison (it used to be generated by byacc.) As a result, it seems to be a bit more robust.

また, Dave Mitchell は -DT における字句解析デバッグ出力を改善しました. Also, Dave Mitchell improved the lexer debugging output under -DT.

const の使用 Use of const

Andy Lester はどの関数パラメータやローカル変数が実際には C コンパイラに対して const で宣言することが出来るかを 決定するための多くの改良を提供してくれました. Steve Peters は新しい *_set マクロを提供し, コアが LVALUE コンテキストでマクロに代入する代わりに これらを使うように書き直してくれました. Andy Lester supplied many improvements to determine which function parameters and local variables could actually be declared const to the C compiler. Steve Peters provided new *_set macros and reworked the core to use these rather than assigning to macros in LVALUE context.

Mathoms

新しいファイル, mathoms.c が追加されました. これには perl コアでは使われていないけれど バイナリ若しくはソース互換性の理由から提供を続ける関数が 含まれています. とはいってもこれらの関数は コンパイラフラグに -DNO_MATHOMS を加えるとコンパイルされなくなります. A new file, mathoms.c, has been added. It contains functions that are no longer used in the perl core, but that remain available for binary or source compatibility reasons. However, those functions will not be compiled in if you add -DNO_MATHOMS in the compiler flags.

AvFLAGS は削除されました AvFLAGS has been removed

AvFLAGS マクロは削除されました. The AvFLAGS macro has been removed.

av_* の変更 av_* changes

配列を操作するために使われる av_*() 関数は null の AV* パラメータを受理しなくなりました. The av_*() functions, used to manipulate arrays, no longer accept null AV* parameters.

$^H 及び %^H $^H and %^H

特殊変数 $^H 及び %^H の実装が, pure Perl で レキシカルプラグマを実装できるように変更されました. The implementation of the special variables $^H and %^H has changed, to allow implementing lexical pragmas in pure Perl.

B:: モジュールの継承の変更 B:: modules inheritance changed

B:: モジュールの継承階層が変更されました. B::NVB::SV から継承されるようになります (以前は B::IV から継承していました). The inheritance hierarchy of B:: modules has changed; B::NV now inherits from B::SV (it used to inherit from B::IV).

無名のハッシュ及び配列の構築子 Anonymous hash and array constructors

無名のハッシュ及び配列の構築子は optree において 3 つから 1 つの op となりました, pp_anonhash 及び pp_anonlist は op に OPf_SPECIAL フラグが経っている時にはハッシュ/配列への リファレンスを返すようになります. (Nicholas Clark) The anonymous hash and array constructors now take 1 op in the optree instead of 3, now that pp_anonhash and pp_anonlist return a reference to an hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark)


既知の問題 Known Problems

レキシカルな $_ の実装における問題があります: これは /(?{...})/ ブロックの内側では動作しません. (t/op/mydef.t にある TODO テストを参照) There's still a remaining problem in the implementation of the lexical $_: it doesn't work inside /(?{...})/ blocks. (See the TODO test in t/op/mydef.t.)

スタックされたファイルテスト演算子は filetest プラグマの影響下では動作しません, なぜならそれらは _ の stat() バッファを利用していますが, filetest は stat() を バイパスするためです. Stacked filetest operators won't work when the filetest pragma is in effect, because they rely on the stat() buffer _ being populated, and filetest bypasses stat().

UTF-8 に関する問題 UTF-8 problems

Unicode の処理は幾つかの箇所で文字列が内部的に UTF-8 フラグを 持っているかに依存して明白になっていません. これは perl 5.12 でより奇麗になるでしょう, しかしそれには ある程度の後方互換の消失がさけられません. The handling of Unicode still is unclean in several places, where it's dependent on whether a string is internally flagged as UTF-8. This will be made more consistent in perl 5.12, but that won't be possible without a certain amount of backwards incompatibility.


プラットホーム固有の問題 Platform Specific Problems

Linux 上で g++ 及びスレッドサポートでコンパイルすると, $! が正常な動作をしていないと報告されます. これは glibc が2つの strerror_r(3) の実装を 提供していて, perl は正しくない方を選択してしまうことに 起因します. When compiled with g++ and thread support on Linux, it's reported that the $! stops working correctly. This is related to the fact that the glibc provides two strerror_r(3) implementation, and perl selects the wrong one.


バグ報告 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 及び perl590delta から perl595delta の マニュアルページ群に完全な変更箇所があります. The Changes file and the perl590delta to perl595delta man pages 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 perl 5.10.0. 翻訳日: 2007-12-19. Origlnal distribution is perl VERSION 5.10.0. Translated at 2007-12-19.

perldelta - perl 5.10.0 の新機能
perldelta - what is new for perl 5.10.0

索引 INDEX

perldelta - perl 5.10.0 の新機能
perldelta - what is new for perl 5.10.0