How can I distribute an application with many perlapp executables, but distribute only one perl

Consolidated Question

I just use perlapp -dependent for each perl script, and then make sure I copy perl-static to the application's bin directory (calling it perl) during build?

Background

I am currently distributing an application with many standalone perlapp executables, that is, each of them includes a complete copy of the perl runtime.

I would like to distribute only one instance of Perl runtime in my application and have each executable link for one version of perl that I would distribute.

For example, let's say I have 10 perl scripts that make up my application. When I execute perlapp for each of the two demo scripts, I see something like this:

+ ls -l -rw-r--r-- 1 ----- staff 55 Feb 5 21:03 t1.pl -rw-r--r-- 1 ----- staff 62 Feb 5 21:03 t2.pl + perlapp --force t1.pl PerlApp 9.5.1 build 300018 Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved. Commercial license for .................................. Created 't1' + perlapp --force t2.pl PerlApp 9.5.1 build 300018 Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved. Commercial license for .................................. Created 't2' + ls -l -rwxr-xr-x 1 ----- staff 2266356 Feb 5 21:07 t1 -rw-r--r-- 1 ----- staff 55 Feb 5 21:03 t1.pl -rwxr-xr-x 1 ----- staff 2026992 Feb 5 21:07 t2 -rw-r--r-- 1 ----- staff 62 Feb 5 21:03 t2.pl ls -l `which perl` -rwxr-xr-x 1 root wheel 1978336 Mar 19 2015 /usr/local/ActivePerl-5.20/bin/perl-static 

In the above, you can see that each of the two (I have 10) executables is about 2Mib, each corresponds to each perl script. Each of the running executables has a perl runtime. If I distributed all 10 of them, then the distribution would be more than 22MiB.

It seems sloppy and wasteful to get users to efficiently load perl runtime 10 times when the application only needs one perl runtime. Obviously, a distribution is just one file, but it is much larger than necessary. While the entire application is only one perlapp executable, perl runtime can be conveniently associated with the executable. But over time, functions (i.e., executable files) are added, and wastefulness and sloppiness increase.

For everything to be correct, I'm sure I need to use the command line option --dependent perlapp. When I test the use of this option, I see a huge reduction in the size of the executable. After deleting the temporary folders and executing the dependent executable, it looks like the same modules were included in it as before.

Here are my "how" questions.

Q1 (certainly the most important)

If I add the --dependent option to my perlapp commands, should I expect perlapp to bind all the modules that it previously bound? I think the answer is yes, but I would like someone like Graham Stewart to answer.

Q2

Is it true that all I have to do is make sure that the statically linked perl is in PATH when executable executables are executing?

Q3 (Q2 modified for further clarification)

Does perlapp compile a statically linked version of perl? I think it is, but, again, I want to make sure that I am equivalent to something.

PS

I tried posting a topic on the ActiveState pdk forum, but I don’t think the interface accepts my post because it shows my post as unpublished, having no idea how to post.

If I use the --dedentdent option, I see the following:

 + perlapp --force --dependent t1.pl PerlApp 9.5.1 build 300018 Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved. Commercial license for .................................. Created 't1' + perlapp --force --dependent t2.pl PerlApp 9.5.1 build 300018 Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved. Commercial license for .................................. Created 't2' + ls -l -rwxr-xr-x 1 ----- staff 108560 Feb 5 21:07 t1 -rw-r--r-- 1 ----- staff 55 Feb 5 21:03 t1.pl -rwxr-xr-x 1 ----- staff 108608 Feb 5 21:07 t2 -rw-r--r-- 1 ----- staff 62 Feb 5 21:03 t2.pl 

In the above, you can see that the files are so small that they cannot have a perl runtime. If I distribute perl-static and 10 of the above executable files, then the distribution will be about 3MiB, saving about 19MiB.

When I delete PATH, the executables cause an error because the perl executable was not found. This is why I believe that the distribution just needs Perl to be executed in the bin directory with the executables. Sounds like a reasonable solution, but since I did not write perlapp, I cannot really know the truth. I have to rely on someone else to tell me "yes, you are going to do the right thing, and you will not bite in 6 months when you do x."

+5
source share
1 answer

Not exactly the solution you are looking for, but Win32 :: Packer supports this functionality. You talk about a set of scripts that form your application, and it packs them all as one MSI installer, containing all the dependencies and .exe wrappers for all scripts.

Currently it only supports Strawberry Perl , but don't add support for AS Perl too much.

0
source

Source: https://habr.com/ru/post/1275183/


All Articles