=encoding euc-jp =head1 NAME =begin original Win32::OLE::Const - Extract constant definitions from TypeLib =end original Win32::OLE::Const - タイプライブラリから定数定義を取り出す =head1 SYNOPSIS use Win32::OLE::Const 'Microsoft Excel'; printf "xlMarkerStyleDot = %d\n", xlMarkerStyleDot; my $wd = Win32::OLE::Const->Load("Microsoft Word 8\\.0 Object Library"); foreach my $key (keys %$wd) { printf "$key = %s\n", $wd->{$key}; } =head1 DESCRIPTION =begin original This modules makes all constants from a registered OLE type library available to the Perl program. The constant definitions can be imported as functions, providing compile time name checking. Alternatively the constants can be returned in a hash reference which avoids defining lots of functions of unknown names. =end original このモジュールはすべての定数を登録された OLE タイプライブラリから Perl プログラムで利用できるようにします。 定数定義は関数としてインポートされ、コンパイル時の名前チェックが 提供されます。 多くの知らない関数を定義することを避けて、代わりとして定数を ハッシュリファレンスとして返すこともできます。 =head2 Functions/Methods (関数/メソッド) =over 4 =item use Win32::OLE::Const =begin original The C statement can be used to directly import the constant names and values into the users namespace. =end original C ステートメントで直接、定数名と変数をユーザ名前空間に インポートするために使うことができます。 use Win32::OLE::Const (TYPELIB,MAJOR,MINOR,LANGUAGE); =begin original The TYPELIB argument specifies a regular expression for searching through the registry for the type library. Note that this argument is implicitly prefixed with C<^> to speed up matches in the most common cases. Use a typelib name like ".*Excel" to match anywhere within the description. TYPELIB is the only required argument. =end original TYPELIB 引数はタイプライブラリをレジストリで探すための正規表現を指定します。 この引数は暗黙のうちに、マッチングのスピードをほとんどの場合あげるように、 頭に C<^> がつけられることに注意してください。 記述のどこであってもマッチングするようにするには、".*Excel" のような タイプライブラリ名を使ってください。 TYPELIB だけが必須の引数です。 =begin original The MAJOR and MINOR arguments specify the requested version of the type specification. If the MAJOR argument is used then only typelibs with exactly this major version number will be matched. The MINOR argument however specifies the minimum acceptable minor version. MINOR is ignored if MAJOR is undefined. =end original MAJOR と MINOR 引数はタイプ仕様の必要とされるバージョンを指定します。 MAJOR 引数が使われると、厳密にこのメジャーバージョン番号をもった タイプライブラリだけがマッチします。 しかし MINOR 引数は最小の受け入れることのできるマイナーバージョンを 指定します。 MAJOR が未定義であれば、MINOR は無視されます。 =begin original If the LANGUAGE argument is used then only typelibs with exactly this language id will be matched. =end original LANGUAGE 引数が使われると、厳密にこの language id を持っている タイプライブラリだけがマッチします。 =begin original The module will select the typelib with the highest version number satisfying the request. If no language id is specified then a the default language (0) will be preferred over the others. =end original モジュールは要求を満たす最も高いバージョン番号のタイプライブラリを 選択します。 language id が指定されなければ、デフォルトの language (0) が他のものよりも 優先されます。 =begin original Note that only constants with valid Perl variable names will be exported, i.e. names matching this regexp: C. =end original 正しい Perl 変数名つまり名前が以下の正規表現にマッチングする: C を持つ定数だけがエクスポートされることに 注意してください。 =item Win32::OLE::Const->Load =begin original The Win32::OLE::Const->Load method returns a reference to a hash of constant definitions. =end original Win32::OLE::Const->Load メソッドは定数定義のハッシュへのリファレンスを 返します。 my $const = Win32::OLE::Const->Load(TYPELIB,MAJOR,MINOR,LANGUAGE); =begin original The parameters are the same as for the C case. =end original パラメータは C の場合と同じです。 =begin original This method is generally preferrable when the typelib uses a non-english language and the constant names contain locale specific characters not allowed in Perl variable names. =end original このメソッドは一般的にタイプライブラリが英語以外の言語を使っているときや 定数名にロケール特有の Perl 変数名として許されない文字が入っているときに 好まれます。 =begin original Another advantage is that all available constants can now be enumerated. =end original もう一つの利点は、利用できるすべての定数を列挙できることです。 =begin original The load method also accepts an OLE object as a parameter. In this case the OLE object is queried about its containing type library and no registry search is done at all. Interestingly this seems to be slower. =end original load メソッドは OLE オブジェクトもパラメータとして受け入れます。 この場合、OLE オブジェクトは、それが持っているタイプライブラリを 問い合わせられ、レジストリ検索はおこなわれなせん。 面白いことに、これはより遅いようです。 =back =head1 EXAMPLES (例) =begin original The first example imports all Excel constants names into the main namespace and prints the value of xlMarkerStyleDot (-4118). =end original 最初の例では、すべての Excel 定数名をメインの名前空間にインポートし、 xlMarkerStyleDot (-4118) の値を出力します。 use Win32::OLE::Const ('Microsoft Excel 8.0 Object Library'); print "xlMarkerStyleDot = %d\n", xlMarkerStyleDot; =begin original The second example returns all Word constants in a hash ref. =end original 2 番目の例はすべての Word 定数をハッシュリファレンスとして返します: use Win32::OLE::Const; my $wd = Win32::OLE::Const->Load("Microsoft Word 8.0 Object Library"); foreach my $key (keys %$wd) { printf "$key = %s\n", $wd->{$key}; } printf "wdGreen = %s\n", $wd->{wdGreen}; =begin original The last example uses an OLE object to specify the type library: =end original 最後の例は OLE オブジェクトをタイプライブラリを指定するために使います: use Win32::OLE; use Win32::OLE::Const; my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); my $xl = Win32::OLE::Const->Load($Excel); =head1 AUTHORS/COPYRIGHT =begin original This module is part of the Win32::OLE distribution. =end original このモジュールは Win32::OLE ディストリビューションの一部です。 =begin meta Translate: Hippo2000 (0.14) Update: SHIRAKATA Kentaro (0.1502) Status: completed =end meta =cut