http://www.perlmonks.org?node_id=969929

xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

Perl has many convenient feature to manipulate string e.g. re. So I embed a perl interpreter in C program and runs fine by far.

But the problem is a perl distribuition(active perl) is too large(about 24M). nobody wants a 20k program with a 24M package. sadly, a warning in embedperl destroy my naive thought:

Corollary: you can't use Perl from your C program unless Perl has been + compiled on your machine, or installed properly--that's why you shou +ldn't blithely copy Perl executables from machine to machine without +also copying the lib directory.)
So I ask here guru for help, is there a easier way to ship minimal perl in my application?(just copy perl executable and CORE directory etc) TIA.




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: how ship perl in my application?
by Corion (Patriarch) on May 11, 2012 at 08:11 UTC

    On Windows, you can simply copy the Perl executable and the surrounding files around. The only thing to patch is Config.pm if you care about other tools finding the correct directories.

    Stripping modules from the Perl distribution is something I don't like, but if you want to do that, you'll have to then hunt down all the dependent module files and copy them along.

      Thanks, Corion!

      I compiled a toy program embed in perl link with perl512.lib, and rename perl directory then copy perl512.dll in the same directory where program is, the program works fine.

      But the coming problem is how ship modules? I'd like put those in the specific directory instead of C:\perl





      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

        I think the Perl interpreter will look in a sibling directory to the executable:

        C:\Programs\xiaoyafeng_perl\bin\xyf_p.exe C:\Programs\xiaoyafeng_perl\site\...

        ... but you can also in interpreter startup push directories onto @INC to make the Perl interpreter search there.

Re: how ship perl in my application?
by Anonymous Monk on May 11, 2012 at 08:13 UTC