Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12


Published on

With the growth in dynamic languages, Perl still rules the roost as “the duct tape of the Internet.” Now that Perl 5.12 and Perl Dev Kit 9 are available, are you ready to make the move? In this webinar for Perl developers and system administrators, join Jan Dubois, senior Perl developer at ActiveState, and Troy Topnik, technical writer at ActiveState to learn:

* What’s new in Perl 5.12
* What to do with legacy code
* Assess if you need to upgrade
* How to deploy quickly and efficiently
* How to use CPAN and Perl Package Manger (PPM) for managing 3rd party modules
* Deployment choices including web, system, desktop and utility applications

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12

  1. 1. Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
  2. 2. Poll
  3. 3. Agenda <ul><li>Perl, ActivePerl, and ActiveState </li></ul><ul><li>Resilience and continued growth of Perl </li></ul><ul><li>What's new in Perl 5.12 </li></ul><ul><li>Updating legacy code </li></ul><ul><li>Distributing and deploying applications </li></ul>
  4. 4. Perl <ul><li>Created by Larry Wall in 1987 </li></ul><ul><ul><li>Perl 2 1988 </li></ul></ul><ul><ul><li>Perl 3 1989 </li></ul></ul><ul><ul><li>Perl 4 1991 </li></ul></ul><ul><li>Perl 5 released in 1995 </li></ul><ul><ul><li>language syntax stabilizes </li></ul></ul><ul><ul><li>all the major parts are there </li></ul></ul><ul><ul><li>first “extensible” version (use Some::Module) </li></ul></ul><ul><li>Continued incremental improvements through the 5.x series </li></ul><ul><li>Perl 6 – beyond the scope of this presentation </li></ul><ul><ul><li>is essentially a new language </li></ul></ul><ul><ul><li>not ready yet, though Rakudo Star is getting closer </li></ul></ul>
  5. 5. ActivePerl <ul><li>the first distribution of Perl for Windows </li></ul><ul><li>ActiveState hired by Microsoft to improve Perl performance and features for Windows </li></ul><ul><li>Gurusamy Sarathy (gsar), the Perl “Pumpking” </li></ul><ul><li>enhancements for ActivePerl submitted upstream to core Perl </li></ul><ul><li>ActivePerl helps popularize Perl: 2 million downloads per year </li></ul><ul><li>added some useful things: </li></ul><ul><ul><li>PPM (Perl Package Manager) </li></ul></ul><ul><ul><li>PerlScript and Perl for ISAPI extensions </li></ul></ul>
  6. 6. <ul><li>CPAN is a 'one stop shop' for user-created modules </li></ul><ul><ul><li>standard toolchin for building, testing, and installing modules </li></ul></ul><ul><ul><li>searchable </li></ul></ul><ul><ul><li>standardized documentation format </li></ul></ul><ul><ul><li>bug tracking </li></ul></ul><ul><ul><li>HUGE: 18,000 modules </li></ul></ul><ul><li>PPM is ActivePerl's client for installing these modules </li></ul><ul><ul><li>command line and GUI interface </li></ul></ul><ul><ul><li>pre-compiled packages for specific platforms and Perl versions </li></ul></ul><ul><ul><li>dependencies handled automatically </li></ul></ul><ul><ul><li>provides most modules on CPAN (around 13,000) </li></ul></ul>& PPM
  7. 7. The Resilience of Perl <ul><li>“ the duct tape of the internet” (but much more) </li></ul><ul><li>unfashionable != unpopular|obsolete </li></ul><ul><li>key modules provide functionality outside the core </li></ul><ul><ul><li>object oriented programming via Moose </li></ul></ul><ul><ul><li>web frameworks: Catalyst, HTML::Mason et al. </li></ul></ul><ul><li>mature language – changes are more incremental </li></ul><ul><ul><li>threading / fork() emulation in Perl 5.6 </li></ul></ul><ul><ul><li>Unicode support in Perl 5.8 </li></ul></ul>
  8. 8. Poll
  9. 9. Perl Releases <ul><li>Perl releases used to be feature-based until 5.10 </li></ul><ul><li>significant features in Perl 5.10: </li></ul><ul><ul><li>given/when statement, smartmatch operator ~~ </li></ul></ul><ul><ul><li>defined-or operator // </li></ul></ul><ul><ul><li>recursive regexp patterns </li></ul></ul><ul><ul><li>named regexp capture groups </li></ul></ul><ul><li>Perl 5.12 and forward are time-based </li></ul><ul><ul><li>no feature milestones to define the release </li></ul></ul><ul><ul><li>only features ready by release-time will be included </li></ul></ul>
  10. 10. What's new in Perl 5.12 <ul><li>lots of bug fixes not available elsewhere </li></ul><ul><ul><li>maintenance releases will only fix regressions, critical bugs (crashes) and security vulnerabilities </li></ul></ul><ul><li>deprecation warnings enabled by default </li></ul><ul><li>various &quot;little&quot; features </li></ul>
  11. 11. package NAME VERSION <ul><li>This statement is parsed exactly the same way as </li></ul><ul><li>“ use PACKAGE VERSION ”. For example: </li></ul><ul><li>package Foo::Bar 1.23; </li></ul><ul><li>... sets the module version right in the &quot;package&quot; statement at compile time, without having to assign to $VERSION at run-time </li></ul>
  12. 12. The “Yada Yada” operator <ul><ul><li>For example </li></ul></ul><ul><ul><li>if ($condition) { ... } </li></ul></ul><ul><ul><li> the same as: </li></ul></ul><ul><ul><li>if ($condition) { die &quot;unimplemented&quot; } </li></ul></ul><ul><ul><li>marks unimplemented, placeholder code </li></ul></ul><ul><ul><li>pseudo-code becomes compile-able, tests pass </li></ul></ul>
  13. 13. Implicit strictures <ul><li>An explicit request to require Perl 5.12 or later will automatically turn on &quot;use strict&quot; </li></ul><ul><li>For example: </li></ul><ul><li>use 5.12.0; </li></ul><ul><li>implies: </li></ul><ul><li>use strict; </li></ul><ul><li>use feature &quot;:5.12&quot;; </li></ul>
  14. 14. ...and more... <ul><li>Unicode improvements </li></ul><ul><ul><li>now supports all Unicode properties </li></ul></ul><ul><ul><li>use feature &quot;Unicode_strings&quot;; </li></ul></ul><ul><li>Y2038 compliance even on 32-bit systems </li></ul><ul><li>new pragmata </li></ul><ul><ul><li>autodie </li></ul></ul><ul><ul><li>overloading </li></ul></ul><ul><li>N regex escape: opposite of </li></ul><ul><li>pluggable keywords </li></ul><ul><li>qr// overloading </li></ul>
  15. 15. Updating legacy code <ul><li>Blog comment spotted in the wild: </li></ul><ul><ul><li>“ There’s a lot of legacy Perl out there, and the host organisations are naturally afraid to touch it. So if there was a guide to “De-legacy your Perl” or “Bring your legacy Perl into the light” it may be highly valued. That’s not the same as writing good Perl: it’s about understanding and incrementally saving code that’s already there. That book has not yet been written.” </li></ul></ul><ul><ul><ul><ul><ul><li>Nik Silver </li></ul></ul></ul></ul></ul><ul><li>There's no book, but there are tools and documentation... </li></ul>
  16. 16. Try running it! <ul><ul><li>Run the old code with with a newer interpreter – it may just work. </li></ul></ul><ul><ul><li>The interpreter will warn about deprecated code </li></ul></ul><ul><ul><li>incremental approach: 5.6 to 5.8 to 5.10 to 5.12 </li></ul></ul><ul><ul><ul><li>use warnings; </li></ul></ul></ul><ul><ul><ul><li>less likely to “break” existing code </li></ul></ul></ul><ul><ul><ul><li>setting up each environment takes time and effort </li></ul></ul></ul><ul><ul><ul><li>tempting to stay with a “less obsolete” version </li></ul></ul></ul><ul><ul><li>“ bite the bullet” approach: upgrading directly to 5.12 </li></ul></ul><ul><ul><ul><li>address all the incompatibilities at once </li></ul></ul></ul><ul><ul><ul><li>opportunity to use new language features </li></ul></ul></ul><ul><ul><ul><li>great excuse to write automated tests! </li></ul></ul></ul><ul><ul><ul><ul><li>write tests for the old version first, then run them against 5.12 </li></ul></ul></ul></ul>
  17. 17. Poll
  18. 18. Consult perldelta <ul><li>each perl release has a list of differences and incompatibilities with the previous version </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li>also in the ActivePerl documentation </li></ul></ul><ul><li>pay particular attention to the Incompatible Changes section </li></ul><ul><li>don't skip a version, the perldeltas are not cumulative (e.g. going from 5.8 to 5.12, check the 5.10 delta and all point releases) </li></ul><ul><ul><li>you can skip development releases (5.7, 5.9, 5.11, etc.) </li></ul></ul>
  19. 19. Check all modules <ul><li>binary modules are NOT compatible between major Perl versions (e.g. 5.8 to 5.10) </li></ul><ul><li>update to the latest modules (unless that proves too hard) </li></ul><ul><li>using PPM helps – installing vs. building plus installing saves time </li></ul><ul><li>Check the module's Changes file and documentation </li></ul>
  20. 20. Use Perl::Critic <ul><li>Perl::Critic – a tool for examining your source code </li></ul><ul><ul><li>uses Conway's “Perl Best Practices” </li></ul></ul><ul><ul><li>points out bad or deprecated code and suggests alternatives </li></ul></ul><ul><li>PDK has a helpful GUI interface </li></ul>
  21. 21. ... or don't upgrade <ul><li>choosing not to upgrade is viable if: </li></ul><ul><ul><li>your code is not business or mission-critical (i.e. nobody would care if it broke), or </li></ul></ul><ul><ul><li>you have commercial support for the older Perl version </li></ul></ul><ul><li>ActivePerl Business Edition provides access to older builds of ActivePerl </li></ul><ul><li>ActivePerl Enterprise Edition can provide access and support for specific versions and platform builds </li></ul>
  22. 22. Deploying / Distributing <ul><li>Deploying or distributing code written in an interpreted language is different from deploying compiled binaries. </li></ul><ul><li>Traditionally, the target system requires: </li></ul><ul><ul><li>the source code of the application </li></ul></ul><ul><ul><li>an interpreter compatible with the code </li></ul></ul><ul><ul><li>all required modules/libraries </li></ul></ul><ul><li>Depending on the type of application, there are a few different approaches... </li></ul>
  23. 23. User/Customer supplies interpreter <ul><li>Linux, Mac OS X, and most UNIX-like operating systems have their own Perl interpreters, but: </li></ul><ul><ul><li>may be the wrong version for your code </li></ul></ul><ul><ul><li>some required binary modules may not be available (as packages) </li></ul></ul><ul><li>ActivePerl Community Edition is available for free, but: </li></ul><ul><ul><li>additional hassle for the customer </li></ul></ul><ul><ul><li>Windows, Mac OS X, and Linux only </li></ul></ul><ul><ul><li>latest releases of 5.12, 5.10, and 5.8 only </li></ul></ul><ul><ul><li>support is from the Perl comunity, not a vendor </li></ul></ul><ul><li>ActivePerl Business Edition </li></ul>
  24. 24. Packaging the application <ul><li>PDK deployment tools (PerlApp, PerlSvc, PerlCtrl et al.) package your perl code with: </li></ul><ul><ul><li>an embedded perl interpreter </li></ul></ul><ul><ul><li>all required modules / libraries </li></ul></ul><ul><li>suitable for desktop applications and system services </li></ul><ul><li>to the end user, it's just a native executable </li></ul><ul><ul><li>no additional prerequisite software needed </li></ul></ul><ul><ul><li>no additional cost or hassle for the end user </li></ul></ul><ul><li>end users cannot easily modify the application </li></ul>
  25. 25. In-House Perl vs. ActivePerl OEM <ul><li>For enterprise-level or otherwise large scale “systems” software, distributing a real Perl interpreter may be preferable to packaging </li></ul><ul><ul><ul><li>integrators or customers may need access to the code (making changes on the fly) </li></ul></ul></ul><ul><ul><ul><li>may have a suite of related applications which use the same environment / modules </li></ul></ul></ul><ul><ul><ul><li>performance advantages </li></ul></ul></ul><ul><li>A “Roll your own” Perl distribution: </li></ul><ul><ul><ul><li>lots of maintenance overhead in addition to your own code </li></ul></ul></ul><ul><ul><ul><li>harder to keep up-to-date </li></ul></ul></ul><ul><li>ActivePerl OEM: lets you distribute ActivePerl with your own software </li></ul><ul><ul><ul><li>QA and support </li></ul></ul></ul><ul><ul><ul><li>indemnification </li></ul></ul></ul>
  26. 26. Poll
  27. 27. <ul><li>Founded 1997 </li></ul><ul><li>2 million developers, 97% of Fortune 1000 rely on ActiveState </li></ul><ul><li>Development, management, distribution solutions for dynamic languages </li></ul><ul><li>Core languages: Perl, Python, Tcl </li></ul><ul><li>Other: PHP, Ruby, Javascript </li></ul>ActiveState
  28. 28. ActiveState solutions
  29. 29. <ul><li>Get Perl Dev Kit 9 – on sale until Aug. 15 th </li></ul><ul><ul><li>1-user: $245 (save $50) </li></ul></ul><ul><ul><li>5-pack: $995 (save $185) </li></ul></ul><ul><ul><li>Upgrade from $95 (save ($50) </li></ul></ul><ul><li>Get ActivePerl 5.12 Business Edition : </li></ul><ul><ul><li>Use code APBE200 to get $250 off until Aug. 30th </li></ul></ul><ul><li>Speak to a representative about ActivePerl 5.12 Enterprise or OEM: 1-866-510-2914 </li></ul><ul><li> </li></ul><ul><li> </li></ul>