Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Continuing Evolution of Perl: Highlights of ActivePerl 5.14


Published on

Published in: Technology
  • If you would like to watch this presentation, complete with discussion, you can download the recorded webcast at any time:
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Continuing Evolution of Perl: Highlights of ActivePerl 5.14

  1. 1. The Evolution of Perl:Highlights of Perl 5.14 and whats new in the Perl world
  2. 2. Agenda• Perl, ActivePerl, and ActiveState• Version support – from the community and ActiveState• Whats new in Perl 5.14• Re-factoring or maintaining existing code• Web frameworks and Plack/PSGI• Running Perl applications in the cloud
  3. 3. Perl• Created by Larry Wall in 1987• Perl 5 released in 1995 – language syntax stabilizes – first “extensible” version (use Some::Module)• Continued improvements through the 5.x series• Perl 6 – beyond the scope of this presentation – essentially a new language – a language specification, not an official compiler – Rakudo and other compilers available for early adopters
  4. 4. ActivePerl• ActiveState contracted by Microsoft to improve Perl performance and features for Windows• ActivePerl enhancements submitted back to core Perl• ActivePerl helps popularize Perl – 2 million downloads per year• adds some useful things – PPM (Perl Package Manager) – PerlCritic (from Perl Dev Kit) – PerlScript and Perl for ISAPI extensions
  5. 5. & PPM• CPAN is a one stop shop for user-created modules – standard toolchain for building, testing, and installing modules – searchable – standardized documentation format – bug tracking – HUGE: 23,000 modules (distributions)• PPM is ActivePerls client for installing these modules – command line and GUI interface – pre-compiled packages for specific platforms and Perl versions – dependencies handled automatically – provides most modules on CPAN (around 13,000 packages per platform)
  6. 6. Perl Releases• Perl releases used to be feature-based until 5.10 – released “when its done”• time-based releases since Perl 5.12 (April 2010) – no feature milestones to define the release – only features ready by release-time will be included – predictable upgrade schedule
  7. 7. Perl Support Policy• Perl community supports the most recent two releases – new features – security patches – bug fixes• ActiveState mirrors this policy for Community Edition• Older versions available through Business Edition, Enterprise Edition and OEM – extended support – professional services
  8. 8. Whats new in Perl 5.14• Unicode improvements• Reliable exception handling• Non-destructive substitution• more...
  9. 9. Unicode• Unicode 6.0 almost fully supported• N{NAME} and charnames enhancements• use feature unicode_strings
  10. 10. Regular Expressions• New character set modifiers: – /a ASCII – /d Default (or dodgy) – /l Locale – /u Unicode• Caution: Modified stringification! for example: qr/foo/i – Old: (?i-xsm:foo) – New: (?^i:foo)
  11. 11. Non-destructive substitution(my $copy = $orig) =~ s/cat/dog/;my $copy = $orig =~ s/cat/dog/r;my @copy = map { (my $copy = $_) =~ s/cat/dog/; $copy} @orig;my @copy = map { s/cat/dog/r } @orig;
  12. 12. Exception Handling• Problems: – eval() in DESTROY methods – die() in DESTROY methods – local $@• Solution: – Set $@ as late as possible before exiting the eval scope• Exceptions are now a lot more reliable
  13. 13. Don’t use smart-match• Smart match operator ~~ introduced in 5.10.0• “Fixed” in 5.10.1 because is wasn’t working• Still considered “too smart for it’s own good” • Over 20 rules on how it works • Rules apply recursively for container types• May be replaced by “dump match” in the future• All this applies to the given/when statements too.
  14. 14. Maintaining or updating Perl code Try running it with with a newer interpreter – it may just work. The interpreter will warn about deprecated code – incremental approach: 5.8 to 5.10 to 5.12 to 5.14 • use warnings; • less likely to “break” existing code • setting up each environment takes time and effort – direct approach: upgrading directly to 5.14 • address all the incompatibilities at once • opportunity to re-factor and use new language features • great excuse to write automated tests! – write tests for the old version first, then run them against 5.12
  15. 15. Consult perldelta• each Perl release has a list of differences and incompatibilities with the previous version – – also in the ActivePerl documentation• pay particular attention to the Incompatible Changes section• dont skip a major version – the perldeltas are not cumulative - going from 5.10 to 5.14, check the 5.12 delta – you can skip odd numbered development releases (5.9, 5.11, etc.)
  16. 16. Check all modules• binary modules are NOT compatible between major Perl versions (e.g. 5.12 to 5.14)• update to the latest modules where possible• using PPM helps (ppm profile ...)• Check the modules Changes file and documentation
  17. 17. Use Perl::Critic• Perl::Critic – for examining your source code – uses Conways “Perl Best Practices” – points out bad or deprecated code and suggests alternatives• ActivePerl has a helpful GUI interface – added in 5.12 – formerly part of the Perl Dev Kit
  18. 18. ... or dont upgrade• You may choose not to upgrade to 5.12 or 5.14 – there are commercial support options:• ActivePerl Business Edition provides access to older builds of ActivePerl• ActivePerl Enterprise Edition can provide access and support for specific versions and platform builds• OEM licensing lets you distribute ActivePerl with your product
  19. 19. Web Frameworks and Plack/PSGI• Catalyst• Mojolicious• Dancer... all work with Plack/PSGI• interface between Perl web applications and web servers• simplifies web application deployment
  20. 20. Catalyst• most popular framework in a recent ActiveState survey – relatively speaking, its been around a long time (2005) – wide enterprise adoption• a “heavyweight” framework – many dependencies – very “TMTOWTDO” design, lots of choices for sub- components – very flexible
  21. 21. Mojolicious• new web framework from author of Catalyst, Sebastian Riedel• Mojo originally intended as a rewrite of Catalyst internals• lighter weight – fewer dependencies – “optimized for user-friendliness”
  22. 22. Dancer• micro-framework• for smaller sites, web services, or people who just prefer a very lightweight framework• similar to Rubys Sinatra or Pythons Flask
  23. 23. Perl in the cloudThe Platform as a Service approach proved very popular in the Ruby on Rails community – has also caught on with other languages and frameworks• a framework for frameworks... – not a PaaS... its for creating your own PaaS – supports multiple languages and frameworks – Perl web apps via PSGI – based on Cloud Foundry – more accessible for Perl and Python developers –
  24. 24. Thank You Speak to a representative about ActivePerl Business Edition, Enterprise Edition or OEM: 1-866-510-2914 www.activestate.com08/12/10