为什么 CPAN 不为我的捆绑包中的模块安装依赖项?
我正在创建一个捆绑包,以便轻松安装我的应用程序。 我从这里开始: http://search.cpan.org/dist/ CPAN/lib/CPAN.pm#Bundles
我有一个包 Bundle::MyApp ,如下所示:
package Bundle::MyApp;
$VERSION = '0.01';
1;
__END__
=head1 NAME
Bundle::MyApp - modules needed by my app
=head1 SYNOPSIS
cpan install Bundle::MyApp
=head1 CONTENTS
DateTime
Image::Size
我正在本地计算机上测试它,因此我将包放入我的 cpan 文件夹中,例如: ~/ .cpan/Bundle/MyApp.pm
现在我可以使用 cpan install Bundle::MyApp
运行它并且它可以工作,只是它不安装我列出的模块所需的依赖项。因此,在本示例中,cpan 首先尝试安装 DateTime,但安装失败,因为首先需要 DateTime::Locale,然后尝试安装 Image::Size,但也失败,因为需要依赖项。
如果我使用 cpan install DateTime
直接通过 cpan 安装 DateTime 模块,它可以正常工作并安装依赖项。
因此,我正在寻找一种方法来告诉 CPAN 从我的捆绑包安装时遵循依赖关系。我的包裹里需要放什么东西吗?或者可能是我的用户帐户的 CPAN 配置有问题?
I'm creating a bundle to make it easy to install my app.
I started here: http://search.cpan.org/dist/CPAN/lib/CPAN.pm#Bundles
I have a package Bundle::MyApp which looks like this:
package Bundle::MyApp;
$VERSION = '0.01';
1;
__END__
=head1 NAME
Bundle::MyApp - modules needed by my app
=head1 SYNOPSIS
cpan install Bundle::MyApp
=head1 CONTENTS
DateTime
Image::Size
I'm testing it on my local machine, so I put the package into my cpan folder, eg: ~/.cpan/Bundle/MyApp.pm
Now I can run it using cpan install Bundle::MyApp
and it works, except that it doesn't install the dependencies required by the modules I have listed. So in this example, cpan first tries to install DateTime but the install fails because DateTime::Locale is needed first, then it tries to install Image::Size and that fails too beacuse there are deps needed.
If I install the DateTime module directly via cpan using cpan install DateTime
it works fine and dependencies are installed.
So I'm looking for a way to tell CPAN to follow dependencies when its installing from my bundle. Is there something I need to put in my package? or maybe it's an issue with the CPAN config for my user account?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
模块依赖项
在 Makefile.PL 中,您可以列出必备模块。来自
perldoc ExtUtils::MakeMaker
:还有 PREREQ_PRINT 和 PREREQ_FATAL。
捆绑文件格式
CONTENTS 部分中捆绑行的格式需要用空行分隔依赖项。
Module dependencies
In Makefile.PL, you can list pre-requisite modules. From
perldoc ExtUtils::MakeMaker
:There is also a PREREQ_PRINT and PREREQ_FATAL.
Bundle file format
The format for the bundle lines in the CONTENTS section requires blank lines separating the dependencies.