5.18.1

名前

perlmodinstall - Installing CPAN Modules

perlmodinstall - CPAN モジュールのインストール

説明

You can think of a module as the fundamental unit of reusable Perl code; see perlmod for details. Whenever anyone creates a chunk of Perl code that they think will be useful to the world, they register as a Perl developer at http://www.cpan.org/modules/04pause.html so that they can then upload their code to the CPAN. The CPAN is the Comprehensive Perl Archive Network and can be accessed at http://www.cpan.org/ , and searched at http://search.cpan.org/ .

モジュールは、再利用可能な Perl コードの基本単位と考えることができます; 詳しくは、perlmod を参照してください。 誰かが世界に役立つと思う Perl コードの塊を作成したら、 http://www.cpan.org/modules/04pause.html に Perl 開発者として登録し、 CPAN にコードをアップロードできるようにします。 CPAN は Comprehensive Perl Archive Network で、 http://www.cpan.org/ でアクセスでき、http://search.cpan.org/ で検索できます。

This documentation is for people who want to download CPAN modules and install them on their own computer.

この文書は、CPAN モジュールをダウンロードして自分のコンピュータに インストールしたい人のためのものです。

PREAMBLE

First, are you sure that the module isn't already on your system? Try perl -MFoo -e 1. (Replace "Foo" with the name of the module; for instance, perl -MCGI::Carp -e 1.)

まず、モジュールがまだシステムにインストールされていないことを 確認しましたか? perl -MFoo -e 1 を試してみてください。 ("Foo" をモジュールの名前に置き換え、 例えば perl -MCGI::Carp -e 1 のようにします。)

If you don't see an error message, you have the module. (If you do see an error message, it's still possible you have the module, but that it's not in your path, which you can display with perl -e "print qq(@INC)".) For the remainder of this document, we'll assume that you really honestly truly lack an installed module, but have found it on the CPAN.

エラーメッセージが表示されない場合は、モジュールがあります (エラーメッセージが表示された場合は、モジュールはまだありますが、 そのモジュールがパスにない可能性があります。 パスは perl -e "print qq(@INC)" で表示できます)。 この文書の残りの部分では、そのモジュールは実際に本当に絶対に インストールされておらず、 しかし CPAN 上にはモジュールがあると仮定します。

So now you have a file ending in .tar.gz (or, less often, .zip). You know there's a tasty module inside. There are four steps you must now take:

それで、今あなたは .tar.gz (または、それほど頻繁ではありませんが .zip)で 終わるファイルを持っています。 中においしいモジュールがあることは知っています。 次の四つのステップを踏む必要があります:

DECOMPRESS the file

(ファイルを 伸張 する)

UNPACK the file into a directory

(ファイルをディレクトリに 展開 する)

BUILD the module (sometimes unnecessary)

(モジュールを ビルド する (不要の場合もあります))

INSTALL the module.

(モジュールを インストール する)

Here's how to perform each step for each operating system. This is <not> a substitute for reading the README and INSTALL files that might have come with your module!

ここでは、各オペレーティングシステムに対して各ステップを実行する方法を 説明します。 これは、モジュールに付属している README ファイルと INSTALL ファイルを 読む代わりでは <ありません>!

Also note that these instructions are tailored for installing the module into your system's repository of Perl modules, but you can install modules into any directory you wish. For instance, where I say perl Makefile.PL, you can substitute perl Makefile.PL PREFIX=/my/perl_directory to install the modules into /my/perl_directory. Then you can use the modules from your Perl programs with use lib "/my/perl_directory/lib/site_perl"; or sometimes just use "/my/perl_directory";. If you're on a system that requires superuser/root access to install modules into the directories you see when you type perl -e "print qq(@INC)", you'll want to install them into a local directory (such as your home directory) and use this approach.

また、これらの指示は、システムの Perl モジュールのリポジトリにモジュールを インストールするように調整されていることにも注意してください; ただし、モジュールは任意のディレクトリにインストールできます。 例えば、perl Makefile.PL の場合、 /my/perl_directory にインストールするために perl Makefile.PL PREFIX=/my/perl_directory と 置き換えることができます。 次に、Perl プログラムのモジュールを use lib "/my/perl_directory/lib/site_perl"; で使用することもできますし、 場合によっては単に use "/my/perl_directory"; で使用することもできます。 perl -e "print qq(@INC)" と入力したときに表示されるディレクトリに モジュールをインストールするためにスーパーユーザー /root アクセスを 必要とするシステムを使用している場合は、ローカルディレクトリ (ホームディレクトリなど)にモジュールをインストールし、 この方法を使用します。

  • If you're on a Unix or Unix-like system,

    Unix または Unix 風のシステムの場合

    You can use Andreas Koenig's CPAN module ( http://www.cpan.org/modules/by-module/CPAN ) to automate the following steps, from DECOMPRESS through INSTALL.

    Andreas Koenig の CPAN モジュール (http://www.cpan.org/modules/by-module/CPAN) を使えば、 DECOMPRESS から INSTALL までのステップを自動化することができます。

    A. DECOMPRESS

    A. 伸張

    Decompress the file with gzip -d yourmodule.tar.gz

    gzip -d yourmodule.tar.gz でファイルを伸張します。

    You can get gzip from ftp://prep.ai.mit.edu/pub/gnu/

    ftp://prep.ai.mit.edu/pub/gnu/ から gzip を入手できます。

    Or, you can combine this step with the next to save disk space:

    または、この手順と次の手順を組み合わせてディスク領域を節約することもできます:

         gzip -dc yourmodule.tar.gz | tar -xof -

    B. UNPACK

    B. 展開

    Unpack the result with tar -xof yourmodule.tar

    結果 をtar -xof yourmodule.tar で展開します。

    C. BUILD

    C. ビルド

    Go into the newly-created directory and type:

    新しく作成されたディレクトリに移動し、次のように入力します:

          perl Makefile.PL
          make test

    or

    または

          perl Makefile.PL PREFIX=/my/perl_directory

    to install it locally. (Remember that if you do this, you'll have to put use lib "/my/perl_directory"; near the top of the program that is to use this module.

    とするとローカルにインストールします。 (これを行う場合は、このモジュールを使うプログラムの先頭近くに use lib "/my/perl_directory"; を置かなければならないことを 覚えておいてください。)

    D. INSTALL

    D. インストール

    While still in that directory, type:

    そのディレクトリにある状態で、次のように入力します:

          make install

    Make sure you have the appropriate permissions to install the module in your Perl 5 library directory. Often, you'll need to be root.

    モジュールを Perl 5 ライブラリーディレクトリにインストールするための 適切な許可を持っていることを確認してください。 多くの場合、root になる必要があります。

    That's all you need to do on Unix systems with dynamic linking. Most Unix systems have dynamic linking. If yours doesn't, or if for another reason you have a statically-linked perl, and the module requires compilation, you'll need to build a new Perl binary that includes the module. Again, you'll probably need to be root.

    動的リンク機能を備えた Unix システムで行う必要があるのはこれだけです。 ほとんどの Unix システムには動的リンク機能があります。 動的リンク機能がない場合や、別の理由で静的にリンクされた perl を 持っていて、かつ モジュールをコンパイルする必要がある場合は、 このモジュールを含む新しい Perl バイナリを作成する必要があります。 ここでもおそらく root になる必要があります。

  • If you're running ActivePerl (Win95/98/2K/NT/XP, Linux, Solaris),

    ActivePerl (Win95/98/2K/NT/XP, Linux, Solaris) を実行している場合

    First, type ppm from a shell and see whether ActiveState's PPM repository has your module. If so, you can install it with ppm and you won't have to bother with any of the other steps here. You might be able to use the CPAN instructions from the "Unix or Linux" section above as well; give it a try. Otherwise, you'll have to follow the steps below.

    まず、シェルから ppm と入力して、ActiveState の PPM リポジトリに あなたのモジュールがあるかどうかを確認します。 もしあるなら、ppm と一緒にインストールすることができますし、 ここで他の手順に煩わされることもありません。 上の「Unix または Linux」セクションにある CPAN の指示も 使えるかもしれません; 試してみてください。 そうでなければ、以下の手順に従わなければなりません。

       A. DECOMPRESS

    You can use the shareware Winzip ( http://www.winzip.com ) to decompress and unpack modules.

    シェアウェアの Winzip(http://www.winzip.com) を使用して、 モジュールを伸張および展開できます。

       B. UNPACK

    If you used WinZip, this was already done for you.

    WinZip を使用している場合は、これは既に行われています。

       C. BUILD

    You'll need the nmake utility, available at http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe or dmake, available on CPAN. http://search.cpan.org/dist/dmake/

    nmake ユーティリティ (http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe から入手可能)または dmake (CPAN から入手可能)が必要です。 http://search.cpan.org/dist/dmake/

    Does the module require compilation (i.e. does it have files that end in .xs, .c, .h, .y, .cc, .cxx, or .C)? If it does, life is now officially tough for you, because you have to compile the module yourself (no easy feat on Windows). You'll need a compiler such as Visual C++. Alternatively, you can download a pre-built PPM package from ActiveState. http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/

    モジュールをコンパイルする必要がありますか (.xs, .c, .h, .y, .cc, .cxx, .C で終わるファイルがありますか)? もしそうなら、人生は公式に厳しいものです; なぜなら、自分でモジュールをコンパイルしなければなりません (Windows では簡単にはできません)。 Visual C++ などのコンパイラが必要になります。 あるいは、ActiveState からビルド済みの PPM パッケージを ダウンロードすることもできます。 http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/

    Go into the newly-created directory and type:

    新しく作成されたディレクトリに移動し、次のように入力します:

          perl Makefile.PL
          nmake test
    
       D. INSTALL

    While still in that directory, type:

    そのディレクトリにいる状態で、次のように入力します。

          nmake install
  • If you're using a Macintosh with "Classic" MacOS and MacPerl,

    Macintosh で "Classic" MacOS と MacPerl を使っているなら

    A. DECOMPRESS

    A. 伸張

    First, make sure you have the latest cpan-mac distribution ( http://www.cpan.org/authors/id/CNANDOR/ ), which has utilities for doing all of the steps. Read the cpan-mac directions carefully and install it. If you choose not to use cpan-mac for some reason, there are alternatives listed here.

    まず、最新の cpan-mac ディストリビューション (http://www.cpan.org/authors/id/CNANDOR/) があることを確認してください; このディストリビューションには、すべての手順を実行するための ユーティリティがあります。 cpan-mac の説明をよく読んでインストールしてください。 何らかの理由で cpan-mac を使わないことを選択した場合は、 ここにリストされている他の方法があります。

    After installing cpan-mac, drop the module archive on the untarzipme droplet, which will decompress and unpack for you.

    cpan-mac をインストールしたら、モジュールアーカイブ を untarzipme droplet にドロップします。 これで伸張と展開が行われます。

    Or, you can either use the shareware StuffIt Expander program ( http://my.smithmicro.com/mac/stuffit/ ) or the freeware MacGzip program ( http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html ).

    あるいは、シェアウェアの StuffIt Expander プログラム ( http://my.smithmicro.com/mac/stuffit/ ) を使うか、 フリーウェアの MacGzip プログラム (http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html) を 使うことができます。

    B. UNPACK

    B. 展開

    If you're using untarzipme or StuffIt, the archive should be extracted now. Or, you can use the freeware suntar or Tar ( http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/ ).

    untarzipme や StuffIt を使用している場合は、ここでアーカイブを 伸張する必要があります。 あるいは、フリーウェアの suntarTar(http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/) を 使用できます。

    C. BUILD

    C. ビルド

    Check the contents of the distribution. Read the module's documentation, looking for reasons why you might have trouble using it with MacPerl. Look for .xs and .c files, which normally denote that the distribution must be compiled, and you cannot install it "out of the box." (See "PORTABILITY".)

    配布物の内容を確認してください。 モジュールの文書を読み、MacPerl での使用に問題がある理由を探してください。 .xs ファイルと .c ファイルを探してください; これらのファイルは通常、配布物をコンパイルする必要があることを示しており、 「そのまま」インストールすることはできません ("PORTABILITY" を参照)。

    D. INSTALL

    D. インストール

    If you are using cpan-mac, just drop the folder on the installme droplet, and use the module.

    cpan-mac を使用している場合は、単に installme droplet にフォルダを ドロップし、モジュールを使用します。

    Or, if you aren't using cpan-mac, do some manual labor.

    または、もしあなたが cpan-mac を使っていないなら、手作業をしてください。

    Make sure the newlines for the modules are in Mac format, not Unix format. If they are not then you might have decompressed them incorrectly. Check your decompression and unpacking utilities settings to make sure they are translating text files properly.

    モジュールの改行が Unix 形式ではなく Mac 形式であることを確認してください。 そうでない場合は、正しく解凍されていない可能性があります。 伸張と展開のユーティリティの設定をチェックして、 テキストファイルが正しく変換されていることを確認してください。

    As a last resort, you can use the perl one-liner:

    最後の手段として、perl の一行野郎を使用することができます:

        perl -i.bak -pe 's/(?:\015)?\012/\015/g' <filenames>

    on the source files.

    これをソースファイルに行います。

    Then move the files (probably just the .pm files, though there may be some additional ones, too; check the module documentation) to their final destination: This will most likely be in $ENV{MACPERL}site_lib: (i.e., HD:MacPerl folder:site_lib:). You can add new paths to the default @INC in the Preferences menu item in the MacPerl application ($ENV{MACPERL}site_lib: is added automagically). Create whatever directory structures are required (i.e., for Some::Module, create $ENV{MACPERL}site_lib:Some: and put Module.pm in that directory).

    次に、ファイル(おそらく .pm ファイルだけですが、追加のファイルが あることもあります; モジュールの文書を確認してください) を 最終的なインストール先に移動させます: これはおそらく $ENV{MACPERL}site_lib: (つまり HD:MacPerl folder:site_lib:) でしょう。 MacPerl アプリケーションの環境設定メニュー項目でデフォルトの @INC に 新しいパスを追加できます($ENV{MACPERL}site_lib:は自動的に追加されます)。 必要なディレクトリ構造を (つまり、Some::Moduleの場合は、 $ENV{MACPERL}site_lib:Some:) を作成し、そのディレクトリに Module.pm を配置します。

    Then run the following script (or something like it):

    次のスクリプト (または同様のスクリプト) を実行します:

         #!perl -w
         use AutoSplit;
         my $dir = "${MACPERL}site_perl";
         autosplit("$dir:Some:Module.pm", "$dir:auto", 0, 1, 1);
  • If you're on the DJGPP port of DOS,

    DOS の DJGPP 版を使っているなら

       A. DECOMPRESS

    djtarx ( ftp://ftp.delorie.com/pub/djgpp/current/v2/ ) will both uncompress and unpack.

    djtarx ( ftp://ftp.delorie.com/pub/djgpp/current/v2/ ) は 伸張と展開の両方を行います。

       B. UNPACK

    See above.

    上記を参照してください。

       C. BUILD

    Go into the newly-created directory and type:

    新しく作成されたディレクトリに移動し、次のように入力します:

          perl Makefile.PL
          make test

    You will need the packages mentioned in README.dos in the Perl distribution.

    Perl ディストリビューションの README.dos に記載されているパッケージが 必要です。

       D. INSTALL

    While still in that directory, type:

    そのディレクトリにいる状態で、次のように入力します:

         make install       

    You will need the packages mentioned in README.dos in the Perl distribution.

    Perl ディストリビューションの README.dos に記載されているパッケージが 必要です。

  • If you're on OS/2,

    OS/2 を使用している場合

    Get the EMX development suite and gzip/tar, from either Hobbes ( http://hobbes.nmsu.edu ) or Leo ( http://www.leo.org ), and then follow the instructions for Unix.

    Hobbes (http://hobbes.nmsu.edu) または Leo(http://www.leo.org) から EMX 開発スイートと gzip/tar を入手し、Unix 用の指示に従ってください。

  • If you're on VMS,

    VMS を使用している場合

    When downloading from CPAN, save your file with a .tgz extension instead of .tar.gz. All other periods in the filename should be replaced with underscores. For example, Your-Module-1.33.tar.gz should be downloaded as Your-Module-1_33.tgz.

    CPAN からダウンロードする場合は、ファイルを .tar.gz ではなく .tgz 拡張子で保存します。 ファイル名の他のすべてのピリオドはアンダースコアに置き換える必要があります。 たとえば、Your-Module-1.33.tar.gzYour-Module-1_33.tgz として ダウンロードする必要があります。

    A. DECOMPRESS

    A. 伸張

    Type

    次のように入力します:

        gzip -d Your-Module.tgz

    or, for zipped modules, type

    または、zip モジュールの場合は、次のように入力します:

        unzip Your-Module.zip

    Executables for gzip, zip, and VMStar:

    gzip, zip, VMStar 用の実行可能ファイル:

        http://www.hp.com/go/openvms/freeware/

    and their source code:

    ソースコード:

        http://www.fsf.org/order/ftp.html

    Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip package. The former is a simple compression tool; the latter permits creation of multi-file archives.

    GNU の gzip/gunzip は Info-ZIP の zip/unzip パッケージと 同じではないことに注意してください。 前者は単純な圧縮ツールです; 後者は複数ファイルの アーカイブの作成を可能にします。

    B. UNPACK

    B. 展開

    If you're using VMStar:

    VMStar を使用する場合:

         VMStar xf Your-Module.tar

    Or, if you're fond of VMS command syntax:

    あるいは、VMS コマンドの文法が好きなら:

         tar/extract/verbose Your_Module.tar

    C. BUILD

    C. ビルド

    Make sure you have MMS (from Digital) or the freeware MMK ( available from MadGoat at http://www.madgoat.com ). Then type this to create the DESCRIP.MMS for the module:

    MMS(Digital から)かフリーウェアの MMK(MadGoat http://www.madgoat.com から 入手可能)があることを確認してください。 次に次のように入力してモジュール用の DESIPP.MMS を作成します:

        perl Makefile.PL

    Now you're ready to build:

    これでビルドの準備ができました:

        mms test

    Substitute mmk for mms above if you're using MMK.

    MMK を使っている場合は、上記の mmsmmk に置き換えてください。

    D. INSTALL

    D. インストール

    Type

    次のように入力します:

        mms install

    Substitute mmk for mms above if you're using MMK.

    MMK を使っている場合は、上記の mmsmmk に置き換えてください。

  • If you're on MVS,

    MVS を使っている場合

    Introduce the .tar.gz file into an HFS as binary; don't translate from ASCII to EBCDIC.

    .tar.gz ファイルをバイナリとして HFS に導入します。 ASCII から EBCDIC に変換しないでください。

    A. DECOMPRESS

    A. 伸張

    Decompress the file with gzip -d yourmodule.tar.gz

    gzip -d yourmodule.tar.gz でファイルを伸張します。

    You can get gzip from http://www.s390.ibm.com/products/oe/bpxqp1.html

    gzip は http://www.s390.ibm.com/products/oe/bpxqp1.html から入手できます。

    B. UNPACK

    B. 展開

    Unpack the result with

    結果を次のように展開します。

         pax -o to=IBM-1047,from=ISO8859-1 -r < yourmodule.tar

    The BUILD and INSTALL steps are identical to those for Unix. Some modules generate Makefiles that work better with GNU make, which is available from http://www.mks.com/s390/gnu/

    BUILD と INSTALL の手順は Unix の場合と同じです。 いくつかのモジュールは GNU make でより良く動作する Makefile を生成します; これは http://www.mks.com/s390/gnu/ から入手できます。

移植性

Note that not all modules will work with on all platforms. See perlport for more information on portability issues. Read the documentation to see if the module will work on your system. There are basically three categories of modules that will not work "out of the box" with all platforms (with some possibility of overlap):

すべてのモジュールがすべてのプラットフォームで 動作するわけではないことに注意してください。 移植性の問題についての詳細は perlport を参照してください。 モジュールがお使いのシステムで動作するかどうかは、 文書を読んで確認してください。 すべてのプラットフォームで「そのままで」動作しないモジュールには、 基本的に三つのカテゴリがあります(重複する可能性もあります):

  • Those that should, but don't. These need to be fixed; consider contacting the author and possibly writing a patch.

    動作するはずなのに動作しない。 これらは修正する必要があります; 作者に連絡してパッチを書くことを検討してください。

  • Those that need to be compiled, where the target platform doesn't have compilers readily available. (These modules contain .xs or .c files, usually.) You might be able to find existing binaries on the CPAN or elsewhere, or you might want to try getting compilers and building it yourself, and then release the binary for other poor souls to use.

    コンパイルする必要があるけれども、ターゲットプラットフォームに はすぐに入手できるコンパイラがない。 (これらのモジュールには、通常 .xs または .c ファイルが含まれています。) CPAN やその他の場所で既存のバイナリを見つけることができるかもしれませんし、 あるいはコンパイラを入手して自分でビルドしてみて、他の不運な人々が 使えるようにバイナリをリリースすることもできます。

  • Those that are targeted at a specific platform. (Such as the Win32:: modules.) If the module is targeted specifically at a platform other than yours, you're out of luck, most likely.

    特定のプラットフォームをターゲットにしたモジュール。 (Win32:: モジュールなど。) モジュールがあなたのものでないプラットフォームをターゲットにしている場合は、 おそらく運がありません。

Check the CPAN Testers if a module should work with your platform but it doesn't behave as you'd expect, or you aren't sure whether or not a module will work under your platform. If the module you want isn't listed there, you can test it yourself and let CPAN Testers know, you can join CPAN Testers, or you can request it be tested.

モジュールがあなたのプラットフォームで 動作するはずなのに期待通りに動作しないか、またはモジュールが あなたのプラットフォームで動作するかどうか分からない場合は、 CPAN Testers をチェックしてください。 必要なモジュールがリストにない場合は、自分でテストして CPAN Testers に知らせたり、CPAN Testers に参加したり、テストを リクエストしたりできます。

    http://testers.cpan.org/

HEY

If you have any suggested changes for this page, let me know. Please don't send me mail asking for help on how to install your modules. There are too many modules, and too few Orwants, for me to be able to answer or even acknowledge all your questions. Contact the module author instead, or post to comp.lang.perl.modules, or ask someone familiar with Perl on your operating system.

このページで提案された変更点がありましたら、お知らせください。 モジュールのインストール方法に関するヘルプを求めるメールを私に 送らないでください。 モジュールは多すぎ、Orwants は少なすぎます; 私はあなたの質問に答えることも、すべての質問に答えることもできません。 モジュールの作成者に問い合わせるか、comp.lang.perl.modules に投稿するか、 オペレーティングシステムの Perl に精通した人に尋ねてください。

作者

Jon Orwant

orwant@medita.mit.edu

with invaluable help from Chris Nandor, and valuable help from Brandon Allbery, Charles Bailey, Graham Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley, Nick Ing-Simmons, Tuomas J. Lukka, Laszlo Molnar, Alan Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan Sugalski, Larry Virden, and Ilya Zakharevich.

Chris Nandor からの貴重な支援、そして Brandon Allbery, Charles Bailey, Graham Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley, Nick Ing-Simmons, Tuomas J. Lukka, Laszlo Molnar, Alan Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan Sugalski, Larry Virden, Ilya Zakharevich からの 価値ある助けと共に。

First version July 22, 1998; last revised November 21, 2001.

コピーライト

Copyright (C) 1998, 2002, 2003 Jon Orwant. All Rights Reserved.

This document may be distributed under the same terms as Perl itself.