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

What is the best answer to the question "Having never done it, what modules should I use to develop a cross platform GUI in perl?" At one time the answer was clearly Tk, but now I have no idea. There are something like five active projects to choose from. Asking people to evaluate them all is ridiculous.

I feel it's gotten to the point where "Use Catalyst with DBIx::Class" is a very reasonable default answer to the question of "How should I learn to do web applications with perl." Is there a similarly defensible answer for GUI toolkits?

Replies are listed 'Best First'.
Re: Default GUI toolkit for perl?
by bellaire (Hermit) on Nov 16, 2009 at 22:14 UTC
Re: Default GUI toolkit for perl?
by zwon (Abbot) on Nov 16, 2009 at 19:54 UTC

    Some people would recommend CGI::Application instead of Catalyst, or Jifty, or something else, so your statement that Catalyst is "default answer" is arguable. There are also some alternatives to DBIx::Class. So situation is the same as with GUI toolkits, the only difference is that you've already chosen your defaults.

Re: Default GUI toolkit for perl?
by Anonymous Monk on Nov 17, 2009 at 00:28 UTC
    It's Wx, because the Padre team will use it more heavily than you ever will, they care a lot about cross-platform'ness, and you can leverage off their need for it to work.

    And as a bonus, it makes applications that "look real" (i.e. native) so marketing/business/whatever types won't get weirded out by strange widget sets.
Re: Default GUI toolkit for perl?
by vlsimpson (Beadle) on Nov 17, 2009 at 01:51 UTC
    If you go with Tk you might want to use the Tkx wrapper opposed to the old Perl/Tk. Tkx seems to follow the "real" Tk version more closely.
Re: Default GUI toolkit for perl?
by llancet (Friar) on Nov 17, 2009 at 01:37 UTC
    Tk is very easy to get and compile, but sometimes looks ugly, and you need to do lots of things to let Tk work with threads.
Re: Default GUI toolkit for perl?
by zentara (Cardinal) on Nov 17, 2009 at 12:26 UTC
    ...i recommend using Gtk2....why? ..... the basic c libs now come standard on linux, so as to run firefox and gimp and such..... there is also very active and widespread development within gtk2.....

    there is a tutorial at Perl Gtk2 tutorial and to get a Perl version easily installed on win32, that comes with all the Gtk2 stuff installed, try Camelbox: A build of Gtk2-Perl for Windows

    ...another benefit of perl-gtk2 is that it clearly parallels the c libs in names and stuff, so you can port your app to c later, and there are many gtk2-c tutorials available and very good mailling lists for both c and perl..... be warned however, before asking questions on the maillist, they expect you to at least have gone thru the tutorials, and show some code.

    ...the drawback to gtk2 ( actually an advantage in my books) compared to Wx, is that there is no easy to use GUI designer, .... no gui layout manager, forces you to make your own windows, do the packing, and signal setup yourself....this is important if you want to write more advanced stuff

    ....alot of people like Wx, which has a more c++ style, where as gtk2 is more like plain c, with a bunch of extra data types thrown in.... into a basic event loop and object system called Glib.....just read up on it...its all free


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
        yes it is, but it is somewhat incomplete and it is no where near VC++..... like right click menus to alter options ,signals, and callbacks to menus are missing in the gui designer..... and it just produces boilerplate code with scalar and subroutines automatically named to non-descript things like $ad55677 or sub 12341234123, IIRC ..... so when you want to do something fancy, which requires manually digging into the code, it becomes impossible.

        ....that is why it pays to read the perl-gtk2 tutorial and learn the simple procedures for setting up your basic windows.

        i was just trying to make the point that the allure of Wx, to the newbies out there, is that they can setup basic windows on the screen, with it's gui designer...... but it hampers you in the long run...... except for simple apps......its just my opinion that writing from scratch will give you more command over the app, and prevent many problems by more descriptive variable and subroutine names.


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku
Re: Default GUI toolkit for perl?
by holli (Abbot) on Nov 17, 2009 at 11:59 UTC
    Use Catalyst with DBIx::Class and ExtJs =) That way you can add a lot of buzzwords to your project. Ajax, Client-Server, ...

    Kidding aside, depending on the application you want to write the good ole webserver/browser workhorse may be worth thinking of. And writing an UI in Javascript is not so bad, as some here may think.


    holli

    You can lead your users to water, but alas, you cannot drown them.
Re: Default GUI toolkit for perl?
by Anonymous Monk on Nov 17, 2009 at 21:59 UTC

    My limited knowledge on the subject is:

    • As for cross-platform, there seemed to be some effort for a while going into a Mac OS X Cocoa port of GTK+, but I don't know the current status. I think the main company behind the port may have gone under. Relevant links may include the following:
    • Tcl/Tk itself seems to be still going pretty strong. They've got nice theming now. Python is still using it as their default bundled GUI toolkit. The Perl/Tk dist may not have been updated for a while though.
    • Wx seems huge, multi-layered, and the API resembles MS MFC, IIRC. My guess is that people use it primarily because (A) they're familiar with MFC, (B) it's an easy-ish cross-platform solution that provides native widgets (which, I presume, they think their users would like), and (C) it's actively maintained. Python users seem enamored with Wx. Personally, I was disappointed to hear that Padre went with Wx, but I'm just an armchair quarterback on that.

    My advice (taken with at least a cubic cm of salt) would be to go with GTK+. It's cross-platform ports are in alright shape, it's not as bulky as Wx, it doesn't have the Tcl/Tk dependency, it's fairly well-maintained, and it's probably the closest of all the GUI toolkits to being considered the "standard" one (though none really are, of course). Also, everything Zentara said.