http://www.perlmonks.org?node_id=1063847


in reply to Perl/Tk and PAR::Packer on OS X

G'day elef,

"... they may require some other software or installing a different version of perl instead of using the preinstalled version."

Firstly, don't modify the Mac OS X System Perl in any way. Apple installs its own version of Perl for its own use. Any changes you make can interfere with how this works; any updates to the Mac can interfere with whatever you've done.

I started using a Mac a couple of years ago and asked "Are there any major Perl issues with Mac OS X Lion?". That may be a little dated now and you could be working on a different version; however, I believe the basic information is still sound. I chose the perlbrew option: it's worked without problems with many versions of Perl. See App::perlbrew for installation and perlbrew for command details.

"The big question is whether the same thing can be done on OS X."

I'm using Perl v5.18.1 and have Tk v804.031 installed (the latest versions in both cases). I just installed PAR::Packer v1.015 without incident.

I wrote this short test script (pm_test_pp_tk.pl) and tested it successfully:

#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new; my $frame = $mw->Frame->pack; $frame->Label(-text => 'Hello, world!')->pack; $frame->Button(-text => 'Quit', -command => sub { exit })->pack; MainLoop;

I then used pp:

$ pp -o pm_test_pp_tk.exe pm_test_pp_tk.pl

I successfully tested pm_test_pp_tk.exe.

You may already be aware that there's a substantial difference in the sizes of those files:

$ ls -l pm_test_pp_tk.* -rwxr-xr-x 1 ken staff 6893413 22 Nov 12:13 pm_test_pp_tk.exe -rwxr-xr-x 1 ken staff 238 22 Nov 12:10 pm_test_pp_tk.pl

I leave testing with DBI, and any other modules you might need, as an exercise for your good self.

-- Ken

Replies are listed 'Best First'.
Re^2: Perl/Tk and PAR::Packer on OS X
by elef (Friar) on Nov 22, 2013 at 11:56 UTC
    Thanks for the detailed reply.
    This definitely seems doable but not easy, especially given that I would be guiding a non-coder person through the process via skype or something like that.
    I found a couple of threads and other sources talking about X11 being necessary for Perl/Tk to work on OSX. Do I not need to worry about this?

    My googling led me to ActiveState's perl dev kit, which supposedly includes a tool that can generate standalone OSX executables without access to a mac computer. There's a 21-day trial version so in principle I could just do this on my own (Windows) computer for free with little fuss. Later updates would be a problem but even if I only get one release out, that's better than nothing. This is free software I'm writing as a hobby so I couldn't justify buying PDK - but maybe a couple of OSX users would donate the money.
    So, does anyone have experience with cross-platform packaging in PerlApp? Does the trial version have limitations in addition to the 21-day trial period?
    Edit: it looks like the executables generated with the trial version of perlapp have a time bomb in them. So the trial version is only good for testing, and the full version is not that cheap. Looks like I will be trying the remote-control-the-mac-guy-to-run-pp-for-me option. I will almost certainly come back here with questions if (when) we get stuck.

      I don't recall any issues with X11. I set this up to start automatically when the system starts. This was a couple of years ago so details are not fresh in my memory. It runs without incident: I don't imagine it's something you'll need to worry about.

      I don't use ActiveState or PerlApp: can't help you with those.

      -- Ken

        Could you share that executable here or mail it to quca1@freemail.hu?
        I know nothing about this stuff but it seems possible that the compiled executable requires X11 to be running and won't work otherwise. Hopefully, it's packaged in if it's needed but you never know. If I could have a mac user test your executable, I would have some info before trying to guide somebody through packaging up my whole app.