title: How can I distribute an application with many perlapp executables but distribute only one perl
body: <p>Summary Question</p>
  
  <p>Do I simply use perlapp --dependent for each perl script and then make sure I copy perl-static to the app's bin directory (calling it perl) during the build?</p>
  
  <p>Background</p>
  
  <p>I am currently distributing an application with many perlapp freestanding executables, meaning they each include a bundled copy of the perl runtime.</p>
  
  <p>I'd like to distribute only one copy of the perl runtime in my application and have each executable reference the one perl runtime that I would distribute.</p>
  
  <p>For example, let's assume 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:</p>
  
  <pre><code>+ 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
  </code></pre>
  
  <p>In the above output, you can see that each of the two (I have 10 so far) executables is about 2Mib, one corresponding to each perl script. In each of the bundled executables, there is a perl runtime. If I were to distribute all 10 of these, then the distribution would be over 22MiB.</p>
  
  <p>It seems sloppy and wasteful to force customers to effectively download the perl runtime 10 times when the app requires only one perl runtime. Obviously, the distribution is only one file but it's much larger than it needs to be. While the whole app being only one perlapp executable, the perl runtime can conveniently be bundled into the executable. But over time features (i.e., executables) are added and the wastefulness &amp; sloppiness increases.</p>
  
  <p>To do it right, I'm pretty sure I have to use the --dependent perlapp command line option. When I test the use of that option, I see a tremendous decrease in the size of the bundled executable. After removing the temp folders and executing the dependent executable it looks like it has bundled the same modules as before.</p>
  
  <p>Here are my "how" questions.</p>
  
  <p>Q1 (by far the most important)</p>
  
  <p>If I add the --dependent option to my perlapp commands, then should I <i>expect</i> perlapp to bundle all modules it was previously bundling? I think the answer here is "yes" but I'd like someone like Graham Stuart to respond.</p>
  
  <p>Q2</p>
  
  <p>Is it true that all I have to do is make sure the statically linked perl is in the PATH when those dependent executables are executed? </p>
  
  <p>Q3 (Q2 reworded for extra clarification)</p>
  
  <p>Does perlapp bundle the statically linked version of perl? I think it does but, again, I want to make sure I do something equivalent.</p>
  
  <p>PS</p>
  
  <p>I tried posting the topic on ActiveState's pdk forum but I don't think that interface is accepting my post because it shows my post as being unpublished with no clue as to how to publish.</p>
  
  <p>If I use the --dependent option, then I see this:</p>
  
  <pre><code>+ 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
  </code></pre>
  
  <p>In the above output, you can see the files are so small that they cannot possibly have the perl runtime bundled. If I distribute perl-static and 10 of the above executables, then the distribution will be about 3MiB, a savings of about 19MiB.</p>
  
  <p>When I unset PATH, then the executables raise an error because the perl executable isn't found. That is why I believe the distribution simply needs the perl runtime to be in the bin directory with the executables. Seems like a reasonable solution but since I didn't write perlapp, I can't really know the truth. I have to rely on someone else to tell me "yes, you are about to do the right thing and you will not get bitten 6 months later when you do x".</p>