Proceedings YAPC::Europe 2012 .Com Perl Software Development Services Table of Contents
Total Page:16
File Type:pdf, Size:1020Kb
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. Such an event would not be possible without you - the attendees, speakers, and sponsors. Please take the chance to get to know lots of new people and talk to old friends. Please welcome the at- tendees who are new to Perl conferences and introduce them to other Perl people. We are sure that the talks and the discussions from this Perl conference will make a major contri- bution to the Perl world. It will bring new ideas to the surface and existing ideas to new users. With more than 80 talk a lot of topics are covered. 8FOFFE1FSM%FWFMPQFST .Z4RM%#"T 8FVTF1FSM 1VQQFU "QBDIF In these proceedings you find the articles for some talks. We hope that the papers will help to re- 4PGUXBSF%FWFMPQFST 4ZT"ENJOT .Z42- .FNDBDIF (JU -JOVY $JTDP mind what was said in the talks when you are back home. 8FC%FTJHOFST 'SPOU&OE%FWFMPQFST +VOJQFSBOENPSF /FUXPSL&OHJOFFSTBOENPSFw The Frankfurt Perlmongers look forward to seeing over 80 great talks and meeting over 00 people. Enjoy the conference! Wieland Pusch, Max Maischein, Renée Bäcker /08)*3*/( Board of Frankfurt Perlmongers e.V. (SFBUMPDBUJPOJOUIFDFOUFSPG"NTUFSEBN $PNQFUJUJWF4BMBSZ3FMPDBUJPO1BDLBHF *OUFSOBUJPOBM SFTVMUESJWFOEZOBNJDXPSLFOWJSPONFOU *OUFSFTUFE XXXCPPLJOHDPNKPCT FatPacker: understanding and appreciating the insanity 6 Author: Sawyer X ([email protected]) FatPacker is yet another module that contains a high dosage of trickery which most of us probably wouldn’t think of, but solves a common problem that many of us share: the need to ship a module with all of its dependencies. This talk will cover what FatPacker is, how to use it and mainly: how it does its charm. Bio Sawyer X How it works Sawyer X is a systems administrator and Perl Tracing developer, involved in various projects (most no- The major part of FatPacker is App::FatPacker:: tably Dancer). He taught a Perl course, worked Tracer. The tracer allows to trace all the modules on Perl/Android, lectures often, and rambles oc- being used by your application. It does that by casionally on his blog. dividing to two parts: • Setting B::minus_c Abstract The tracer sets the -c option using B (the same way that perl -c works. Since this cannot be FatPacker was written by mst and allows us to reversed once done, the tracer has to be run as create a packed file with all of its dependen- a separate process (though FatPacker takes care cies. We can then send that file to wherever we of that). want, and as long as it has a Perl interpreter, it will work and will not require any prerequisite This option is set in order to prevent running the installations. script’s code. You might recognize that cpanminus provides a • Catching the loaded modules packed version under the domain http://www. Since the -c option is used, no code can actually cpanmin.us/ which enables a user to run cpan- run now. Or... is that so? There are still some blocks minus straight from the command line without that can run. One of them is the CHECK block, installing it via: which is pertinent to this operation, since it is used to catch the transition after compilation curl -kL cpanmin.us | perl - My::Module but before execution. This means that the CHECK block can run after you had already ran all the You can also download it and use it: use statements, which are compile-time state- ments. curl -kL cpanmin.us > cpanm perl cpanm My::Module Then we can see what’s in your @INC. Unlike many other attempts to find used mod- How to use ules, FatPacker’s tracer goes to the source: what perl actually loads. This gives it very ac- To use FatPacker from the command line, sim- curate results (excluding require statements), ply execute the following commands, replacing and alongside the ability to add additional myscript.pl with a script file you had written: modules (such as those you intend to require), it is a powerful tool indeed. fatpack trace myscript.pl fatpack packlists-for Fetching packlists ‘cat fatpacker.trace’ >packlists Once we have traced all the modules being used, fatpack tree `cat packlists` we use FatPacker to fetch the packlists. Those (fatpack file; cat myscript.pl) contain all the modules that were installed by the >myscript.packed.pl distribution that carried whatever module we’ve found in the trace. If we have a script that uses the wonderful Data::Printer, the trace will find File/HomeDir/FreeDesktop.pm is a module that is being used (in that form) and the packlist for it will contain all the modules that come with the 7 File::HomeDir distribution, which carries File:: Creating the packed tree HomeDir::FreeDesktop. Finally we can use fatpack file in order to create a single fi le made up of all the distributions we’ve Creating the tree collected. We then concatenate our script to the Once we have the packlist fi le locations saved, we output as well and throw it all in a nice bow and can use fatpack tree to create a fatlib direc- there it is: a completely self-contained Perl script tory which will contain the entire File::HomeDir (sans the perl interpreter). distribution. We could also include our own stuff in a lib di- Caveat rectory. FatPacker can only pack Pure-Perl modules, not XS. Vorbild::Beitrag::POD 8 Author: Chris ‘BinGOs’ Williams ([email protected]) This article is written in “dual language free style”, sometimes additional subsections, sometimes just additional english paragraphs, sometimes obvious examples are not translated. Please report any language problems, you could imagine. Bio Chris ‘BinGOs’ Bibliography Williams Chris is a systems administrator who • Strawberry Perl: http://strawberryperl.com is happy to deal with any operating system. He • ActiveState: http://www.activestate.com/perl has administrated OS/2, UNIX and Windows • Cygwin: http://www.cygwin.com networks in his time and mainly deals with Win- • mintty: http://code.google.com/p/mintty/ dows and FreeBSD systems these days. • UWIN: UWIN Overview - http://www2.re- search.att.com/~gsf/download/uwin/uwin.html In his spare time he fi nds time o be a CPAN • SFU/SUA and SUA Community: Services for Tester, a Perl5 porter and POEvangelist. UNIX: http://en.wikipedia.org/wiki/Windows_ Services_for_UNIX • SUA Community: http://www.suacommunity. Abstract com/SUA.aspx • Active Directory Service Interfaces: http:// Perl. Windows. The two are often seen as in- msdn.microsoft.com/en-us/library/windows/ compatible. But they are not. desktop/aa772170%28v=vs.85%29.aspx For the past thirteen years or so I have been valiantly using Perl in a Windows environment to do useful stuff, from text mangling to Active Directory mangling. Starting with ActivePerl from ActiveState, ex- periments with UWIN and Interix (now Services for Unix), dabbling with Cygwin, onto building my JETZT own Perls, taking up Strawberry Perl and ulti- GRATIS mately back to using Cygwin for day to day work. VORBESTELLEN: The Cygwin choice being more about improve- IHRE NEUE DOMAIN- ments in Cygwin than limitations of ‘native’ ENDUNG IM WEB! Perl on Windows, things such as mintty and the new ability to use the screen utility, and being able to work in a familiar and produc- tive command line environment, with Straw- berry Perl being the choice for deployment for elsewhere in the server environment. Active Directory manipulation using ADSI (Active Directory Service Interfaces) is one of the main uses I make of Perl, regular bulk updates to thou- sands of users when departmental reorganisa- tions occur, generating management reports, to bulk importing thumbnail photo images. In Kürze verfügbar – Web-Adressen mit neuen Endungen! Perl is the glue that mends the broken glass. Das Web wird vielfältiger: Neben den bekannten Endungen wie .de und .com gibt es ab 2013 zahlreiche neue Adressendungen – z.B. .bayern, .shop, .news, .sport, .berlin, .koeln, .earth und viele mehr. Jetzt die Gelegenheit nutzen und Ihre neue Adresse fürs Web vorbestellen – kostenlos und unverbindlich! www.united-domains.de Die besten Adressen fürs Web. DINA5.indd 1 08.08.12 13:37 CGI.pm MUST DIE - Together we shall annihilate CGI.pm! 9 Author: Sawyer X ([email protected]) Bio Sawyer X The purpose of this talk is to ruthlessly and savage- ly attack CGI.pm in the hopes that it will make you Sawyer X is a systems administrator and Perl de- interested at seeing better ways of accomplishing veloper, involved in various projects (most nota- your web programming requirements.