how do I link PerlIO Perl package without “installing it”

天涯浪子 提交于 2019-12-24 22:15:01

问题


I'm trying to add the PerlIO::eol package as part of my project without installing it, this way all dependencies can be packaged with my script without having to reinstall them on each machine. How can I do it for PerlIO::eol I don't understand the structure and where the important files are


回答1:


Create a subdirectory inc and move an unpacked PerlIO-eol distro there. Then, use something like this in your project's Build.PL:

use Config qw(%config);
use Module::Build qw();

my $build = Module::Build->subclass(code => q(sub ACTION_inc2blib {
    my ($self) = @_;
    chdir 'inc/PerlIO-eol';
    system $^X, 'Makefile.PL';
    system $Config{make};
    chdir '../..';
}))->new(
    module_name     => 'Foo::Bar',
    license         => 'restrictive',
    dist_abstract   => 'blah',
);

$build->dispatch('inc2blib');
$build->create_build_script;

Then, in your main program use blib 'inc/PerlIO-eol';.


But that's BFI, you should simply set up PerlIO::eol as a runtime dependency in your project distro's metafile and have it installed normally.




回答2:


It depends on which machines you plan to install it. If all of them have the same operating system (and the same versions libraries and Perl and so on), it might be possible. If not, you need to compile the module for each planned platform beforehand (it contains some .xs files).



来源:https://stackoverflow.com/questions/9066955/how-do-i-link-perlio-perl-package-without-installing-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!