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

elef has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,
I am working on a perl app for non-tech-savvy people. 'Install module X from cpan' is not gonna fly. The app uses DBI and Perl/Tk. I package it as a standalone .exe on Windows with PAR::Packer, and that's working fine. The big question is whether the same thing can be done on OS X. My brief googling shows that tk and pp exist for OS X but they may require some other software or installing a different version of perl instead of using the preinstalled version.
What's the current state of affairs? Can pp create a standalone executable from an app with a Perl/Tk gui? If it's possible, can mac monks point me in the right direction? I don't have a mac so I'd have to remote control somebody who has one... if it takes a lot of troubleshooting/hacking it's not gonna happen.

Replies are listed 'Best First'.
Re: Perl/Tk and PAR::Packer on OS X
by kcott (Archbishop) on Nov 22, 2013 at 01:55 UTC

    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

      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

Re: Perl/Tk and PAR::Packer on OS X (citrus/cava)
by Anonymous Monk on Nov 21, 2013 at 10:28 UTC