1

我正在尝试使用 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 应用程序,向世界打招呼。但是,由于缺少某些或其他依赖项,它一直失败。

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

4

1 回答 1

3

cpan 应该将文件
perl -E '$"="\n"; say "@INC"'
放在我系统上@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 对它不是硬依赖,因为它没有安装。

于 2013-12-15T15:28:03.097 回答