O'Reilly logo

Learning Perl/Tk by Nancy Walsh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.3. Why Use a Graphical Interface?

Hopefully, you bought this book (or are considering it in the bookstore) because you have some idea of why you might want to use a graphical interface for one or more of your scripts. Just in case you don't, read on....

Because you are familiar with writing Perl scripts, you understand the ways you can get information in and out of one. It usually involves a combination of reading/writing files, command-line options, and possibly, data in or out at application runtime (STDIN/STDOUT, using pipes (|) or <>. Certain applications can run with no input, and others, such as an installation script, require constant information fed to it from the user: Do you want to install this file? Can I overwrite this DLL? Do you want to create this directory? Do you want the help files? Sometimes you can set up a bunch of defaults so the user just has to press return to say yes, but then they are stuck sitting at the keyboard and waiting for the next question to come up. Wouldn't it be nice to gather all that information up front and then have the user press a Go button to execute all the steps after the decisions were made?

A GUI interface adds a little flair and professionalism to an application. However, there are times when it would be overkill to add a GUI to a script. If all you are doing is reading in one file, munging a bit with no user input, and spitting out another, a GUI would be silly and unnecessary. GUI interfaces work best where you require a lot ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required