## perldoc
`perldoc`?是 Perl 完整的語言參考工具。
* `perldoc perldoc`:用法介紹
* `perldoc perl`:文檔概述
* `perldoc Module`:模塊文檔
## 利用?`perldoc -f`?查閱 Perl 函數
~~~
$ perldoc -f system
system LIST
system PROGRAM LIST
Does exactly the same thing as "exec LIST", except that a fork
is done first and the parent process waits for the child
...
~~~
## 利用?`perldoc -v`?查閱 Perl 變量
~~~
$ perldoc -v '$/'
IO::Handle->input_record_separator( EXPR )
$INPUT_RECORD_SEPARATOR
$RS
$/ The input record separator, newline by default. This
...
~~~
## 利用?`perldoc -q`?搜索 Perl FAQ
~~~
$ perldoc -q database
Found in /usr/share/perl/5.18/pod/perlfaq8.pod
How do I use an SQL database?
The DBI module provides an abstract interface to most database servers
and types, including Oracle, DB2, Sybase, mysql, Postgresql, ODBC, and
...
~~~
## 利用?`perldoc modulename`?查閱 Perl 模塊文檔
如果模塊已經安裝到你的系統中,那么你可以通過?`perldoc`?閱讀該模塊的文檔。
~~~
$ perldoc WWW::Mechanize
NAME
WWW::Mechanize - Handy web browsing in a Perl object
VERSION
Version 1.73
SYNOPSIS
"WWW::Mechanize", or Mech for short, is a Perl module for stateful
programmatic web browsing, used for automating interaction with
websites.
...
~~~
對于沒有安裝的模塊,你將需要使用?[http://search.cpan.org](http://search.cpan.org/)?或?`cpandoc`。
## 利用?`cpandoc`?查閱未安裝 Perl 模塊的文檔
_Pod::Cpandoc_?模塊提供了?`cpandoc`?工具,利用該工具,即便模塊沒有安裝到 系統上,但你仍然能夠查閱該模塊的文檔。
~~~
$ cpandoc Web::Scraper
NAME
Web::Scraper - Web Scraping Toolkit using HTML and CSS Selectors or
XPath expressions
SYNOPSIS
use URI;
use Web::Scraper;
...
~~~
## 在線文檔
一些網站維護有 Perl 的 HTML 文檔,最大的兩個站點是:
1. [http://perldoc.perl.org](http://perldoc.perl.org/):語言、函數及標準庫
2. [http://search.cpan.org](http://search.cpan.org/):模塊
## 編寫自己的文檔
Perl 具有濃烈的文檔文化,我們鼓勵你早日養成此習慣。你將使用一種叫做 POD 的格式來編寫文檔。