Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Example of building/deploying perl program like StrawberryPerl

by xiaoyafeng (Deacon)
on Dec 10, 2018 at 08:04 UTC ( [id://1227025]=perlquestion: print w/replies, xml ) Need Help??

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

Hi, Monks

Recently,I have to port my program from Windows to Linux since the whole industry I've been worked on has gradually switch to it. Let me mention a little bit of current situation: When I'm on windows, I maintain an environment of Perl which is based on portable strawberry Perl. I added some more Perl libraries to Perl sub directory, some c libraries to c directory, and some executables to bin then I test my program on this . When the first installation, I installed the whole perl dist on customer machines, and with the every updates, I just need to change several files or scripts accordingly. Being about 8 years, this way works fine.

It doesn't work on Linux world. Since the every Linux dist has already maintain a perl respectly which I may not test So I want to isolate my perl environment from system perl including 3rd binary libraries like I did on windows. but How install them(perl and c libraries) on individual users and the program can find it? I'm heard that the Docker would be suitable for this scenario, but I'm not sure. maybe it's out of topic, but if any monks know that Please point it out also.

Based on Perl, as my poor perl knowledge (Little linux), there are several weapons I could use: perlbrew, Alien and Task family. As I preliminary think, I could use perlbrew to build a base perl dist, set it to default on .profile file. then use/create Alien module to add binary libraries for perl or directly using and Task for installing perl library. At last tar the whole directory and sent to customer! Am I right? Please enlighten me before I dive in, or point me out a better way! Thanks in advance.

Andy




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

  • Comment on Example of building/deploying perl program like StrawberryPerl

Replies are listed 'Best First'.
Re: Example of building/deploying perl program like StrawberryPerl
by Corion (Patriarch) on Dec 10, 2018 at 08:33 UTC

    Deciding between Docker and local::lib and App::perlbrew is mostly an organisational decision.

    With local::lib, you can delegate some of the maintenance to the machine administrators, as they install (and maintain) the external libraries, mostly through the OS package manager. You are responsible for installing and maintaining the Perl libraries that have no package in the OS repository.

    With Docker, you are in control (and responsible) for all of the libraries and Perl libraries as well.

    With App::perlbrew, you are completely independent of the system Perl, but still need the system administrators to install external libraries.

    Personally, I prefer to rely on the system administrators for maintaining the overall system, that is, I strive to use local::lib or App::perlbrew to either maintain my own Perl or my libraries together with the system Perl.

      With App::perlbrew, you are completely independent of the system Perl, but still need the system administrators to install external libraries.

      Thanks for your Prompt reply! Contacting OS administrator is one of what I try to avoid actually because the customers I face to maybe not administrator and they maybe not have right to install external libraries on system path. So I think using Alien::* to install external libraries on user directory would be a elegant way or the worse, just copy libraries and set LD_LIBRARY_PATH?





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

        Yes, depending on your personal approach, you can either compile and install (and set up LD_LIBRARY_PATH) as the application user locally, or become a pretend-administrator in your Docker container and install all the libraries using the (Docker-OS-specific) vendor package tool.

        Personally, I prefer working with the machine administrators rather than around/against them, but depending on your situation, that may not be possible.

Re: Example of building/deploying perl program like StrawberryPerl
by kschwab (Vicar) on Dec 10, 2018 at 12:21 UTC

    I haven't tried it myself, but there's also "staticperl".

    "Perl, libc, 100 modules - all in one self-contained 500kb executable. App::Staticperl installs a helper script that allows you to install a statically linked (or linkable) perl distribution, install additional modules, and create new perl interpreters with just the selection of modules you need."

    http://software.schmorp.de/pkg/App-Staticperl.html

Re: Example of building/deploying perl program like StrawberryPerl
by astroboy (Chaplain) on Dec 10, 2018 at 22:17 UTC

    Generally, you can install Perl from source without clashing with the system one. We used to have to do this on Redhat after they decided to include a release of Perl with their distribution that had performance issues (see Bitten By the Red Hat Perl Bug)

    Redhat's Perl is installed under /usr/bin with libraries under /usr/lib while the default location if you compile from source will be under /usr/local/bin and /usr/local/lib. I'm guessing that other distributions are the same. But if you just want Perl for yourself, appbrew will fit the bill

      Thanks for your reply, After discussion with Corion, I realize that the real difficulty is not compiling/installing my own perl, but how to make XS module to find the external libraries which I installed on my home directory. It seems that I either set environment variables or manually change every makefile.pl of modules(both one would be a tedious job)




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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1227025]
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found