Date post: | 10-May-2015 |
Category: |
Technology |
Upload: | acme |
View: | 2,474 times |
Download: | 0 times |
Perl 5.10
Léon Brocard
London Perl Workshop 2009
Me
Léon BrocardFrench, live in LondonLike foodLike the colour orangeFounded Amsterdam.pm, Bath.pm, Croydon.pmNow leader of London.pmStarted YAPC::Europeperl hacker
Releases
1987-12-18 Perl 11988-06-05 Perl 21989-10-18 Perl 31991-03-21 Perl 41994-10-17 Perl 5. . .Perl is 22 years oldPerl 5 is 16 years old
Perl 5 releases
1994-10-17 Perl 51995-03-13 Perl 5.0011996-02-29 Perl 5.0021996-06-25 Perl 5.0031997-04-15 Perl 5.0041998-07-22 Perl 5.0052000-03-22 Perl 5.6.02002-07-18 Perl 5.8.02007-12-18 Perl 5.10.02009-08-22 Perl 5.10.1
Perl 5.10 New features
Perl 5.10 New feature
use feature ’say’;use feature ’state’;use feature ’switch’;...use feature ’:5.10’;
Say operator
Just like print, but implicitly appends a newline
use feature ’say’;say ’Hello!’;
State operator
Persistent private variables
use feature ’state’;sub gimme_another { state $x; return ++$x }
Smart match operator
$a ~~ /foo/@a ~~ /foo/$a ~~ @b$a ~~ %b...
Switch and smart match operator
use feature ’switch’;given ($foo) {when (/^abc/) { $abc = 1; }when (/^def/) { $def = 1; }when (/^xyz/) { $xyz = 1; }default { $nothing = 1; }
}
Switch and smart match operatoruse feature ":5.10";given($foo) {when (undef) { say ’$foo is undefined’; }when ("foo") {
say ’$foo is the string "foo"’;}when ([1,3,5,7,9]) {
say ’$foo is an odd digit’;continue; # Fall through
}when ($_ < 100) { say ’< 100’; }when (\&complicated_check) {
say ’a complicated check for $foo is true’;}default { die ’Eeeeek’; }
}
De�ned-or operator
$a // $bdefined $a ? $a : $b
$c //= $d;$c = $d unless defined $c;
Regular expressions
Recursive patternsNamed capture bu�ersPossessive quanti�ersBacktracking control verbsRelative backreferencesVertical and horizontal whitespace, and linebreak
Named capture bu�ers
use feature ’say’;my $time = ’Time: 01:02:03’;
if ($time =~ /Time:\s(\d+):(\d+):(\d+)/) {say "$1 / $2 / $3";
}
if ($time =~ /Time:\s(?<hours>\d+):(?<minutes>\d+):(?<seconds>\d+)/x) {say "$+{hours} / $+{minutes} / $+{seconds}";
}
New modules
Archive::Extract, Archive::Tar,Compress::Zlib, CPANPLUS, Digest::SHA,encoding::warnings, ExtUtils::CBuilder,ExtUtils::ParseXS, File::Fetch,Hash::Util::FieldHash, IO::Zlib, IPC::Cmd,Locale::Maketext::Simple, Log::Message,Log::Message::Simple, Math::BigInt::FastCalc,Module::Build, Module::CoreList, Module::Load,Module::Load::Conditional, Module::Loaded,Module::Pluggable, Object::Accessor,Package::Constants, Params::Check,Pod::Escapes, Pod::Simple, Term::UI,Time::Piece, Win32API::File.
New documentation
perlpragma — How to write a user pragmaperlglossary — Perl Glossaryperlreguts — Regular expression engine internalsperlreapi — Regular expression plugin interfaceperlunitut — Perl Unicode Tutorialperlunifaq — Perl Unicode FAQperlcommunity — Overview of the Perl communityCORE— Pseudo-namespace for Perl’s core routines
Performance enhancements
In-place sortingLexical array accessXS-assisted SWASHGETConstant subroutinesPERL_DONT_CREATE_GVSVWeak references are cheapersort() enhancementsMemory optimisationsUTF-8 cache optimisationSloppy stat on WindowsRegular expressions optimisations
Deprecations
Pseudo-hashes have been removedRemoval of the bytecode compiler and of perlccRemoval of the JPL
Other
Lexical $_, _ prototype, UNITCHECK blocks, mro pragma,readpipe() is now overridable, default argument forreadline(), UNIVERSAL::DOES(), formats, byte-ordermodi�ers for pack() and unpack(), no VERSION,chdir, chmod, chown on �lehandles, OS groups, recursivesort subs, exceptions in constant folding, source �lters in @INC,new internal variables, UCD 5.0.0, Miscellaneous AttributeDecoration, con�guration improvements, compilationimprovements, relocatable installations, nicer internalsbison-based parser . . .
Perl 5.10.1
Many bug �xes: @_Optimised internals: isa()
New features, modules
DTrace supportautodieCompress::Raw::Bzip2parentParse::CPAN::Meta
Platform updates
AIXCygwinFreeBSDIrixHaikuMirOS BSDNetBSDStratus VOSSymbianWin32VMS
Feature tweaks
given/whenswitchsmart match
Deprecations
Switchsuidperl
Internal changes
Moved from Perforce to GitChanged directory structure
Better quotes
�e J.R.R. Tolkien quotes at the head of each C source�le have been checked and proper citations added
More tests
Perl 5.8 26,725 core tests(+ 41,666 more for bundled libraries)Perl 5.10.0 78,883 core tests(+ 109,427 more for bundled libraries)Perl 5.10.1 92,697 core tests(+ 142,101 more for bundled libraries)
Recent past and future
Perl 5.11.2: Léon Brocard on Nov 20, 2009Perl 5.11.3: Jesse Vincent on Dec 20, 2009Perl 5.11.4: Ricardo Signes on Jan 20, 2010Perl 5.11.5: Steve Hay on Feb 20, 2010Perl 5.11.6: Ask Bjørn Hansen on Mar 20, 2010. . .Perl 5.12: Jesse Vincent early 2010
Use Perl 5.10 now!
Perl 5.10 is fasterPerl 5.10 uses less memoryPerl 5.10 has more featuresPerl 5.10 is backwards compatible