Previous Page
Next Page

Chapter 14. Command-Line Processing

The demiurge sits at his teletype, pounding out one command line after another,
specifying the values of fundamental constants of physics:
universe -G 6.672e-11 -e 1.602e-19 -h 6.626e-34....
and when he's finished typing out the command line,
his right pinky hesitates above the ENTER key for an aeon or two,
wondering what's going to happen; then down it comes
and the WHACK you hear is another Big Bang.
Neal Stephenson
In the Beginning was the Command Line

Perl started out as a language that was "also good for many system administration tasks"[*]. In the beginning, Larry created it to help him write utility programs for data mining, report generation, text munging, stream filtering, and pattern matching; as an easy way to build new command-line tools, without the constraints of shell scripting or the burdens of C programming.

[*], 18 December 1987.

Nearly two decades on, Perl is still beloved by sysadmins, toolsmiths, and other denizens of the shell, as a fast and powerful way to create new testaceous utilities. And for most of these utility programs, the command line is still the primary user interface.

If you're designing a new tool, script, utility, application, or suite, chances are it will need some kind of command-line interface. If it does, make sure that interface is convenient, powerful, flexible, mnemonic, consistent, and predictable.

Sounds difficult? It is. In fact, it's even more difficult than it sounds. But this chapter provides some guidelines that can help.

    Previous Page
    Next Page