minimal_perl_for_unix_and_linux_people.pdf

时间:2022-09-06 18:38:33
【文件属性】:
文件名称:minimal_perl_for_unix_and_linux_people.pdf
文件大小:5.72MB
文件格式:PDF
更新时间:2022-09-06 18:38:33
minimal perl unix linux people In this preface, I’ll tell you about the history of Minimal Perl and the origins of this book. THE HISTORY OF MINIMAL PERL The seeds of this book were sown many years ago, when I was building up my knowl- edge of Perl, the greatest programming language I’d ever encountered (before or since). While reading a variety of books on the subject, I was surprised that the authors felt obliged to delve into so many of the different but equivalent choices for expressing every basic operation in the language, as well as each of the syntactic variations for expressing any one of those choices. As an example, I’ve shown here some of the available choices for expressing in Perl the simple idea that B should be executed only if A is True (with those letters repre- senting arbitrary program elements). Both forward and backward variations for expressing the dependency are included:1 Although some are inclined to present symptoms like these of Perl’s complexity and redundancy as evidence of its “richness,” “versatility,” or “expressiveness,” many Perl novices would surely have a different reaction—that Perl is needlessly complex and too hard to learn. Minimal Perl was created to address these obstacles presented by Perl’s redundancy and complexity. By emphasizing Perl’s grep, sed, and awk-like features, and relying Forward Backward A and B; B if A; A && B; B if A; A and do { B }; do { B } if A; A && do { B }; do { B } if A; if (A) { B }; B if A; unless (!A) { B }; B unless !A; 1Before you despair, I should point out that Minimal Perl uses only 2 of these variations—which is all anybody needs! xx on concepts such as inputs, filters, and arguments, it allows Unix1 users to directly apply their existing knowledge to the task of learning Perl. So rather than being frustrated with Perl’s complexities and disappointed with its steep learning curve, they quickly and painlessly acquire the ability to write useful programs that can solve a wide variety of problems. My first public presentation on this subject was in a tutorial called “Minimal Perl for the Impatient” at the YAPC::Europe 2001 conference2 in Amsterdam, the Nether- lands. The eagerness with which that audience devoured the material confirmed my hunch that many were hungering for an easier way to learn Perl. Since then, I’ve taught Minimal Perl at other professional conferences, at meetings of Perl Users Groups in the US and Canada, and to many Fortune 500 companies. THE GENESIS OF THE BOOK By 2001, the Minimal Perl approach had convincingly proven its ability to help Unix people acquire Perl skills with relative ease. But many who could appreciate its benefits never get to see conference presentations or attend corporate training classes, so I became interested in making this information available to a wider audience. However, I had some serious reservations about embarking on a book, having heard many sobering stories from colleagues about the travails of authorship. Fortu- nately, I received some encouragement that was instrumental in helping me decide to go forward with this project, from a good friend—Dr. Damian Conway. A little help from my friend Damian and I first met after my presentation on the first “Perl Beautifier” at The Perl Conference in 1998,3 when he gently informed me that I could have categorized Perl source code into its constituent elements by using a program he had written (in Perl’s module format), rather than writing my own from scratch to attempt that difficult task. After examining more of his ingenious modules and reading his excellent book Object Oriented Perl,4 I soon realized that Damian had a deeper understanding of Perl than almost anyone else. To allow others to benefit from his insights, I arranged for him to periodically teach Perl classes through my Seattle-based company (Consultix) and also to present talks to our Seattle Perl Users Group (SPUG, aka Seattle.pm). This worked out wonderfully for Seattleites, who would learn practical Perl incantations 1In this book, Unix is shorthand for “UNIX, Linux, and related operating systems,” as detailed in the “Essential terminology” section of “About this book.” 2See this book’s glossary for the definition of YAPC. 3For more details, see http://TeachMePerl.com/perl_beautifier.html. 4His book is described at http://www.manning.com/conway. It’s for a more advanced audience than this one. xxi from him during the formal daytime sessions and then enjoy his overtly hilarious (yet covertly educational) conference-style presentations by night. Damian is probably still blushing from my effusive introductions of him as •The Perl Wonder from Down Under (because he’s an Aussie), and •The Supreme Modulator of Perl.1 But I feel vindicated, because by now everybody knows I was correct in my estimation of his uniqueness and importance to the Perl community. An auspicious weather non-event During one week while Damian was in Seattle as a visiting instructor for Consultix, we took an extended bike ride along the shore of Lake Washington together—and we didn’t even get drenched by rain! As a long-time Seattleite, I knew this to be an extremely auspicious sign, so I seized the opportunity to tell him about my interest in writing a Minimal Perl book. Being a fellow fan of the AWK language (which is Perlish, but simpler)—and having a keen interest in making Perl more accessible to novices— he expressed enthusiasm for the project and offered some interesting ideas about how to approach it. The combination of my ideas with some of Damian’s—along with sufficient fer- mentation and seasoning—ultimately led to the format, content, and approach of the book you now hold. The result is a volume that teaches Perl in ways no book has done before! I hope you enjoy reading it as much as I did writing it.

网友评论