Parse :: CPAN :: Authors模块的目的是什么?
use Parse::CPAN::Authors;
# must have downloaded
my $p = Parse::CPAN::Authors->new("01mailrc.txt.gz");
# either a filename as above or pass in the contents of the file
my $p = Parse::CPAN::Authors->new($mailrc_contents);
my $author = $p->author('LBROCARD');
# $a is a Parse::CPAN::Authors::Author object
# ... objects are returned by Parse::CPAN::Authors
print $author->email, "\n"; # leon@astray.com
print $author->name, "\n"; # Leon Brocard
print $author->pauseid, "\n"; # LBROCARD
# all the author objects
my @authors = $p->authors;
Run Code Online (Sandbox Code Playgroud)
描述
Comprehensive Perl Archive Network(CPAN)是一个非常有用的Perl代码集合.它有几个托管文件的索引,包括"authors"目录中名为"01mailrc.txt.gz"的文件.该文件包含许多有关CPAN作者的有用信息,该模块提供了一个简单的接口,用于包含在其中的数据.
请注意,此模块不关心下载此文件.你应该自己做.
这是做什么的?到底有什么好处呢?
它返回以下数据
my $author = $p->author('LBROCARD');
$a is a Parse::CPAN::Authors::Author object
... objects are returned by Parse::CPAN::Authors
print $author->email, "\n"; leon@astray.com
print $author->name, "\n"; Leon Brocard
print $author->pauseid, "\n"; LBROCARD...
Run Code Online (Sandbox Code Playgroud)
...所有CPAN作者及其在模块,名称,邮件地址等方面的工作.
您在描述部分的哪个部分遇到了麻烦?
CPAN有一些描述其内容的元数据文件.此模块允许您解析其中一个并以简单的方式提取其数据.
除非您正在编写与CPAN以编程方式交互的软件,否则此模块对您来说不太可能有用.如果我没记错的话,Leon写的是因为他需要它来编写CPAN :: Mini :: Webserver.