开发者

What is the purpose of Parse::CPAN::Authors?

开发者 https://www.devze.com 2023-01-22 04:18 出处:网络
What is the purpose of the Parse::CPAN::Authors module? use Parse::CPAN::Authors; # must have downloaded

What is the purpose of the Parse::CPAN::Authors module?

  use Parse::CPAN::Authors;

  # must have downloaded
  my $p = Parse::CPAN::Authors->new("01mailrc.txt.gz");
  # either a开发者_StackOverflow中文版 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;

DESCRIPTION

The Comprehensive Perl Archive Network (CPAN) is a very useful collection of Perl code. It has several indices of the files that it hosts, including a file named "01mailrc.txt.gz" in the "authors" directory. This file contains lots of useful information on CPAN authors and this module provides a simple interface to the data contained within.

Note that this module does not concern itself with downloading this file. You should do this yourself.

What does this do? What is it good for?

It gives back the following data

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...

… of all CPAN Authors and their work with module, name , mail-address and so on.


What part of the description section did you have trouble with?

CPAN has a few metadata files which describe its contents. This module allows you to parse one of them and extract its data in a simple fashion.

Unless you're writing software that interacts programmatically with CPAN then this module is unlikely to be useful to you. If I recall correctly, Leon wrote it because he needed it to write CPAN::Mini::Webserver.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号