Modern GUI toolkits make for easy system-level GUIs
As a system programmer, you habitually work with command-line interfaces. Perhaps you've lost track of how easy it can be to wrap existing functionality with a lightweight graphical user interface (GUI). New Perl/Tk releases make it timely to remember that sometimes high quality accompanies ease of use.
You can keep your focus on highly productive server-side programming, and still choose to jazz up your interfaces occasionally. What's more, lightweight toolkits such as Perl/Tk make it possible to do this without the costs of higher-profile GUI approaches.
Toolkit landscape
What are the costs? GUIs are generally harder to program, test, port, and deploy than their corresponding command-line-oriented relatives. Microsoft Visual Basic (VB) is widely recognized for its simplification of GUI construction. However, effective isolation to the Windows world and its clumsiness as a programming language constrain VB; see Resources later in this article for details on these disadvantages. Although Java, GTK+, and Qt have become accepted for Linux and related open source development, it takes a lot of study and lines of code to begin to use them; their "barriers to entry" discourage low-key transitions from character-oriented to WIMP (windows-icons-menus-pointers) programming.
As simplistic as the Web's model of user interaction is, it suffices for plenty of little jobs. In fact, most of my own GUI programming is of Web applications.
Sometimes, though, the Web's not enough. You need more sophisticated programmability or a different security model. Sometimes you just need a "second source"; a Web-based control panel for your Web server makes your system too fragile. Sometimes the Web's too much: the usual servers and clients have big memory footprints and demand configuration.
There's good news, though. Keep your highly-productive system programming habits. Stir in such lightweight high-level language bindings as Perl/Tk or Tkinter. You'll end up with portable, maintainable, surprisingly well-performing, "GUIfied" versions of the programs you've already developed.
Whether your favorite language is Ruby or Fortran, the right accessories will give you similar opportunities. Here's an example of how it can work for a programmer already comfortable with Perl.
Warming up to Perl/Tk
You know Perl. Its clever succinctness lets you code in five minutes the report generators, network probes, text filters, and process monitors that demand day-long efforts with other languages.
What you might not know, though, is that with just a few lines more,
you can turn your Perl applications into well-behaved, good-looking GUI
ones. Teodor Zlatanov's article on developerWorks
describing cfengine
and related Perl
utilities (see Resources for a link to the article) shows how to write
handy tools such as this tiny script, which shuts down all inetd
processes:
|
What if you need to shut down several rogue CGI processes? Or what if
you want more graceful signaling than the rather brutal "kill 9"? What if
your boss or your backup needs to use this script while you're away? The
traditional answer is just to fire up an editor, substitute
cgi
for inetd
, and so on, and re-run
perl kill_inetd.pl
from the command line.
Transform that first listing, though, to Listing 2:
Listing 2. Source code for modified kill_inetd.pl
|
Simple signal-sending control panel
Notice, though, what you do not have with this twenty-line script: you don't have pages of declarations and configuration. You don't have any license restriction beyond the familiar Perl ones. You don't need to learn a new language.
View Include GUIs in your server programming with Perl/Tk Discussion
Page: 1 2 Next Page: New horizons