在我们使用别人写好的程序时,经常会使用-h 之类的东西查看一下简单的帮助手册或者说明信息;
对于perl 语言而言,写起来简单,经常随手一写,解决了当时的问题,但是过几天去看,你都不知道这个脚本该怎么调用,是用来做什么的;
为了避免这样的情况,对于常用的脚本,有必要提供较为清晰的帮助文档。
在perl 里面,官方提供了这样的注释手段,看下面的代码示例
=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: ) -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 之间的内容是帮助信息,这些信息显示到屏幕上时是这样的
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 这几个小标签,我们只需要关注内容,就可以写出格式整齐,阅读良好的帮助信息
use Pod::Usage; pod2usage(-verbose => , -output => \*STDERR) if ($help);
通过使用Pod::Usage 模块,加可以将写好的上述格式的注释,方便的显示在屏幕上,结合if 等判断语句,自定义触发条件;