【问题标题】:Using CPAN to install Dancer and dependencies使用 CPAN 安装 Dancer 和依赖项
【发布时间】:2014-01-02 22:57:57
【问题描述】:

我正在尝试使用 Dancer 创建示例 Web 服务。我使用 Ubuntu 10.04 作为我的操作系统。我使用 CPAN 客户端安装了 Dancer 和依赖项,也可以这样做

dancer -a MyApp

但是,当我尝试运行 app.pl 文件时,代码会引发错误,提示找不到 YAML.pm。我确定在安装依赖项时下载了此文件。 A有几个问题:-

1. Where does CPAN put all these files which were downloaded? How are they included in the @INC?
2. For using Dancer, do I have to manually include all the files in @INC?

我尝试通过在@INC 中包含 Dancer.pm 路径来创建一个非常简单的 perl dancer 应用程序向世界打招呼。但是,由于缺少某些或其他依赖项,它一直失败。

帮助我了解我做错了什么?

【问题讨论】:

  • 在 GitHub 上 Dancer 的问题跟踪器中也可以查看 rejected bug

标签: perl perl-module cpan dancer


【解决方案1】:

cpan 应该将文件放在来自@INC
perl -E '$"="\n"; say "@INC"'
的路径之一 我的系统上的输出:

/etc/perl
/usr/local/lib/perl/5.14.2
/usr/local/share/perl/5.14.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.14
/usr/share/perl/5.14
/usr/local/lib/site_perl
.

然后 cpan 将文件放在 /usr/local/share/perl/5.14.2
因为此路径存在于 @INC 中,所以不应手动包含它。那么 Dancer 呢,YAML 对它不是硬依赖,因为它没有安装。

【讨论】:

  • 接受答案。这就是我一直在寻找的。此外,当我说使用 Dancer':syntax' 时,我没有看到任何错误。任何解释为什么?
  • 因为 Dancer.pm 本身不需要 YAML。只有几个子模块需要 YAML:Dancer::Session::YAML、Dancer::Config、Dancer::Serializer::YAML。我认为当你说使用 Dancer':syntax' 时,这个子模块不会加载
猜你喜欢
  • 2012-12-07
  • 2017-11-08
  • 2010-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-03
  • 2020-05-30
  • 1970-01-01
相关资源
最近更新 更多