Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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?

3. Where are the FAQ's on the toolkits?
-> Not every toolkit has a FAQ as far as I've found out:
a) Tk's FAQ is at (very outdated!)
b) Gtk's FAQ is nowhere to be found...
c) Win32::GUI's FAQ is at
d) wxPerl's FAQ is not yet written. There is however a wxPerl Wiki
e) perlQt's FAQ is at

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.

5. Are there any GUI builders available?
-> Yes there are. To name at least one for every toolkit I mentioned:
a) For Tk there is SpecPerl and Guido (alpha stage)
b) for Gtk there is Glade-Perl and PerlComposer
c) for Win32::GUI there is jplindstrom's The GUI Loft and GB
d) for wxPerl there is wxGlade, a GUI designer for wxPerl, wxPython and others. wxPerl support for wxGlade was added by PodMaster aka crazyinsomniac.
Then there's also the (non-free) wxDesigner
e) for perlQt there is Puic

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)

10. Do you have any useful outside links?
-> Here are a few. If you have any additions to these, please /msg me and I'll add them
Perl Tk homepage
Gtk Perl homepage
wxPerl homepage
Win32::GUI homepage
jmcnamara's dfm2gui
Writing GUI Applications in Perl/Tk ( article)
Gtk Perl Tutorial
first wxPerl tutorial on Updates:
  • fixed the link to InnoSetup (thx mirod!)
  • corrected the name of The GUI Loft (thx jplindstrom!)
  • (2001/09/03) Added info on Guido
  • (2001/09/03) Added info on PerlComposer
  • (2001/09/03) Added 6th question
  • (2001/09/04) Added 'Other GUI toolkits'
  • (2001/09/04) Reshuffled the questions
  • (2001/09/04) Added outside links
  • (2001/12/10) Added outside link to wxPerl tutorial
  • (2004/04/05) Added link to perlQt
  • (2004/04/05) Added link to wxGlade
  • (2004/04/05) Added info about PAR
  • (2004/04/05) Added question 8 and 9
  • {2004/05/11) Changed wxWindows to wxWidgets (new name)
  • (2004/07/27) Fixed the link for wxGlade

Jouke Visser, Perl 'Adept'
Using Perl to help the disabled: pVoice and pStory

In reply to (GUI) Windows Programming FAQ by Jouke

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    NodeReaper writes the same droll phrase again

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2017-02-26 05:54 GMT
    Find Nodes?
      Voting Booth?
      Before electricity was invented, what was the Electric Eel called?

      Results (371 votes). Check out past polls.