There have been quite a few questions and remarks concerning building
Windows-like programs in Perl. I don't know everything about all facets of this,
but I hope this thread will be a kind of a FAQ-like thread to prevent some
questions from being asked over and over again.

1. Can I build a GUI around my Perl program?
-> Yes you can. There are several different options:
a) Tk. Tk is the widest used GUI toolkit for Perl. O'Reilly has a book
on it (although I heard it is discontinued), and a lot of resources on it are
available. Tk is portable between Win32 and Unix variants.
b) Gtk. Gtk does not run on Win32. But for Gnome minded people it's a
very nice GUI toolkit. It should be possible to port it to Win32 though. After
all the Gimp is ported to Win32, and Gtk is based on the Gimp's widgetset.
c) Win32::GUI. Win32::GUI is (of course) only available on Win32. It's
a toolkit to access all of Windows GUI api.
d) wxPerl. wxPerl is based on wxWidgets, a crossplatform GUI api. It
really takes the look and feel of the platform it runs on, Win32, Motif, Gtk or
MacOS.
e) Qt is available with Perl support now too. KDE support is planned but not yet available.

2. Aren't there more GUI toolkits?
-> Yes there are, but either old and (?) unmaintained, or very new:X11::Fvwm Last update 1997!X11::Lib Last update 1998!X11::Protocol Last update 1998!X11::Xforms4Perl Link does not work, but module can be found on CPAN (by-module)Prima Very new. Has anyone tried it?

4. What GUI api is the best?
-> That depends on your personal preferences. Tk is the oldest and normally the
most stable GUI available for Perl. It's also the best documented. Gtk is good
if you only want to run on Gnome platforms. Win32::GUI gives you access to all
of window's GUI functions and wxPerl is the most portable and the most Object
Oriented, for people who like that.

6. Can I compile my Perl program?
-> Yes you can. However, except for perlcc (see below) none of the mentioned methods will really compile your code to machine code. The mentioned tools merely wrap up your code with the nessecary modules and the Perl interpreter and put them inside a standalone executable.
Therefore it's not suitable for hiding your sourcecode, but it's very useful when you want to distribute your script without having your end-users installing Perl and a bunch of CPAN modules
I think the best option for this these days is PAR. PAR is portable (runs on Win32 and (as far as I know) all Unix-like OSses), and using the 'pp' tool you can create standalone executables.
Then there's also:Perl ships with perlcc which needs a C-compiler to
actually do the final compilation, but it works most of the time for simple
programs.
Then there is Perl2Exe which can do more
than just build the 'exe' for a Win32 environment. It's available for many other
platforms, including Linux, Solaris and AIX.
Also Activestate has its Perl
Development Kit, which includes PerlApp. PerlApp can build binary executables
for Win32 (though the compilation itself has to be done on an NT platform, not
Win95/98), Linux and Solaris.

7. Can I create some nice distribution like a MSI or an Installshield wizard?
-> Activestate's Perl Development Kit includes PerlMSI. I haven't used it, but
according to the description on the website it is possible to create MSI's
easily with that.
Besides that there is InnoSetup a
free, Open Source Installshield clone. It is *very* easy to use and allows you
to build a nice installer around your program.

Another free tool (just like the previous one not related to Perl in any way) is NSIS, the NullSoft Scriptable Install System. As far as I've heard you can do even more with this than with InnoSetup, but I've never used it so far.

8. When I run my GUI script, a console window pops up and stays there until I close my program. How can I prevent this?
-> There are two options: either use wperl.exe instead of perl.exe (wperl.exe is distributed with ActiveState's Perl), or compile your code using one of the tools mentioned in answer 6 using the --gui option.

9. When I warn or die all messages go to the console window or aren't displayed at all. How can I see what warnings or errors my GUI script gives?
-> When you 'compiled' your script with PAR, PerlApp or Perl2Exe so it doesn't display a console window (the --gui option), warnings and errors aren't displayed anywhere. This is also the case when you use wperl.exe (distributed with ActiveState Perl) to run your script
However when you're using wxPerl, you can use Wx::Perl::Carp by PodMaster which captures your errors and warnings and displays them in a GUI dialog.
For Tk, there's Tk::Carp, and for Win32::GUI there's Win32::GUI::Carp (both by bbfu)

Funny you should bring it up, I just started investigating wxPerl yesterday. I asked the CB for a GUI that supports a web browser-like control (like the IE-thingy for VB), and wxPerl was recommended. In fact, was it you, Jouke, that recommended it to me?

Either way, I noticed you got the wxPerl developer to cough up those samples over on SourceForge, and for that I'm very grateful! (I was really stuck!)

I was a little surprised at the lack of nodes here that had anything to do with wxPerl. So far it seems like a pretty friendly GUI setup, and there should be more coverage of it. I'll contribute my stuff once it's working...

As I said in New(ish?) portable GUI framework for Perlprima is very impressive. Full featured GUI designer, portable event model. Way sexier looking widgets than Tk, primarily Perl based (relies on a portability layer in C but the widgets are implemented in Perl). Lots of prebuilt cool dialogs (the color wheel selector looks like its out Adobe, buts its actually from OS/2).

Essentially the look and feel is cribbed from OS/2 but with lots of little features stolen from Windows and X11.

Check it out!

---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Hi, came across this page from Google today, this is very informative and addresses my needs exactly. Thanks! I built a simple document processing program and distributed with Perl2Exe but now thinking about doing a GUI front for it. Your site provided the info!
Thanks again
Ray

I run ActiveState's Perl Dev Kit (perlapp) on linux (RHEL5) to compile perl scripts to Window's exe's. It worked out of the box! It's intended for cross platform use and even downloads the target platform's ActivePerl on the fly to link it in. Seems to work ok, so far. It can produce either perl-dependent app's (requires perl be installed on the target machine) or standalone (no dependencies), and the latter means I do not have to ask end-users to deal with CPAN.
The exe's are somewhat larger than I expected (3MB).
It also requires ActivePerl to be installed on the build machine -- not the linux that comes with perl -- which was free and trivial to install.
NOTE: although ActivePerl is free, the PDK costs US$300 or more for an educational license, so perl2exe is a better deal if you have the time to figure out how to run it. Also, ActiveState is a Canadian company and some US companies cannot deal with their legal terms and so do not allow AS software.

Went to join the gridlock to see it
Held an eclipse party
Watched a live feed
I cn"t see tge kwubosd to amswr thus
I tried to see it, but 8000 miles of rock got in the way
What eclipse?
Wanted to see it, but they wouldn't reschedule it
Read the book instead