views:

348

answers:

4

Is Perl a good option for writing (possibly and partially) platform independent desktop applications? I know there are interesting widget libraries like GTK2 Perl and wxWidgets but I'm not familiar with development on Windows.

Is it possible to write a good application with Perl and those tools, maybe embedding everything needed to avoid asking the user to install external (and probably non conventional for many) libraries? Are there examples of this kind of apps around?

+3  A: 

Check out PAR (available via CPAN) with respect to your bundling requirement.

Consider having a look at Padre for an example of a complex application written in perl using Wx.

So yes. All of your requirements are achievable, including portability.

tsee
I haven't found Padre to be portable, mostly because Wx is such a pain on some platforms. Sure, you can make it work eventually, but I don't count that as real world portability. Possible is a bit different than reasonable.
brian d foy
To be honest, I can only assume you're using a Mac. Apart from my general knee-jerk reaction about that system (yuck), I have to say the main reason we've been lacking on OS X is lack of people willing to test things there and follow up on potential breakage. Also, writing a portable Deskop application may be much easier to write if it doesn't use *all* of CPAN like Padre does. I know. I mentioned both in the same breath, but it's not *that* far off from being quite portable.
tsee
Yes, I'm on a Mac, but I have also had trouble getting Wx to work on Windows and linux. The stars have to align properly for everything to work out. However, that's always when I'm trying to compile stuff myself. The problem with Mac testers is probably that none of them need Padre. I'm completely happy with my editor, as are most of the Mac people I know.
brian d foy
+6  A: 

Sort of. You can certainly write Perl scripts that provide a Tk GUI that will work on any platform, and you can even package the libraries they need to work with PAR to put together an application that will run anywhere with an appropriate version of perl installed without requiring the end use to install a bunch of stuff from CPAN to get it to work.

However, an application that will run anywhere without requiring an existing perl installation (and it's probably not safe to assume the average Windows user will have perl) isn't really viable. One solution would be to distribute an "everywhere but Windows" version that simply uses PAR to include the necessary libraries, and a PAR::Packer-built version for Windows, which would be a fully-functional .exe including the perl interpreter and the libraries.

EDIT: following daotoad's response, it does appear that ActiveState's PerlApp can build cross-platform binaries for for Windows, Mac OS X, Linux, Solaris, and AIX; I haven't tried this but if it works as advertised it would seem to meet your requirements.

Wooble
+4  A: 

My employer uses ActiveState's PerlApp to produce executable versions of our apps with great success.

We tested PAR and PerlApp before selecting our packaging method. At that time, PerlApp had faster load times. Several versions of each tool have come and gone since then, so I would recommend testing with each before selecting a tool.

Executable packaging has been very effective for us.

There are a few portability issues issues with Perl, but if you pay attention to perlport, it's easy to avoid most issues. Our biggest problems are always with Win32. From time to time, some simple thing will require stupid, bizarre work-arounds or digging into Win32 API for a platform specific hack.

We have used both Wx and Tk guis.

Frozen Bubble is a well known and widely available app you can look at.

daotoad
A: 

I am working on the module XUL::Gui on CPAN, which uses Firefox to display cross platform gui apps from Perl. It is under development, but stable, and may be complete enough for your needs. You can build your gui in HTML and/or XUL (the Mozilla gui language that Firefox itself is written in), and then style everything with CSS. Let me know if you have any feature requests.

Eric Strom