Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
-
Upload
activestate -
Category
Technology
-
view
6 -
download
1
description
Transcript of Keeping up with Perl: Development, Upgrade and Deployment Options for Perl 5.12
Keeping up with Perl:
Development, Upgrade and Deployment Options for Perl 5.12
PollPoll
AgendaAgenda
Perl, ActivePerl, and ActiveStateResilience and continued growth of PerlWhat's new in Perl 5.12Updating legacy codeDistributing and deploying applications
PerlPerl
Created by Larry Wall in 1987Perl 2 1988Perl 3 1989Perl 4 1991
Perl 5 released in 1995language syntax stabilizesall the major parts are therefirst “extensible” version (use Some::Module)
Continued incremental improvements through the 5.x seriesPerl 6 – beyond the scope of this presentation
is essentially a new languagenot ready yet, though Rakudo Star is getting closer
ActivePerlActivePerl
the first distribution of Perl for WindowsActiveState hired by Microsoft to improve Perl performance and features for WindowsGurusamy Sarathy (gsar), the Perl “Pumpking”enhancements for ActivePerl submitted upstream to core PerlActivePerl helps popularize Perl: 2 million downloads per yearadded some useful things:
PPM (Perl Package Manager)PerlScript and Perl for ISAPI extensions
CPAN is a 'one stop shop' for user-created modulesstandard toolchin for building, testing, and installing modulessearchablestandardized documentation formatbug trackingHUGE: 18,000 modules
PPM is ActivePerl's client for installing these modulescommand line and GUI interfacepre-compiled packages for specific platforms and Perl versionsdependencies handled automaticallyprovides most modules on CPAN (around 13,000)
& PPMPPM
The Resilience of PerlThe Resilience of Perl
“the duct tape of the internet” (but much more)unfashionable != unpopular|obsoletekey modules provide functionality outside the core
object oriented programming via Mooseweb frameworks: Catalyst, HTML::Mason et al.
mature language – changes are more incrementalthreading / fork() emulation in Perl 5.6Unicode support in Perl 5.8
PollPoll
Perl ReleasesPerl Releases
Perl releases used to be feature-based until 5.10
significant features in Perl 5.10:given/when statement, smartmatch operator ~~defined-or operator //recursive regexp patternsnamed regexp capture groups
Perl 5.12 and forward are time-basedno feature milestones to define the releaseonly features ready by release-time will be included
What's new in Perl 5.12What's new in Perl 5.12
lots of bug fixes not available elsewheremaintenance releases will only fix regressions, critical bugs (crashes) and security vulnerabilities
deprecation warnings enabled by default
various "little" features
package NAME VERSIONpackage NAME VERSION
This statement is parsed exactly the same way as “use PACKAGE VERSION”. For example:
package Foo::Bar 1.23;
... sets the module version right in the "package" statement at compile time, without having to assign to $VERSION at run-time
The “Yada Yada” operatorThe “Yada Yada” operator
For example
if ($condition) { ... }
...is the same as:
if ($condition) { die "unimplemented" }
marks unimplemented, placeholder codepseudo-code becomes compile-able, tests pass
Implicit stricturesImplicit strictures
An explicit request to require Perl 5.12 or later will automatically turn on "use strict"
For example: use 5.12.0;
implies: use strict; use feature ":5.12";
...and more......and more...
Unicode improvementsnow supports all Unicode propertiesuse feature "Unicode_strings";
Y2038 compliance even on 32-bit systems
new pragmataautodieoverloading
\N regex escape: opposite of \npluggable keywordsqr// overloading
Updating legacy codeUpdating legacy code
Blog comment spotted in the wild:
“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.”
Nik Silver
There's no book, but there are tools and documentation...
Try running it!Try running it!
Run the old code with with a newer interpreter – it may just work.The interpreter will warn about deprecated code
incremental approach: 5.6 to 5.8 to 5.10 to 5.12use warnings;less likely to “break” existing codesetting up each environment takes time and efforttempting to stay with a “less obsolete” version
“bite the bullet” approach: upgrading directly to 5.12address all the incompatibilities at onceopportunity to use new language featuresgreat excuse to write automated tests!
write tests for the old version first, then run them against 5.12
PollPoll
Consult perldeltaConsult perldelta
each perl release has a list of differences and incompatibilities with the previous version
http://perldoc.perl.org/index-history.htmlalso in the ActivePerl documentation
pay particular attention to the Incompatible Changes sectiondon'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)
you can skip development releases (5.7, 5.9, 5.11, etc.)
Check all modulesCheck all modules
binary modules are NOT compatible between major Perl versions (e.g. 5.8 to 5.10)update to the latest modules (unless that proves too hard)using PPM helps – installing vs. building plus installing saves timeCheck the module's Changes file and documentation
Use Perl::CriticUse Perl::Critic
Perl::Critic – a tool for examining your source codeuses Conway's “Perl Best Practices”points out bad or deprecated code and suggests alternatives
PDK has a helpful GUI interface
... or don't upgrade... or don't upgrade
choosing not to upgrade is viable if:your code is not business or mission-critical (i.e. nobody would care if it broke), oryou have commercial support for the older Perl version
ActivePerl Business Edition provides access to older builds of ActivePerl
ActivePerl Enterprise Edition can provide access and support for specific versions and platform builds
Deploying / DistributingDeploying / Distributing
Deploying or distributing code written in an interpreted language is different from deploying compiled binaries.
Traditionally, the target system requires:the source code of the applicationan interpreter compatible with the codeall required modules/libraries
Depending on the type of application, there are a few different approaches...
User/Customer supplies interpreterUser/Customer supplies interpreter
Linux, Mac OS X, and most UNIX-like operating systems have their own Perl interpreters, but:
may be the wrong version for your codesome required binary modules may not be available (as packages)
ActivePerl Community Edition is available for free, but:additional hassle for the customerWindows, Mac OS X, and Linux onlylatest releases of 5.12, 5.10, and 5.8 onlysupport is from the Perl comunity, not a vendor
ActivePerl Business Edition
Packaging the applicationPackaging the application
PDK deployment tools (PerlApp, PerlSvc, PerlCtrl et al.) package your perl code with:
an embedded perl interpreterall required modules / libraries
suitable for desktop applications and system servicesto the end user, it's just a native executable
no additional prerequisite software needed no additional cost or hassle for the end user
end users cannot easily modify the application
In-House Perl vs. ActivePerl OEMIn-House Perl vs. ActivePerl OEM
For enterprise-level or otherwise large scale “systems” software, distributing a real Perl interpreter may be preferable to packaging
integrators or customers may need access to the code (making changes on the fly)
may have a suite of related applications which use the same environment / modules
performance advantages
A “Roll your own” Perl distribution: lots of maintenance overhead in addition to your own code
harder to keep up-to-date
ActivePerl OEM: lets you distribute ActivePerl with your own software QA and support
indemnification
PollPoll
Founded 19972 million developers, 97% of Fortune 1000 rely on ActiveStateDevelopment, management, distribution solutions for dynamic languages Core languages: Perl, Python, TclOther: PHP, Ruby, Javascript
ActiveStateActiveState
ActiveState solutionsActiveState solutions
Get Perl Dev Kit 9 – on sale until Aug. 15th 1-user: $245 (save $50)5-pack: $995 (save $185)Upgrade from $95 (save ($50)
Get ActivePerl 5.12 Business Edition:Use code APBE200 to get $250 off until Aug. 30th
Speak to a representative about ActivePerl 5.12 Enterprise or OEM: 1-866-510-2914
[email protected] www.activestate.com