Advanced Perl Programming

Advanced Perl ProgrammingSearch this book
Previous: What Must I Know?PrefaceNext: Conventions
 

The Book's Approach

You have not bought this book just to see a set of features. For that, free online documentation would suffice. I want to convey practical problem-solving techniques that use appropriate features, along with the foundations of the technology areas mentioned in the previous section.

A Note to the Expert

This book takes a tutorial approach to explaining bits and pieces of Perl syntax, making the need felt for a particular concept or facility before explaining how Perl fills the void. Experienced people who don't need the justifications for any facilities or verbose examples will likely benefit by first taking a look at Appendix B, Syntax Summary, to quickly take in all the syntactic constructs and idioms described in this book and go to the appropriate explanations should the need arise.

It is my earnest hope that the chapters on technology, embedding, extending, and Perl interpreter internals (the non-syntax-related ones) will be useful to the casual user and expert alike.

Systems View

This book tends to take the systems view of things; most chapters have a section explaining what is really going on inside. I believe that you can never be a good programmer if you know only the syntax of the language but not how the compilation or run-time environment is implemented. For example, a C programmer must know that it is a bad idea for a function to return the address of a local variable (and the reason for this restriction), and a Java programmer should know why a thread may never get control in a uniprocessor setup even if it is not blocked.

In addition, knowing how everything works from the ground up results in a permanent understanding of the facilities. People who know the etymology of words have much less trouble maintaining an excellent vocabulary.

Examples

Perl is a highly idiomatic language, full of redundant features.[6] While I'm as enthusiastic as the next person about cool and bizarre ways of exploiting a language,[7] the book is not a compendium of gee-whiz features; it sticks to the minimal subset of Perl that is required to develop powerful applications.

[6] There are hundreds of ways of printing "Just Another Perl Hacker," mostly attributed to Randal Schwartz. See: http://www.perl.com/CPAN/misc/japh.

[7] As a judge for the Obfuscated C Code contest, I see more than my fair share of twisted, cryptic, and spectacular code. See http://www.ioccc.org/ if you don't know about this contest. Incidentally, if you think Perl isn't confusing enough already, check out the Obfuscated Perl contest at http://fahrenheit-451.media.mit.edu/tpj/contest/.

In presenting the example code, I have also sacrificed efficiency and compactness for readability.

FTP

If you have an Internet connection (permanent or dialup), the easiest way to use FTP is via your web browser or favorite FTP client. To get the examples, simply point your browser to:

ftp://ftp.oreilly.com/published/oreilly/nutshell/advanced_perl/examples.tar.gz

If you don't have a web browser, you can use the command-line FTP client included with Windows NT (or Windows 95).

% ftp ftp.oreilly.com
Connected to ftp.oreilly.com. 
220 ftp.oreilly.com FTP server (Version 6.34 Thu Oct 22 14:32:01 EDT 1992) ready.
Name (ftp.oreilly.com:username): anonymous 
331 Guest login ok, send e-mail address as password.
Password: username@hostname            Use your username and host here 
230 Guest login ok, access restrictions apply. 
ftp> cd /published/oreilly/nutshell/advanced_perl
250 CWD command successful. 
ftp> get README 
200 PORT command successful. 
150 Opening ASCII mode data connection for README (xxxx bytes). 
226 Transfer complete. 
local: README remote: README 
xxxx bytes received in xxx seconds (xxx Kbytes/s) 
ftp> binary
200 Type set to I.
ftp> get examples.tar.gz 
200 PORT command successful. 
150 Opening BINARY mode data connection for examples.tar.gz (xxxx bytes). 
226 Transfer complete. local: examples.tar.gz remote: examples.tar.gz 
xxxx bytes received in xxx seconds (xxx Kbytes/s) 
ftp> quit 
221 Goodbye. 
%

FTPMAIL

FTPMAIL is a mail server available to anyone who can send electronic mail to and receive electronic mail from Internet sites. Any company or service provider that allows email connections to the Internet can access FTPMAIL, as described in the following paragraph.

You send mail to . In the message body, give the FTP commands you want to run. The server will run anonymous FTP for you and mail the files back to you. To get a complete help file, send a message with no subject and the single word "help" in the body. The following is an example mail message that gets the examples. This command sends you a listing of the files in the selected directory and the requested example files. The listing is useful if you are interested in a later version of the examples.

Subject: 
reply-to username@hostname      (Message Body) Where you want files mailed 
open 
cd /published/oreilly/nutshell/advanced.perl
dir 
get README 
mode binary
uuencode
get examples.tar.gz
quit
.

A signature at the end of the message is acceptable as long as it appears after "quit."


Previous: What Must I Know?Advanced Perl ProgrammingNext: Conventions
What Must I Know?Book IndexConventions

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.