在咱們使用別人寫好的程序時,常常會使用-h 之類的東西查看一下簡單的幫助手冊或者說明信息;html
對於perl 語言而言,寫起來簡單,常常隨手一寫,解決了當時的問題,可是過幾天去看,你都不知道這個腳本該怎麼調用,是用來作什麼的;node
爲了不這樣的狀況,對於經常使用的腳本,有必要提供較爲清晰的幫助文檔。git
在perl 裏面,官方提供了這樣的註釋手段,看下面的代碼示例github
=pod =head1 NAME L<Transdecoder.LongOrfs|http://transdecoder.github.io> - Transcriptome Protein Prediction =head1 USAGE Required: -t <string> transcripts.fasta Optional: --gene_trans_map <string> gene-to-transcript identifier mapping file (tab-delimited, gene_id<tab>trans_id<return> ) -m <int> minimum protein length (default: 100) -G <string> genetic code (default: universal; see PerlDoc; options: Euplotes, Tetrahymena, Candida, Acetabularia) -S strand-specific (only analyzes top strand) =head1 Genetic Codes See L<http://golgi.harvard.edu/biolinks/gencode.html>. These are currently supported: universal (default) Euplotes Tetrahymena Candida Acetabularia Mitochondrial-Canonical Mitochondrial-Vertebrates Mitochondrial-Arthropods Mitochondrial-Echinoderms Mitochondrial-Molluscs Mitochondrial-Ascidians Mitochondrial-Nematodes Mitochondrial-Platyhelminths Mitochondrial-Yeasts Mitochondrial-Euascomycetes Mitochondrial-Protozoans =cut
=pod 到 =cut 之間的內容是幫助信息,這些信息顯示到屏幕上時是這樣的app
NAME <Transdecoder.LongOrfs> - Transcriptome Protein Prediction USAGE Required: -t <string> transcripts.fasta Optional: --gene_trans_map <string> gene-to-transcript identifier mapping file (tab-delimited, gene_id<tab>trans_id<return> ) -m <int> minimum protein length (default: 100) -G <string> genetic code (default: universal; see PerlDoc; options: Euplotes, Tetrahymena, Candida, Acetabularia) -S strand-specific (only analyzes top strand) Genetic Codes See <http://golgi.harvard.edu/biolinks/gencode.html>. These are currently supported: universal (default) Euplotes Tetrahymena Candida Acetabularia Mitochondrial-Canonical Mitochondrial-Vertebrates Mitochondrial-Arthropods Mitochondrial-Echinoderms Mitochondrial-Molluscs Mitochondrial-Ascidians Mitochondrial-Nematodes Mitochondrial-Platyhelminths Mitochondrial-Yeasts Mitochondrial-Euascomycetes Mitochondrial-Protozoans
有表頭部分,格式上也很整齊,經過=head1 , =pod , =cut 這幾個小標籤,咱們只須要關注內容,就能夠寫出格式整齊,閱讀良好的幫助信息ide
use Pod::Usage; pod2usage(-verbose => 2, -output => \*STDERR) if ($help);
經過使用Pod::Usage 模塊,加能夠將寫好的上述格式的註釋,方便的顯示在屏幕上,結合if 等判斷語句,自定義觸發條件;ui