Using the Command Line

You need to leave a way open for customization in your application. Mainly, this means you can take the easy way out and not hardcode many option values. If you hardcode too many configuration options, users cannot easily tailor your application using one of the methods listed in this chapter. For example, if you want to allow your users to change the font of all the widgets in the application, don’t use the -font option when creating or configuring your widgets. If you want to do something such as change the size of a font, get the current font and then change the size.[1]

Often the easiest thing for a user to do is specify a command-line option when running the application. The options can be changed quickly and allow users to have immediate and direct control over their applications.

There are several command-line options that customize the way your application looks. When you run your application, the command line looks something like this:[2]

# On MS Windows systems:
> perl myScript.pl [ options... ]
# On Unix systems:
% myScript [ options... ]

The supported options are standard X options that any user familiar with X Windows will recognize. None of these options are required, but they might be the simplest ways to do what you want (for example, changing the background color of everything in the application). When specifying a command-line list of options and values, do not use a comma separator. If any of the options have bad values, you’ll get an ...

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.