Chapter 6. Example LWP Programs
This chapter presents LWP programs that are more robust and feature-rich than the examples shown in previous chapters. While Chapter 5, The LWP Library, focused on teaching LWP and explained how LWP objects fit together, this chapter shows you some sample LWP programs with more user-friendly options and features.
We present three broad categories of web client programs:
- Simple clients--programs that perform actions for users in real time, usually with a finite list of URLs to act upon. In this section, we present LWP versions of the hcat and hgrepurl programs that were presented in Chapter 4, The Socket Library.
- Periodic clients--robots that perform a request repeatedly, with some delay between each request. Periodic clients typically request the same resource over and over, or a different resource in a predictable manner. For example, a client may request 0100.gif at 1 a.m., 0200.gif at 2 a.m, etc. A periodic client might check some data and perform action when a condition is met. In this section, we present a program that periodically checks the status of a Federal Express document.
- Recursive clients--robots that follow hyperlinks or other references on an HTML page. In this section, we present a program that looks for bad links in a web site.
The boundaries between these categories are not set in stone. It is possible to write a periodic client that also happens to be a recursive client. Or a simple client might become periodic if the document ...