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

Hi, I've some usable CLI scripts, but unfortunately, these scripts must be used by some inexperienced users (inexperienced with terminal, and CLI program). So, how can I transform these CLI scripts into the GUI equivalent. What are the best practical solution ? CGI, Tk, Wx, others ? Thanks in advance

Replies are listed 'Best First'.
Re: What is the best GUI solution
by GrandFather (Saint) on Apr 28, 2006 at 10:28 UTC

    CGI provides a web interface. If you want remote access to your scripts then that may be helpful. If you are running on the local system then Tk is pretty quick to get going for light weight interfaces. To get a feel for it take a look at some of the Tk code around here.

    Some of my light weight samples are Utility to capture parameters and perform a task and Countdown timer using Tk, but there are plenty of others.


    DWIM is Perl's answer to Gödel
Re: What is the best GUI solution
by cdarke (Prior) on Apr 28, 2006 at 10:42 UTC
    Difficult to say without detailed knowledge of the kind of interaction required, the platform, and so on.
    There are so many Web and HTML tools out there that a browser front end could well be the simplest if this is server based, but that might not be the solution if you have a single user running a local program on a PC.
    If the CLI is 'panel' based, that is like old-fashioned mainframe transaction handling systems like CICS or (sigh) TPMS then it is generally easier to port to a browser front end. But if your CLI is asynchronous vt100 type interaction, where you need to grab keystrokes, then you need the control that a GUI will bring. However I have seen several dismal ports to GUIs. The bottom line is that if it was not designed for a GUI then it may not fit, unless you are really lucky.
Re: What is the best GUI solution
by zentara (Cardinal) on Apr 28, 2006 at 11:10 UTC
    It's hard to say without more details about your CLI operations. Some scripts may be best rewritten, with some operations like file-selection,etc, done with the gui. Do you need the CLI programs to be launched and run in the background? Do you need to collect output from the CLI programs? There are many considerations, especially a thing called "blocking the GUI's event loop", which tends to be the biggest problem when making front-ends to CLI programs. But I would go with a combination of Tk, backticks, piped-opens, IPC::Open3, fork-and-exec, and threads. Tk is a good choice because so many people are familiar with it's techniques. and you can get more help. With Wx(or others) you may be on your own if you hit a problem, although Gtk2 and Wx are probably just as well suited as Tk.

    I'm not really a human, but I play one on earth. flash japh
Re: What is the best GUI solution
by jonadab (Parson) on Apr 28, 2006 at 13:26 UTC

    If the users are unwilling to learn the command-line, they're probably also unwilling to learn an alien widget set, such as Tk. For inexperienced users, I'd stick with an interface they're already going to know: CGI (possibly enhanced with some simple AJAX stuff) if that will do what you need, or platform-native widgets (probably Win32, possibly via Wx for later portability) otherwise.

    When people say they want a GUI, they usually mean they want a *familiar* GUI. If you hand them Tk or Xaw, they're probably going to think it's some kind of sick practical joke, and they're not likely to be amused. Gtk would probably annoy them somewhat less, but it's still probably not going to quite be what they really want.

Re: What is the best GUI solution
by vkon (Curate) on Apr 28, 2006 at 11:26 UTC
    Tcl::Tk is the best: fast, flexible, feature rich, so on.