|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
by Chris Herborth
In this section:
| Section 1 |
What Is Scripting |
Section 2 |
Application Scripting Languages for BeOS |
| Section 3 |
Setting Up a Script |
| Section 4 |
Shell Scripting 101 |
| Section 5 |
Really Advanced Shell Use |
| Section 6 |
BeOS Application Scripting |
| Section 7 |
Making Your Scripts Run from the Tracker |
|
|||||||
| GNU (short for GNU's Not UNIX) is a set of UNIX-compatible software developed by the Free Software Foundation (FSF). Anyone can download, modify, and redistribute GNU software, but they can't limit further distribution. Richard Stallman started the GNU project in 1983 at MIT. |
Rare LanguagesGuile, Hope, HU-Prolog, Oberon-2, Ruby, and SmallEiffel seem to be fairly rare and used only for special purposes or by enthusiasts. You probably won't need to know much about them; if you've got a special use for one of these languages, then hopefully you'll already know what you're doing. |
Larry Wall's Perl is a very popular (and some people say challenging) language used by many systems administrators and Webmasters to ease their day-to-day work and manage Web sites. Known chiefly for its powerful text-manipulation capabilities, it excels at performing tricky search-and-replace operations over lots of text files (which probably explains why it's so popular with Webmasters wrangling with huge mountains of HTML). The CGI (Common Gateway Interface) scripts that work behind the scenes of most Web-based forms, such as search engines and questionnaires, are often written in Perl.
Genetically speaking, Perl is a hybrid of the Bourne shell and the awk language (both discussed in Chapter 6), with some C thrown in for good measure. Due to its heavy use of regular expressions and its tendency to give the programmer several ways to do the same thing, Perl code can be difficult to read (my favorite description is that it looks like someone sat on your keyboard). On the other hand, this complexity can make for some very powerful and very short programs.
Perl can't send BeOS messages yet, but it's only a matter of time before this popular language becomes capable of controlling GUI applications. Be sure to check Perl's entry on BeWare to see if a new version's been released!
Named after the British comedy troupe and not the snake of the same name, Python is an easy-to-use, object-oriented language that is well suited to application scripting, even on systems that don't support a rich messaging model like BeOS does.
Python programs look a little like pseudo-code (I can hear the computer science students groaning in the back) that actually runs. Like BeOS, Python supports most of the current industry buzzwords for programming languages (modules, classes, exceptions, very high-level dynamic data types, and dynamic typing, not to mention being interpreted and interactive). If these terms mean nothing to you, don't sweat it. Just as you don't have to know how your engine works in order to drive your car, you can create working scripts in Python (or any of these languages) without first understanding their every nuance.
Python is the first language to support BeOS application scripting. For the Fall '98 BeOS Masters Awards, I developed heymodule, a Python add-on that lets you write hey-style programs within the confines of the Python interpreter. For more information about heymodule (it's got good documentation and several examples, including a Python version of the big email checking script that you'll find at the end of this chapter), look in BeWare's Languages section. Python installation is covered in Chapter 15, Other Goodies.
Tcl (pronounced "tickle" by some Unix weenies) stands for "tool control language," as Tcl was originally designed to be embedded inside applications on Unix and used as a scripting language for those applications.
Tcl's distinguishing characteristic is that it treats everything as a string of text. This slows down some things (don't try doing lots of math, for example) but also makes it easy to embed Tcl commands inside a Tcl program, a file, or an application.
To quote from the Tcl FAQ's answer to "What is Tcl?," "Tcl was designed with the philosophy that one should actually use two or more languages when designing large software systems. One for manipulating complex internal data structures, or where performance is key, and another, such as Tcl, for writing smallish scripts that tie together the other pieces, providing hooks for the user to extend." This is exactly the sort of thing we're trying to accomplish with BeOS's application scripting, although in a language-neutral way.
It might be a while before the BeOS version of Tcl can do GUI scripting; I'm not sure if anyone is working on extending it to work with messages.
| << previous |
|
next >> |
![]() |
![]() |
Please direct technical questions about this site to webmaster@peachpit.com.
Copyright © 1999 Peachpit Press and the respective authors.