I found one solution thus far...
I made a simple Perl script which I named libtk.pl:
Code:
#!/usr/bin/perl -w
use Tk;
I opened this up in PerlApp and compiled it with the option "Share with Anybody" to make a shared executable. I compiled it into a file named "libtk.dll"
It may not be a valid DLL file, since it was supposed to compile into an EXE, but seems to how this Perl script didn't do anything except for load Tk, it wouldn't make sense to name it as an EXE because people would run it and it wouldn't do anything for them.
So, libtk.dll
Then I took one of my test scripts, blue.pl:
Code:
#!/usr/bin/perl -w
use Tk;
my $main = MainWindow->new (
-title => 'Blue Window',
);
$main->Label (
-font => [
-size => 32,
],
-foreground => 'blue',
-text => 'Hello World!',
)->pack;
MainLoop;
In PerlApp, I added in the "Module Search Path", a shared executable and gave it the path to libtk.dll, and specified a run directory of "."
So, I compiled that into blue.exe, and the executable size is only 472 KB. As long as it can find libtk.dll in ".", it runs fine. Otherwise it echoes an error to command prompt something along the lines of:
Code:
F:\Perl\tests\New Folder>purple.exe
Error: cannot load shared library 'F:\Perl\tests\New Folder\libtk.dll'
My first concern was that it was loading libtk.dll from an absolute path, so I cut-and-pasted all the files into other folders, tried renaming libtk.dll to "ruin" its chance of being found, and the error message reflected the new file path.
So, in essence, I've created a DLL file for Perl/Tk which can be used by any PerlApp EXE which is set to use it as a shared executable, so they can load the Tk modules out of it.
So... this solution bypassed everything that PAR stands for, but I tinkered around with PAR a lot and didn't find a way to do it with that.
But on that note, this code, seen in PAR::Tutorial, didn't work for me:
Code:
use PAR;
use lib "Tk.par";
Code:
Parameter to use lib must be directory, not file at F:\Perl\tests\New Folder\blue.pl line 4