名前¶
Pod::Cpandoc - perldoc that works for modules you don't have installed
Pod::Cpandoc - インストールしていないモジュールでも機能する perldoc
概要¶
cpandoc File::Find
-- shows the documentation of your installed File::Find
cpandoc Acme::BadExample
-- works even if you don't have Acme::BadExample installed!
cpandoc -v '$?'
-- passes everything through to regular perldoc
cpandoc -m Acme::BadExample | grep system
-- options are respected even if the module was scraped
vim `cpandoc -l Web::Scraper`
-- getting the idea yet?
cpandoc File::Find
-- インストール済みの File::Find のドキュメントを表示
cpandoc Acme::BadExample
-- Acme::BadExample をインストールしてなくても動くよ!
cpandoc -v '$?'
-- すべてが標準の perldoc に渡されます
cpandoc -m Acme::BadExample | grep system
-- スクレイピングしてきたモジュールにも(perldoc の)オプションは使えます
vim `cpandoc -l Web::Scraper`
-- もうわかるよね?
説明¶
cpandoc is a perl script that acts like perldoc except that if it would have bailed out with No documentation found for "Uninstalled::Module", it will instead scrape a CPAN index for the module's documentation.
One important feature of cpandoc is that it only scrapes the live index if you do not have the module installed. So if you use cpandoc on a module you already have installed, then it will just read the already-installed documentation. This means that the version of the documentation matches up with the version of the code you have. As a fringe benefit, cpandoc will be fast for modules you've installed. :)
All this means that you should be able to drop in cpandoc in place of perldoc and have everything keep working. See "SNEAKY INSTALL" for how to do this.
If you set the environment variable CPANDOC_FETCH to a true value, then we will print a message to STDERR telling you that cpandoc is going to make a request against the live CPAN index.
cpandoc は、インストールされてなくてモジュールのドキュメントが見つからないという場面で、かわりにCPAN をスクレイピングすることでうまく取り持ってくれるということをのぞいては、perldoc と同じように振舞います。
cpandocの重要な機能は、インストールしていないモジュールをスクレイピングすることだけです。 すでにインストールしているモジュールに使えば、インストールされたドキュメントを読めます。 これは、ドキュメントのバージョンとコードのバージョンが一致することを意味します。 cpandoc はあなたがモジュールをインストールするのを早くするちょっといい効用があります。
perldoc を cpandoc にすべて差し替えても無事動き続けます。 差し替え方は、以下の "SNEAKY INSTALL" を参照してください。
環境変数 CPANDOC_FETCH に正の値を設定すると、CPAN へのリクエストを STDERR にメッセージ出力します。
SNEAKY INSTALL¶
cpanm Pod::Cpandoc
then: alias perldoc=cpandoc
or: function perldoc () { cpandoc "$@" }
Now `perldoc Acme::BadExample` works!
perldoc should continue to work for everything that you're used to, since cpandoc passes all options through to it. cpandoc is merely a subclass that falls back to scraping a CPAN index when it fails to find your queried file in @INC.
cpanm Pod::Cpandoc
インストールしたら: alias perldoc=cpandoc
もしくは: function perldoc () { cpandoc "$@" }
これで `perldoc Acme::BadExample` が動くよ!
cpandoc からオプションを渡される場合でも、perldoc はすべてこれまでと同じように機能します。 cpandoc は @INC からファイルがみつからないときに、CPAN にスクレイピングしにいくだけのサブクラスにすぎないのです。
SEE ALSO¶
The sneaky install was inspired by https://github.com/defunkt/hub.
http://tech.bayashi.jp/archives/entry/perl-module/2011/003305.html
作者¶
Shawn M Moore sartak@gmail.com
コピーライト¶
Copyright 2011 Shawn M Moore.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.