Mastering Perl, 2Nd Edition.Pdf

Total Page:16

File Type:pdf, Size:1020Kb

Mastering Perl, 2Nd Edition.Pdf SECOND EDITION Mastering Perl brian d foy Mastering Perl, Second Edition by brian d foy Copyright © 2014 brian d foy. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editor: Rachel Roumeliotis Indexer: Lucie Haskins Production Editor: Kara Ebrahim Cover Designer: Randy Comer Copyeditor: Becca Freed Interior Designer: David Futato Proofreader: Charles Roumeliotis Illustrator: Rebecca Demarest January 2014: Second Edition Revision History for the Second Edition: 2014-01-08: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449393113 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Mastering Perl, Second Edition, the image of a vicuña and her young, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-39311-3 [LSI] Table of Contents Preface. xi 1. Advanced Regular Expressions. 1 Readable Regexes, /x and (?#…) 1 Global Matching 3 Global Match Anchors 5 Recursive Regular Expressions 7 Repeating a Subpattern 7 Lookarounds 18 Lookahead Assertions, (?=PATTERN) and (?!PATTERN) 18 Lookbehind Assertions, (?<!PATTERN) and (?<=PATTERN) 22 Debugging Regular Expressions 25 The -D Switch 25 Summary 29 Further Reading 29 2. Secure Programming Techniques. 31 Bad Data Can Ruin Your Day 31 Taint Checking 32 Warnings Instead of Fatal Errors 34 Automatic Taint Mode 35 mod_perl 35 Tainted Data 35 Side Effects of Taint Checking 36 Untainting Data 37 IO::Handle::untaint 39 Hash Keys 40 Taint::Util 41 Choosing Untainted Data with Tainted Data 41 iii Symbolic References 42 Defensive Database Programming with DBI 45 List Forms of system and exec 47 Three-Argument open 48 sysopen 49 Limit Special Privileges 49 Safe Compartments 50 Safe Limitations 56 A Little Fun 56 Summary 57 Further Reading 58 3. Perl Debuggers. 59 Before You Waste Too Much Time 59 The Best Debugger in the World 60 Safely Changing Modules 61 Wrapping Subroutines 62 The Perl Debugger 65 Alternative Debuggers 66 Using a Different Debugger with -d 66 Devel::ptkdb 66 Devel::ebug 68 Devel::hdb 69 IDE Debuggers 70 EPIC 70 Komodo 70 Summary 70 Further Reading 71 4. Profiling Perl. 73 Finding the Culprit 73 The General Approach 77 Profiling DBI 79 Other DBI::Profile Reports 83 Making It Even Easier 84 Switching Databases 85 Devel::NYTProf 87 Writing My Own Profiler 88 Devel::LineCounter 88 Profiling Test Suites 89 Devel::Cover 89 Summary 91 iv | Table of Contents Further Reading 91 5. Benchmarking Perl. 93 Benchmarking Theory 93 Benchmarking Time 95 Comparing Code 98 Don’t Turn Off Your Thinking Cap 101 Isolating the Environment 105 Handling Outliers 107 Memory Use 109 The perlbench Tool 114 Summary 116 Further Reading 116 6. Cleaning Up Perl. 119 Good Style 119 perltidy 120 Deobfuscation 122 De-encoding Hidden Source 122 Unparsing Code with B::Deparse 125 Perl::Critic 127 Creating My Own Perl::Critic Policy 130 Summary 131 Further Reading 132 7. Symbol Tables and Typeglobs. 133 Package and Lexical Variables 133 Getting the Package Version 135 The Symbol Table 137 Typeglobs 139 Aliasing 142 Filehandle Arguments in Older Code 144 Naming Anonymous Subroutines 145 The Easy Way 146 Summary 147 Further Reading 148 8. Dynamic Subroutines. 149 Subroutines as Data 149 Creating and Replacing Named Subroutines 153 Symbolic References 155 Iterating Through Subroutine Lists 157 Table of Contents | v Processing Pipelines 159 Self-Referencing Anonymous Subroutines 160 Method Lists 160 Subroutines as Arguments 161 Autoloaded Methods 165 Hashes as Objects 167 AutoSplit 168 Summary 169 Further Reading 169 9. Modifying and Jury-Rigging Modules. 171 Choosing the Right Solution 171 Sending Patches to the Author 171 Local Patches 173 Taking Over a Module 173 Forking 174 Starting Over on My Own 174 Replacing Module Parts 174 Subclassing 177 An ExtUtils::MakeMaker Example 179 Other Examples 182 Wrapping Subroutines 182 Summary 184 Further Reading 184 10. Configuring Perl Programs. 185 Things Not to Do 185 Code in a Separate File 187 Better Ways 188 Environment Variables 188 Special Environment Variables 189 Turning on Extra Output 189 Command-Line Switches 191 The -s Switch 192 Getopt Modules 193 Configuration Files 198 ConfigReader::Simple 198 Config::IniFiles 199 Config::Scoped 199 Other Configuration Formats 200 Scripts with a Different Name 200 Interactive and Noninteractive Programs 201 vi | Table of Contents perl’s Config 202 Different Operating Systems 203 Summary 204 Further Reading 204 11. Detecting and Reporting Errors. 205 Perl Error Basics 205 Operating System Errors 206 Child Process Errors 208 Errors Specific to the Operating System 210 Reporting Module Errors 211 Separation of Concerns 211 Exceptions 213 eval 214 Multiple Levels of die 215 die with a Reference 216 Propagating Objects with die 218 Clobbering $@ 220 autodie 222 Reporting the Culprit 223 Catching Exceptions 227 Try::Tiny 227 TryCatch 229 Polymorphic Return Values 230 Summary 231 Further Reading 231 12. Logging. 233 Recording Errors and Other Information 233 Log4perl 234 Subroutine Arguments 236 Configuring Log4perl 237 Persistent Configuration 241 Logging Categories 241 Other Log::Log4perl Features 243 Summary 245 Further Reading 245 13. Data Persistence. 247 Perl-Specific Formats 247 pack 247 Fixed-Length Records 249 Table of Contents | vii Unpacking Binary Formats 249 Data::Dumper 250 Similar Modules 254 Storable 256 Freezing Data 257 Storable’s Security Problem 260 Sereal 262 DBM Files 267 dbmopen 268 DBM::Deep 268 Perl-Agnostic Formats 270 JSON 270 YAML 272 MessagePack 274 Summary 275 Further Reading 275 14. Working with Pod. 277 The Pod Format 277 Directives 277 Encoding 279 Body Elements 279 Translating Pod 279 Pod Translators 280 Pod::Perldoc::ToToc 281 Pod::Simple 283 Subclassing Pod::Simple 286 Pod in Your Web Server 286 Testing Pod 286 Checking Pod 287 Pod Coverage 287 Hiding and Ignoring Functions 289 Summary 290 Further Reading 290 15. Working with Bits. 291 Binary Numbers 291 Writing in Binary 292 Bit Operators 293 Unary NOT (~) 294 Bitwise AND (&) 296 Binary OR (|) 297 viii | Table of Contents Exclusive OR (^) 298 Left << and Right >> Shift Operators 300 Bit Vectors 300 The vec Function 302 Bit String Storage 304 Storing DNA 306 Checking Primes 307 Keeping Track of Things 309 Summary 310 Further Reading 310 16. The Magic of Tied Variables. 311 They Look Like Normal Variables 311 At the User Level 312 Behind the Curtain 313 Scalars 314 Tie::Cycle 314 Bounded Integers 317 Self-Destructing Values 318 Arrays 319 Reinventing Arrays 320 Something a Bit More Realistic 323 Hashes 328 Filehandles 331 Summary 333 Further Reading 333 17. Modules as Programs. 335 The main Thing 335 Backing Up 336 Who’s Calling? 337 Testing the Program 338 Modules as Tests 338 Creating a Program Distribution 343 Adding to the Script 345 Distributing the Programs 350 Summary 350 Further Reading 351 A. Further Reading. 353 B. brian’s Guide to Solving Any Perl Problem. 357 Table of Contents | ix Index of Perl Modules in This Book. 364 Index. 367 x | Table of Contents Preface Mastering Perl is the third book in the series starting with Learning Perl, which taught you the basics of Perl syntax, progressing to Intermediate Perl, which taught you how to create reusable Perl software, and finally this book, which pulls everything together to show you how to bend Perl to your will. This isn’t a collection of clever tricks, but a way of thinking about Perl programming so you integrate the real-life problems of debugging, maintenance, configuration, and other tasks you’ll encounter as a working programmer. This book starts you on your path to becoming the person with the an‐ swers, and, failing that, the person who knows how to find the answers or discover the problem. Becoming a Master This book isn’t going to make you a Perl master; you have to do that for yourself by programming a lot of Perl, trying a lot of new things, and making a lot of mistakes. I’m going to help you get on the right path, but the road to mastery is one of self-reliance and independence. As a Perl master, you’ll be able to answer your own questions as well as those of others. In the golden age of guilds, craftsmen followed a certain path, both literally and figu‐ ratively, as they mastered their craft. They started as apprentices and would do the boring bits of work until they had enough skill to become the more trusted journeyman. The journeyman had greater responsibility but still worked under a recognized master. When they had learned enough of the craft, the journeymen would produce a “master work” to prove their skill. If other masters deemed it adequately masterful, the jour‐ neyman became a recognized master himself. The journeymen and masters also traveled (although people dispute if that’s where the “journey” part of the name came from) to other masters, where they would learn new techniques and skills.
Recommended publications
  • Learning to Program in Perl
    Learning to Program in Perl by Graham J Ellis Languages of the Web Learning to Program in Perl version 1.7 Written by Graham Ellis [email protected] Design by Lisa Ellis Well House Consultants, Ltd. 404, The Spa, Melksham, Wiltshire SN12 6QL England +44 (0) 1225 708 225 (phone) +44 (0) 1225 707 126 (fax) Find us on the World Wide Web at: http://www.wellho.net Or contact us at: [email protected] Copyright © 2003 by Well House Consultants, Ltd. Printed in Great Britain. Printing History May 1999 1.0 First Edition February 2000 1.1 Minor additions June 2000 1.2 Compliation of modules October 2000 1.3 Name change, revisions April 2002 1.4 Added modules September 2002 1.5 Added modules January 2003 1.6 Updated modules February 2003 1.7 Updated modules This manual was printed on 21 May 2003. Notice of Rights All rights reserved. No part of this manual, including interior design, may be reproduced or translated into any language in any form, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without prior written permission of Well House Consultants except in the case of brief quotations embodied in critical articles and reviews. For more information on getting permission for reprints and excerpts, contact Graham Ellis at Well House Consultants. This manual is subject to the condition that it shall not, by way of trade or otherwise, be lent, sold, hired out or otherwise circulated without the publisher's prior consent, incomplete nor in any form of binding or cover other than in which it is published and without a similar condition including this condition being imposed on the subsequent receiver.
    [Show full text]
  • How to Secure Your Web Site Picked up SQL Injection and Cross-Site Scripting As Sample Cases of Failure Because These Two Are the Two Most Reported Vulnerabilities
    How to Secure your Website rd 3 Edition Approaches to Improve Web Application and Web Site Security June 2008 IT SECURITY CENTER (ISEC) INFORMATION-TECHNOLOGY PROMOTION AGENCY, JAPAN This document is a translation of the original Japanese edition. Please be advises that most of the references referred in this book are offered in Japanese only. Both English and Japanese edition are available for download at: http://www.ipa.go.jp/security/english/third.html (English web page) http://www.ipa.go.jp/security/vuln/websecurity.html (Japanese web page) Translated by Hiroko Okashita (IPA), June 11 2008 Contents Contents ......................................................................................................................................... 1 Preface ........................................................................................................................................... 2 Organization of This Book ........................................................................................................... 3 Intended Reader ......................................................................................................................... 3 Fixing Vulnerabilities – Fundamental Solution and Mitigation Measure - .................................... 3 1. Web Application Security Implementation ............................................................................... 5 1.1 SQL Injection .................................................................................................................... 6 1.2
    [Show full text]
  • [PDF] Beginning Raku
    Beginning Raku Arne Sommer Version 1.00, 22.12.2019 Table of Contents Introduction. 1 The Little Print . 1 Reading Tips . 2 Content . 3 1. About Raku. 5 1.1. Rakudo. 5 1.2. Running Raku in the browser . 6 1.3. REPL. 6 1.4. One Liners . 8 1.5. Running Programs . 9 1.6. Error messages . 9 1.7. use v6. 10 1.8. Documentation . 10 1.9. More Information. 13 1.10. Speed . 13 2. Variables, Operators, Values and Procedures. 15 2.1. Output with say and print . 15 2.2. Variables . 15 2.3. Comments. 17 2.4. Non-destructive operators . 18 2.5. Numerical Operators . 19 2.6. Operator Precedence . 20 2.7. Values . 22 2.8. Variable Names . 24 2.9. constant. 26 2.10. Sigilless variables . 26 2.11. True and False. 27 2.12. // . 29 3. The Type System. 31 3.1. Strong Typing . 31 3.2. ^mro (Method Resolution Order) . 33 3.3. Everything is an Object . 34 3.4. Special Values . 36 3.5. :D (Defined Adverb) . 38 3.6. Type Conversion . 39 3.7. Comparison Operators . 42 4. Control Flow . 47 4.1. Blocks. 47 4.2. Ranges (A Short Introduction). 47 4.3. loop . 48 4.4. for . 49 4.5. Infinite Loops. 53 4.6. while . 53 4.7. until . 54 4.8. repeat while . 55 4.9. repeat until. 55 4.10. Loop Summary . 56 4.11. if . ..
    [Show full text]
  • Learning Perl Through Examples Part 2 L1110@BUMC 2/22/2017
    www.perl.org Learning Perl Through Examples Part 2 L1110@BUMC 2/22/2017 Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Tutorial Resource Before we start, please take a note - all the codes and www.perl.org supporting documents are accessible through: • http://rcs.bu.edu/examples/perl/tutorials/ Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Sign In Sheet We prepared sign-in sheet for each one to sign www.perl.org We do this for internal management and quality control So please SIGN IN if you haven’t done so Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Evaluation One last piece of information before we start: www.perl.org • DON’T FORGET TO GO TO: • http://rcs.bu.edu/survey/tutorial_evaluation.html Leave your feedback for this tutorial (both good and bad as long as it is honest are welcome. Thank you) Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 Today’s Topic • Basics on creating your code www.perl.org • About Today’s Example • Learn Through Example 1 – fanconi_example_io.pl • Learn Through Example 2 – fanconi_example_str_process.pl • Learn Through Example 3 – fanconi_example_gene_anno.pl • Extra Examples (if time permit) Yun Shen, Programmer Analyst [email protected] IS&T Research Computing Services Spring 2017 www.perl.org Basics on creating your code How to combine specs, tools, modules and knowledge. Yun Shen, Programmer Analyst [email protected] IS&T Research Computing
    [Show full text]
  • "This Book Was a Joy to Read. It Covered All Sorts of Techniques for Debugging, Including 'Defensive' Paradigms That Will Eliminate Bugs in the First Place
    Perl Debugged By Peter Scott, Ed Wright Publisher : Addison Wesley Pub Date : March 01, 2001 ISBN : 0-201-70054-9 Table of • Pages : 288 Contents "This book was a joy to read. It covered all sorts of techniques for debugging, including 'defensive' paradigms that will eliminate bugs in the first place. As coach of the USA Programming Team, I find the most difficult thing to teach is debugging. This is the first text I've even heard of that attacks the problem. It does a fine job. Please encourage these guys to write more." -Rob Kolstad Perl Debugged provides the expertise and solutions developers require for coding better, faster, and more reliably in Perl. Focusing on debugging, the most vexing aspect of programming in Perl, this example-rich reference and how-to guide minimizes development, troubleshooting, and maintenance time resulting in the creation of elegant and error-free Perl code. Designed for the novice to intermediate software developer, Perl Debugged will save the programmer time and frustration in debugging Perl programs. Based on the authors' extensive experience with the language, this book guides developers through the entire programming process, tackling the benefits, plights, and pitfalls of Perl programming. Beginning with a guided tour of the Perl documentation, the book progresses to debugging, testing, and performance issues, and also devotes a chapter to CGI programming in Perl. Throughout the book, the authors espouse defensible paradigms for improving the accuracy and performance of Perl code. In addition, Perl Debugged includes Scott and Wright's "Perls of Wisdom" which summarize key ideas from each of the chapters, and an appendix containing a comprehensive listing of Perl debugger commands.
    [Show full text]
  • EN-Google Hacks.Pdf
    Table of Contents Credits Foreword Preface Chapter 1. Searching Google 1. Setting Preferences 2. Language Tools 3. Anatomy of a Search Result 4. Specialized Vocabularies: Slang and Terminology 5. Getting Around the 10 Word Limit 6. Word Order Matters 7. Repetition Matters 8. Mixing Syntaxes 9. Hacking Google URLs 10. Hacking Google Search Forms 11. Date-Range Searching 12. Understanding and Using Julian Dates 13. Using Full-Word Wildcards 14. inurl: Versus site: 15. Checking Spelling 16. Consulting the Dictionary 17. Consulting the Phonebook 18. Tracking Stocks 19. Google Interface for Translators 20. Searching Article Archives 21. Finding Directories of Information 22. Finding Technical Definitions 23. Finding Weblog Commentary 24. The Google Toolbar 25. The Mozilla Google Toolbar 26. The Quick Search Toolbar 27. GAPIS 28. Googling with Bookmarklets Chapter 2. Google Special Services and Collections 29. Google Directory 30. Google Groups 31. Google Images 32. Google News 33. Google Catalogs 34. Froogle 35. Google Labs Chapter 3. Third-Party Google Services 36. XooMLe: The Google API in Plain Old XML 37. Google by Email 38. Simplifying Google Groups URLs 39. What Does Google Think Of... 40. GooglePeople Chapter 4. Non-API Google Applications 41. Don't Try This at Home 42. Building a Custom Date-Range Search Form 43. Building Google Directory URLs 44. Scraping Google Results 45. Scraping Google AdWords 46. Scraping Google Groups 47. Scraping Google News 48. Scraping Google Catalogs 49. Scraping the Google Phonebook Chapter 5. Introducing the Google Web API 50. Programming the Google Web API with Perl 51. Looping Around the 10-Result Limit 52.
    [Show full text]
  • Coleman-Coding-Freedom.Pdf
    Coding Freedom !" Coding Freedom THE ETHICS AND AESTHETICS OF HACKING !" E. GABRIELLA COLEMAN PRINCETON UNIVERSITY PRESS PRINCETON AND OXFORD Copyright © 2013 by Princeton University Press Creative Commons Attribution- NonCommercial- NoDerivs CC BY- NC- ND Requests for permission to modify material from this work should be sent to Permissions, Princeton University Press Published by Princeton University Press, 41 William Street, Princeton, New Jersey 08540 In the United Kingdom: Princeton University Press, 6 Oxford Street, Woodstock, Oxfordshire OX20 1TW press.princeton.edu All Rights Reserved At the time of writing of this book, the references to Internet Web sites (URLs) were accurate. Neither the author nor Princeton University Press is responsible for URLs that may have expired or changed since the manuscript was prepared. Library of Congress Cataloging-in-Publication Data Coleman, E. Gabriella, 1973– Coding freedom : the ethics and aesthetics of hacking / E. Gabriella Coleman. p. cm. Includes bibliographical references and index. ISBN 978-0-691-14460-3 (hbk. : alk. paper)—ISBN 978-0-691-14461-0 (pbk. : alk. paper) 1. Computer hackers. 2. Computer programmers. 3. Computer programming—Moral and ethical aspects. 4. Computer programming—Social aspects. 5. Intellectual freedom. I. Title. HD8039.D37C65 2012 174’.90051--dc23 2012031422 British Library Cataloging- in- Publication Data is available This book has been composed in Sabon Printed on acid- free paper. ∞ Printed in the United States of America 1 3 5 7 9 10 8 6 4 2 This book is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE !" We must be free not because we claim freedom, but because we practice it.
    [Show full text]
  • Teach Yourself Perl 5 in 21 Days
    Teach Yourself Perl 5 in 21 days David Till Table of Contents: Introduction ● Who Should Read This Book? ● Special Features of This Book ● Programming Examples ● End-of-Day Q& A and Workshop ● Conventions Used in This Book ● What You'll Learn in 21 Days Week 1 Week at a Glance ● Where You're Going Day 1 Getting Started ● What Is Perl? ● How Do I Find Perl? ❍ Where Do I Get Perl? ❍ Other Places to Get Perl ● A Sample Perl Program ● Running a Perl Program ❍ If Something Goes Wrong ● The First Line of Your Perl Program: How Comments Work ❍ Comments ● Line 2: Statements, Tokens, and <STDIN> ❍ Statements and Tokens ❍ Tokens and White Space ❍ What the Tokens Do: Reading from Standard Input ● Line 3: Writing to Standard Output ❍ Function Invocations and Arguments ● Error Messages ● Interpretive Languages Versus Compiled Languages ● Summary ● Q&A ● Workshop ❍ Quiz ❍ Exercises Day 2 Basic Operators and Control Flow ● Storing in Scalar Variables Assignment ❍ The Definition of a Scalar Variable ❍ Scalar Variable Syntax ❍ Assigning a Value to a Scalar Variable ● Performing Arithmetic ❍ Example of Miles-to-Kilometers Conversion ❍ The chop Library Function ● Expressions ❍ Assignments and Expressions ● Other Perl Operators ● Introduction to Conditional Statements ● The if Statement ❍ The Conditional Expression ❍ The Statement Block ❍ Testing for Equality Using == ❍ Other Comparison Operators ● Two-Way Branching Using if and else ● Multi-Way Branching Using elsif ● Writing Loops Using the while Statement ● Nesting Conditional Statements ● Looping Using
    [Show full text]
  • Minimal Perl for UNIX and Linux People
    Minimal Perl For UNIX and Linux People BY TIM MAHER MANNING Greenwich (74° w. long.) For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. Cherokee Station PO Box 20386 Fax: (609) 877-8256 New York, NY 10021 email: [email protected] ©2007 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Tiffany Taylor 209 Bruce Park Avenue Typesetters: Denis Dalinnik, Dottie Marsico Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-932394-50-8 Printed in the United States of America 12345678910–VHG–1009080706 To Yeshe Dolma Sherpa, whose fortitude, endurance, and many sacrifices made this book possible. To my parents, Gloria Grady Washington and William N. Maher, who indulged my early interests in literature. To my limbic system, with gratitude for all the good times we’ve had together.
    [Show full text]
  • Proceedings YAPC::Europe 2012 .Com Perl Software Development Services Table of Contents 
    Proceedings YAPC::Europe 2012 .com Perl Software Development Services Table of contents Foreword 5 FatPacker: understanding and appreciating the insanity 6 Vorbild::Beitrag::POD 8 CGI.pm MUST DIE - Together we shall annihilate CGI.pm! 9 CPANTS: Kwalitative website and its tools 10 Designing the Internet of Things: Arduino and Perl 11 Dancing with WebSockets 12 Dancer 2 - Official status: 14 Practical Dancer: moving away from CGI 16 Bringing Perl to a Younger Generation 18 Asynchronous programming FTW! 22 Mojolicious 24 Continuous deployment with Perl 36 Array programming for mere mortals 37 Ontology Aware Applications 42 Distributed Code Review in Perl - State of the Practice 48 address-sanitizer - A fast memory error detector 52 Exceptional Perl 6 55 The joy of breaking stuff 59 Macros in Rakudo 66 Why statement modifiers can harm maintainability! 70 A discussion on how to organize a Perl Mongers group 72 Building C/C++ libraries with Perl 74 8PSMET#1*O0OMJOF"DDPNNPEBUJPO3FTFSWBUJPOTBOETUJMMHSPXJOH 8FOFFE1FSM%FWFMPQFST .Z4RM%#"T 8FVTF1FSM 1VQQFU "QBDIF 4PGUXBSF%FWFMPQFST 4ZT"ENJOT .Z42- .FNDBDIF (JU -JOVY $JTDP 8FC%FTJHOFST 'SPOU&OE%FWFMPQFST +VOJQFSBOENPSF /FUXPSL&OHJOFFSTBOENPSFw /08)*3*/( (SFBUMPDBUJPOJOUIFDFOUFSPG"NTUFSEBN $PNQFUJUJWF4BMBSZ3FMPDBUJPO1BDLBHF *OUFSOBUJPOBM SFTVMUESJWFOEZOBNJDXPSLFOWJSPONFOU *OUFSFTUFE XXXCPPLJOHDPNKPCT Foreword 5 Welcome to YAPC::Europe 2012. This is the fourteenth European Perl conference! The Frankfurt 8PSMET#1*O0OMJOF"DDPNNPEBUJPO3FTFSWBUJPOTBOETUJMMHSPXJOH Perlmongers have great pleasure in hosting this event this year. We‘d like to welcome you here in Frankfurt. The city that is now the heart of the Perl community for at least days. We have attendees from more than 40 countries all over the world, so there is a rich mix of different cultures and different people.
    [Show full text]
  • Intermediate Perl
    SECOND EDITION Intermediate Perl Randal L. Schwartz, brian d foy, and Tom Phoenix Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Intermediate Perl, Second Edition by Randal L. Schwartz, brian d foy, and Tom Phoenix Copyright © 2012 Randal Schwartz, brian d foy, Tom Phoenix. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editors: Simon St. Laurent and Shawn Wallace Indexer: Lucie Haskins Production Editor: Kristen Borg Cover Designer: Karen Montgomery Copyeditor: Absolute Service, Inc. Interior Designer: David Futato Proofreader: Absolute Service, Inc. Illustrator: Rebecca Demarest March 2006: First Edition. August 2012: Second Edition. Revision History for the Second Edition: 2012-07-20 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449393090 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Intermediate Perl, the image of an alpaca, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein.
    [Show full text]
  • Perlmonks.Com with a Gaim Plug-In SEEKING WISDOM
    PROGRAMMING Perl: A Gaim Plugin Get the news from perlmonks.com with a Gaim plug-in SEEKING WISDOM irst-time visitors to perlmonks. The Gaim project offers an instant messenger client that speaks a large com are rubbing their eyes in dis- Fbelief: High-caliber Perl hackers number of protocols. We’ll show you how to extend Gaim with Perl are jumping to answer even the simplest of newbie questions. The reason for this plugins. BY MICHAEL SCHILLI is that the community assigns XP (expe- rience) points for the best replies. And the more XP you have, the higher you answer a question correctly typically However, it can take a few seconds to climb in the ranking, from a novice, to a gets the most XP. Instead of pulling the download the content of a remote web monk, and slowly to expert status. web page with the latest questions time page. Both DNS name resolution and the and time again, it makes sense to script process of retrieving the content of the Best of Class the process and have the script let you requested web page can take some time, Due to the community dynamics on know when a new query arrives. during which the CPU should return to perlmonks.com, the The pmwatcher.pl script described other tasks. The tried-and-trusted POE first person to in this issue fetches the perlmonks. [3] framework provides exactly what we com page with the Newest Nodes at need. The POE kernel runs a single pro- regular intervals, remembering cess (and only a single thread), but uses older entries and sending out an cooperative multitasking between con- instant message when it discovers current tasks to ensure that each one is new postings.
    [Show full text]