14

We consider to use Minilla or Dist::Milla for our perl development. Declaring dependencies is done via cpanfile. I expected to find an exact definintion of what and how can be declared. But

  • perldoc cpanfile : Shows only the principal usage. 'SEE ALSO' section does not help.

  • perldoc Module::CPANfile: same as cpanfile.

  • perldoc cpanfile-faq: no explanation of the exact syntax or a link to it, only

Familiar DSL syntax

This is a new file type, but the format and syntax isn't entirely new. The metadata it can declare is exactly a subset of "Prereqs" in CPAN Meta Spec.

The syntax borrows a lot from Module::Install. Module::Install is a great way to easily declare module metadata such as name, author and dependencies. cpanfile format is simply to extract the dependencies into a separate file, which means most of the developers are familiar with the syntax.

Does anybody know where to find an exact description of the cpanfile syntax/format ?

4

1 回答 1

7

我安装Module::CPANFile并且perldoc cpanfile可以perldoc cpanfile-faq 使用。

状态的 POD cpanfile

[the] cpanfile specification (this document) is based on Ruby's
Gemfile http://gembundler.com/man/gemfile.5.html specification.

手册页中的链接cpanfile已损坏。它应该指向:http ://bundler.io/v1.3/man/gemfile.5.html

cpanfile旨在与Module::InstallDSL 语法“向后兼容”,并且“可转换为 CPAN::Meta::Prereqs”并受CPAN::Meta Spec v.2等 启发。

据我了解,它cpanfile在某种程度上是一种“元格式”,适用于一系列 TIMTOWTDI 方法(参见miyagawa 的博客描述cpanfile),兼容Module::Install并主要是自文档化。例如,如果您mymeta-cpanfile在包含文件的目录中运行META,它将cpanfile为您构建一个;您可以编写一个描述先决条件的脚本,CPAN::Meta::Prereqs然后$file->save('cpanfile');编写一个cpanfile.

至于Dist::Milla,在教程(参见POD随附的Dist::Milla)中,miyagawa 指出“如果您决定手动构建 [a] new cpanfile,格式大多兼容 Module::InstallDSL 的要求”。本教程还提供了一个简短的示例。

我认为让miyagawa在分发的文档中cpanfile澄清规范/格式的状态和用例是公平的。那和更多的例子会回答像你这样的问题。他已经完成了这方面的大部分工作——只是不是全部在一个地方。

于 2013-07-17T17:19:27.197 回答