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;
描述
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...
...所有CPAN作者及其在模块,名称,邮件地址等方面的工作。
答案 0 :(得分:8)
您在描述部分的哪个部分遇到了麻烦?
CPAN有一些描述其内容的元数据文件。此模块允许您解析其中一个并以简单的方式提取其数据。
除非您正在编写以编程方式与CPAN交互的软件,否则此模块不太可能对您有用。如果我没记错的话,莱恩写的是因为他需要它来写CPAN::Mini::Webserver。