O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

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

Chapter 20. IPC with send

There’s an interprocess communication mechanism unique to Tk: the send [1] command. As originally implemented in Tcl/Tk, send transmits commands (which, in Tcl, are simply strings) to another Tcl application running on the same display. The receiving application then executes the commands and replies with the results. Think of it as an eval in the context of the receiver, performed automatically by Tcl/Tk.

Perl/Tk provides a send command too, but the default receiver is a simple stub that rejects all incoming send requests. Fortunately, we can override that behavior by writing our own receiver. And we’re not constrained to merely evaling the incoming data, but can do whatever we please.

Using send, we can write remote controllers, client/server applications, parallel programs, and intriguing games. In this chapter, we’ll see examples of some of these written in Perl and, in a mind-stretching twist, Tcl.

[1] Currently, send is not available on Win32 operating systems. This may change in the future.

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