Perl & LWP


Sean Burke



O'Reilly (2002)




Joe McCool


December 2002



Ever wonder how Perl gurus write those one-liners that go off and fetch data from a distant web site, displaying the results in neatly arranged columns? Well, this book provides many of the answers.

Essentially LWP is a CPAN module that can be downloaded for free and used with Perl. Once installed, you can pull data from web sites, parse it, upload data, complete forms, post etc. It really is exciting stuff. As early as page 11, the reader can be using Perl to scrape data from the O'Reilly catalogue page and it does work, I've tried it. The example code can be downloaded from the author's site and fired up in minutes. So, for a working program in a live situation all one has to do is modify the author's code a little. (Sadly one of the example sites he uses is no longer active - but that is not a serious drawback.)

As one might expect, the Perl code is largely object orientated, but don't let this deter those familiar only with procedural methods. The OO stuff is not a hindrance, indeed it serves as an introduction (sideways) to that subject too.

When I claim you can be up and going in minutes, I mean minutes after you have LWP installed. The author explains the CPAN bits OK, but after the instruction; perl -MCPAN -eshell (and install Bundle::LWP), be prepared for a long wait. If your perl precedes 5.8, the installation routine will upgrade your perl at the same time. This can mean a long stare at the screen while make exercises your C compiler. It also means you may have to a little shuffling around of perl executables, getting the old version out of the way. (This is neither explained, nor hinted at.) If you're like me this delay can be frustrating, with such exciting possibilities in store, but be patient. It's worth the wait. Plenty of time for a read. I recommend this book highly.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.