+ All Categories
Home > Technology > Perl 5.10

Perl 5.10

Date post: 10-May-2015
Category:
Upload: acme
View: 2,474 times
Download: 0 times
Share this document with a friend
Description:
My talk on Perl 5.10 at the London Perl Workshop 2009.
Popular Tags:
29
Perl . Léon Brocard London Perl Workshop
Transcript
Page 1: Perl 5.10

Perl 5.10

Léon Brocard

London Perl Workshop 2009

Page 2: Perl 5.10

Me

Léon BrocardFrench, live in LondonLike foodLike the colour orangeFounded Amsterdam.pm, Bath.pm, Croydon.pmNow leader of London.pmStarted YAPC::Europeperl hacker

Page 3: Perl 5.10

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

Page 4: Perl 5.10

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

Page 5: Perl 5.10

Perl 5.10 New features

Page 6: Perl 5.10

Perl 5.10 New feature

use feature ’say’;use feature ’state’;use feature ’switch’;...use feature ’:5.10’;

Page 7: Perl 5.10

Say operator

Just like print, but implicitly appends a newline

use feature ’say’;say ’Hello!’;

Page 8: Perl 5.10

State operator

Persistent private variables

use feature ’state’;sub gimme_another { state $x; return ++$x }

Page 9: Perl 5.10

Smart match operator

$a ~~ /foo/@a ~~ /foo/$a ~~ @b$a ~~ %b...

Page 10: Perl 5.10

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; }

}

Page 11: Perl 5.10

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’; }

}

Page 12: Perl 5.10

De�ned-or operator

$a // $bdefined $a ? $a : $b

$c //= $d;$c = $d unless defined $c;

Page 13: Perl 5.10

Regular expressions

Recursive patternsNamed capture bu�ersPossessive quanti�ersBacktracking control verbsRelative backreferencesVertical and horizontal whitespace, and linebreak

Page 14: Perl 5.10

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}";

}

Page 15: Perl 5.10

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.

Page 16: Perl 5.10

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

Page 17: Perl 5.10

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

Page 18: Perl 5.10

Deprecations

Pseudo-hashes have been removedRemoval of the bytecode compiler and of perlccRemoval of the JPL

Page 19: Perl 5.10

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 . . .

Page 20: Perl 5.10

Perl 5.10.1

Many bug �xes: @_Optimised internals: isa()

Page 21: Perl 5.10

New features, modules

DTrace supportautodieCompress::Raw::Bzip2parentParse::CPAN::Meta

Page 22: Perl 5.10

Platform updates

AIXCygwinFreeBSDIrixHaikuMirOS BSDNetBSDStratus VOSSymbianWin32VMS

Page 23: Perl 5.10

Feature tweaks

given/whenswitchsmart match

Page 24: Perl 5.10

Deprecations

Switchsuidperl

Page 25: Perl 5.10

Internal changes

Moved from Perforce to GitChanged directory structure

Page 26: Perl 5.10

Better quotes

�e J.R.R. Tolkien quotes at the head of each C source�le have been checked and proper citations added

Page 27: Perl 5.10

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)

Page 28: Perl 5.10

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

Page 29: Perl 5.10

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


Recommended