问题
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