nikosv has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replicate Perl setup
by Fletch (Bishop) on Dec 10, 2021 at 13:37 UTC | |
The CPAN module has an autobundle command which will write a Bundle::Snapshot_YYYY_MM_DD_XX (the last XX being a counter) containing a list of modules and revisions which are installed that you can use to have it reinstall the same set. You could use that to prime an install of the same base perl version somewhere else which (depending on the OS and compiler state) should be more or less identical.
The cake is a lie. | [reply] [d/l] [select] |
by nikosv (Deacon) on Dec 10, 2021 at 16:28 UTC | |
| [reply] |
by nikosv (Deacon) on Feb 03, 2024 at 09:50 UTC | |
| [reply] |
by Fletch (Bishop) on Feb 04, 2024 at 07:12 UTC | |
It uses the list/manifest of installed modules which is written by the module’s make install process which is independent of what you use to install. So long as you’re not (say) copying things into the lib hierarchy by hand it’ll find things. Edit: Afterthought if you’re asking can cpanm install a bundle module list generated by CPAN . . . That’s actually an interesting question and I’m not sure. The bundle pod is written into the .cpan config dirs and I don’t know if minus can/would look there; but if it (App::cpanminus) can handle them I’d bet it would. Personally when using this feature I’m bootstrapping a new Perl install and I’m expecting minus to be one of the things to get installed by said bundle so it’s not anything I’ve tried.
The cake is a lie. | [reply] [d/l] [select] |
|
Re: Replicate Perl setup (Building and Installing Perl References)
by eyepopslikeamosquito (Archbishop) on Dec 11, 2021 at 00:43 UTC | |
See here for one primitive way to do this type of thing. Valuing reliability and lower support costs over flexibility, we installed our version of Perl, along with our stable set of CPAN modules, on many different customer machines -- without affecting other versions of Perl that may be installed on their system, and without requiring root permissions. BTW, my manager back then had previously worked at Microsoft, where a broken build cut onto millions of CDs was a total disaster ... their build team became paranoid, going to incredible lengths to avoid breaking the build; they'd even experienced cases where simply installing an OS patch broke their build! ... so their build machines were quarantined from the network, with only the build team allowed to touch them. Reference
References Added Later
Like Fletch and stevieb, I strongly prefer to leave the system perl alone, instead building my own perl (as non-root) that I can safely control, and experiment with, and install CPAN modules to, without risking breaking my Unix system. Conversely, Fletch notes that relying on the system perl couples you tightly to the OS' upgrade schedule, for both the language and CPAN modules ... so a "harmless" OS upgrade can potentially break your mission-critical systems, if they are using the system perl.
Examples of installing a custom Perl: From Re: Perl installation on Ubuntu and/or Mac OS by ikegami, to install the system Perl and Tk on Ubuntu: sudo apt install perl perl-tk See APT (software) (wikipedia) and apt (Advanced Packaging Tool) at Ubuntu package management (and this node which uses the apt-get command) for more details. You could also install your own Perl using perlbrew (see App::perlbrew):
Building Perl Securely
Examples of building Perl securely from source:
Windows and Strawberry Perl
Portable Perl
Historic Perl
On CPAN
PM Nodes
Platform-Specific perldoc Notes
Containerization See: Cloud/Virtualization/Container References section at Re: "Magic tools" that take the fun away (Releng/DevOps/Cloud/Virtualization/Container/Server References) | [reply] [d/l] [select] |
|
Re: Replicate Perl setup
by LanX (Saint) on Dec 10, 2021 at 13:22 UTC | |
That depends on hardware and OS. On windows copying the directory tree is sufficient, at least with ActiveState. I think I heard you can do similar things on Linux if the OS and hardware are sufficiently close, but you'll have to replicate some ENV-settings too. It mainly boils down to the binary compatibility of installed XS modules, otherwise they need to be recompiled.
Cheers Rolf | [reply] |
by Marshall (Canon) on Dec 13, 2021 at 02:48 UTC | |
This is true, but AS licensing agreements from years ago prohibited that for actual product shipment. I don't know what current AS licensing says for a re-distributed product. I suspect potential legal trouble if this is done for end-product distribution vs perhaps in-house use. At the time, I bought a Perl Dev Kit license and generated an .exe file for just that legal reason. Of course the Dev Kit has been discontinued. AS did have some tools for "cloning" an installation. You ran a utility to make an XML file. You installed Perl directly from AS (no binary distribution allowed) on the target machine. Then there was a utility that used this XML file which was supposed to re-create the environment on the target machine. I had trouble with that and I think many others did too. The new AS way is to create an account on their site and have AS build a version for you with the modules that you need. The result of this is an installable MSI file or equivalent in the Unix world. That AS built version (which includes XS binaries for your platform) can be freely re-distributed without restriction. In the Windows world, this is good. There of course can be complex issues with multiple Perl versions on any platform. | [reply] |
by nikosv (Deacon) on Dec 10, 2021 at 15:23 UTC | |
| [reply] |
|
Re: Replicate Perl setup
by davido (Cardinal) on Dec 10, 2021 at 16:25 UTC | |
This may also be solved using containers. Docker + Carton (for dependencies) + make, for example. Dave | [reply] |
by NERDVANA (Priest) on Feb 04, 2024 at 00:49 UTC | |
| [reply] |
|
Re: Replicate Perl setup
by karlgoethebier (Abbot) on Dec 11, 2021 at 18:13 UTC | |
Couldn’t you clone the machine(s)? In the last company i was with we had some success with this procedure. Regards, Karl «The Crux of the Biscuit is the Apostrophe» | [reply] |
|
Re: Replicate Perl setup
by perlfan (Parson) on Dec 12, 2021 at 23:01 UTC | |
Don't be a 'frady cat. No matter what you use an environment - docker, perlbrew, virtualbox, etc - see how far you can get with just a test environment; installing the packages from CPAN or, better, the local package manager. Fix your code where you need to. Once you get that working, your life will be a lot simpler and you'll see how silly being "afraid" actually is. I'd rather be seeing you post questions here regarding the fixing of your code than to enable you to just live in some false sense of fear. | [reply] |
by Fletch (Bishop) on Dec 13, 2021 at 13:39 UTC | |
One caveat from experience (and if you search through my post history I'm probably a broken record about this): Never use the OS' perl and package manager if you don't have 100% control over the OS. With today's container solutions that's less of an issue (since you're more likely to have full control over the image inside), but if you're still on bare metal and at the whim of (say) a central IT department you're going to get bitten at some point. They're going to upgrade your perl and/or packages underneath your application without your knowledge or consent at some point (Murphy sez) and then you're going to be the unfortunate schmuck on the hook to unbreak what they've just broked (because you didn't plan on Foo::Bar suddenly throwing an error because there was an upstream bug your existing code exercised but wasn't handling that's now fixed). Always roll and maintain your own application install somewhere you control and use that instead of /usr/bin/perl or whatever. Make sure to shebang everything #!/usr/bin/env perl rather than an explicit path then manage PATH to find what to run (that also allows you to test and migrate to a new version without editing all your scripts).
The cake is a lie. | [reply] [d/l] [select] |