Perl .

      Léon Brocard


London Perl Workshop
Me


 Léon Brocard
 French, live in London
 Like food
 Like the colour orange
 Founded Amsterdam.pm, Bath.pm, Croydon.pm
 Now leader of London.pm
 Started YAPC::Europe
 perl hacker
Releases


      -   -   Perl
      -   -   Perl
      -   -   Perl
      -   -   Perl
      -   -   Perl
  ...
  Perl is years old
  Perl is years old
Perl releases

     -   -   Perl
     -   -   Perl   .
     -   -   Perl   .
     -   -   Perl   .
     -   -   Perl   .
     -   -   Perl   .
     -   -   Perl   .   .
     -   -   Perl   .   .
     -   -   Perl   .       .
     -   -   Perl   .       .
Perl .   New features
Perl .     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 operator
  use 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 // $b
  defined $a ? $a : $b

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


  Recursive patterns
  Named capture bu ers
  Possessive quanti ers
  Backtracking control verbs
  Relative backreferences
  Vertical 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 pragma
 perlglossary — Perl Glossary
 perlreguts — Regular expression engine internals
 perlreapi — Regular expression plugin interface
 perlunitut — Perl Unicode Tutorial
 perlunifaq — Perl Unicode FAQ
 perlcommunity — Overview of the Perl community
 CORE — Pseudo-namespace for Perl’s core routines
Performance enhancements

  In-place sorting
  Lexical array access
  XS-assisted SWASHGET
  Constant subroutines
  PERL_DONT_CREATE_GVSV
  Weak references are cheaper
  sort() enhancements
  Memory optimisations
  UTF- cache optimisation
  Sloppy stat on Windows
  Regular expressions optimisations
Deprecations



  Pseudo-hashes have been removed
  Removal of the bytecode compiler and of perlcc
  Removal of the JPL
Other

  Lexical $_, _ prototype, UNITCHECK blocks, mro pragma,
  readpipe() is now overridable, default argument for
  readline(), UNIVERSAL::DOES(), formats, byte-order
  modi ers for pack() and unpack(), no VERSION,
  chdir, chmod, chown on lehandles, OS groups, recursive
  sort subs, exceptions in constant folding, source lters in @INC,
  new internal variables, UCD . . , Miscellaneous Attribute
  Decoration, con guration improvements, compilation
  improvements, relocatable installations, nicer internals
  bison-based parser . . .
Perl . .




  Many bug xes: @_
  Optimised internals: isa()
New features, modules



  DTrace support
  autodie
  Compress::Raw::Bzip
  parent
  Parse::CPAN::Meta
Platform updates

  AIX
  Cygwin
  FreeBSD
  Irix
  Haiku
  MirOS BSD
  NetBSD
  Stratus VOS
  Symbian
  Win
  VMS
Feature tweaks



  given/when
  switch
  smart match
Deprecations




  Switch
  suidperl
Internal changes




  Moved from Perforce to Git
  Changed 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    .     ,     core tests
  (+     ,      more for bundled libraries)
  Perl    . .       ,    core tests
  (+        ,     more for bundled libraries)
  Perl    . .      ,    core tests
  (+        ,   more for bundled libraries)
Recent past and future


  Perl   .   .   : Léon Brocard on Nov ,
  Perl   .   .   : Jesse Vincent on Dec ,
  Perl   .   .   : Ricardo Signes on Jan ,
  Perl   .   .   : Steve Hay on Feb ,
  Perl   .   .   : Ask Bjørn Hansen on Mar   ,
  ...
  Perl   . : Jesse Vincent early
Use Perl .         now!



  Perl   .   is faster
  Perl   .   uses less memory
  Perl   .   has more features
  Perl   .   is backwards compatible

Perl 5.10

  • 1.
    Perl . Léon Brocard London Perl Workshop
  • 2.
    Me Léon Brocard French, live in London Like food Like the colour orange Founded Amsterdam.pm, Bath.pm, Croydon.pm Now leader of London.pm Started YAPC::Europe perl hacker
  • 3.
    Releases - - Perl - - Perl - - Perl - - Perl - - Perl ... Perl is years old Perl is years old
  • 4.
    Perl releases - - Perl - - Perl . - - Perl . - - Perl . - - Perl . - - Perl . - - Perl . . - - Perl . . - - Perl . . - - Perl . .
  • 5.
    Perl . New features
  • 6.
    Perl . New feature use feature ’say’; use feature ’state’; use feature ’switch’; ... use feature ’:5.10’;
  • 7.
    Say operator Just like print, but implicitly appends a newline use feature ’say’; say ’Hello!’;
  • 8.
    State operator Persistent private variables use feature ’state’; sub gimme_another { state $x; return ++$x }
  • 9.
    Smart match operator $a ~~ /foo/ @a ~~ /foo/ $a ~~ @b $a ~~ %b ...
  • 10.
    Switch and smartmatch operator use feature ’switch’; given ($foo) { when (/^abc/) { $abc = 1; } when (/^def/) { $def = 1; } when (/^xyz/) { $xyz = 1; } default { $nothing = 1; } }
  • 11.
    Switch and smartmatch operator use 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’; } }
  • 12.
    De ned-or operator $a // $b defined $a ? $a : $b $c //= $d; $c = $d unless defined $c;
  • 13.
    Regular expressions Recursive patterns Named capture bu ers Possessive quanti ers Backtracking control verbs Relative backreferences Vertical and horizontal whitespace, and linebreak
  • 14.
    Named capture buers 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}"; }
  • 15.
    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.
  • 16.
    New documentation perlpragma— How to write a user pragma perlglossary — Perl Glossary perlreguts — Regular expression engine internals perlreapi — Regular expression plugin interface perlunitut — Perl Unicode Tutorial perlunifaq — Perl Unicode FAQ perlcommunity — Overview of the Perl community CORE — Pseudo-namespace for Perl’s core routines
  • 17.
    Performance enhancements In-place sorting Lexical array access XS-assisted SWASHGET Constant subroutines PERL_DONT_CREATE_GVSV Weak references are cheaper sort() enhancements Memory optimisations UTF- cache optimisation Sloppy stat on Windows Regular expressions optimisations
  • 18.
    Deprecations Pseudo-hasheshave been removed Removal of the bytecode compiler and of perlcc Removal of the JPL
  • 19.
    Other Lexical$_, _ prototype, UNITCHECK blocks, mro pragma, readpipe() is now overridable, default argument for readline(), UNIVERSAL::DOES(), formats, byte-order modi ers for pack() and unpack(), no VERSION, chdir, chmod, chown on lehandles, OS groups, recursive sort subs, exceptions in constant folding, source lters in @INC, new internal variables, UCD . . , Miscellaneous Attribute Decoration, con guration improvements, compilation improvements, relocatable installations, nicer internals bison-based parser . . .
  • 20.
    Perl . . Many bug xes: @_ Optimised internals: isa()
  • 21.
    New features, modules DTrace support autodie Compress::Raw::Bzip parent Parse::CPAN::Meta
  • 22.
    Platform updates AIX Cygwin FreeBSD Irix Haiku MirOS BSD NetBSD Stratus VOS Symbian Win VMS
  • 23.
    Feature tweaks given/when switch smart match
  • 24.
  • 25.
    Internal changes Moved from Perforce to Git Changed directory structure
  • 26.
    Better quotes e J.R.R. Tolkien quotes at the head of each C source le have been checked and proper citations added
  • 27.
    More tests Perl . , core tests (+ , more for bundled libraries) Perl . . , core tests (+ , more for bundled libraries) Perl . . , core tests (+ , more for bundled libraries)
  • 28.
    Recent past andfuture Perl . . : Léon Brocard on Nov , Perl . . : Jesse Vincent on Dec , Perl . . : Ricardo Signes on Jan , Perl . . : Steve Hay on Feb , Perl . . : Ask Bjørn Hansen on Mar , ... Perl . : Jesse Vincent early
  • 29.
    Use Perl . now! Perl . is faster Perl . uses less memory Perl . has more features Perl . is backwards compatible