【发布时间】:2011-05-01 19:58:08
【问题描述】:
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 作者及其与模块、名称、邮件地址等相关的工作。
【问题讨论】:
-
嗨,你好,思南 - 美好的一天!非常感谢您的帮助问候呆伯特