Search code examples
perlcpanperl-io

how do I link PerlIO Perl package without "installing it"


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


Solution

  • 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.