Modern Perl for the Unfrozen Paleolithic Perl Programmer

128
Modern Perl for the Unfrozen Paleolithic Perl Programmer John SJ Anderson Infinity Interactive @genehack OpenWest 2016 14 July 2016 Sandy UT

Transcript of Modern Perl for the Unfrozen Paleolithic Perl Programmer

Page 1: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Modern Perl for the Unfrozen Paleolithic Perl Programmer

John SJ Anderson ⭐ Infinity Interactive ⭐ @genehackOpenWest 2016 ⭐ 14 July 2016 ⭐ Sandy UT

Page 2: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Disclaimer

I'mma talk pretty fast. Feel free to ask questions particularly if I'm moving too quickly

Page 3: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Hi Hi I'm John

• VP Tech, Infinity Interactive • Ex-biologist • Linux • Perl tribe • Polyglot coder

• Just this guy, you know?

meet me!

Page 4: Modern Perl for the Unfrozen Paleolithic Perl Programmer

I'M JUST A CAVEMAN

YOUR MODERN PERL FRIGHTENS AND CONFUSES ME

I was inspired to write this talk by a few online friends who happen to be Perl programmers -- but they're not engaged with the community, they're just using Perl to get a job done, and there's a widening gulf between what I think is reasonable and what they're doing -- so I wanted to put together sort of an info dump to bring people up to speed. this talk is going to a wide-ranging survey of what's happened in Perl in the last 5-10 years.

Page 5: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Welcome to 2016!

So, hi, unfrozen Paleolithic Perl programmer! Welcome to 2016!

Page 6: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Quite a few things have changed...

Many things have changed since you fell into that glacier in 2001,

Page 7: Modern Perl for the Unfrozen Paleolithic Perl Programmer

...but many haven't

Page 8: Modern Perl for the Unfrozen Paleolithic Perl Programmer

There's a Clinton running for President!

Page 9: Modern Perl for the Unfrozen Paleolithic Perl Programmer

One thing is different: Perl6 was released!

but this talk is about perl5, so that's the last i'm going to talk about perl6

Page 10: Modern Perl for the Unfrozen Paleolithic Perl Programmer

We're still using Perl5!

Most of us are still happily coding in Perl5, however

Page 11: Modern Perl for the Unfrozen Paleolithic Perl Programmer

2001 Perl 5.6

When you slipped into that big hole in the ice, perl 5.6 was the latest and greatest

Page 12: Modern Perl for the Unfrozen Paleolithic Perl Programmer

2016 Perl 5.24

But we're all the way up to 5.24 now. So let's talk about that 15 year gap...

Page 13: Modern Perl for the Unfrozen Paleolithic Perl Programmer

We had some bad years

there was a rough patch

Page 14: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.6.0 - 22 Mar 2000 5.8.0 - 18 Jul 2002

5.10.0 - 18 Dec 2007 5.12.0 - 12 April 2010

here's the release dates for several perl versions, starting with 5.6 (latest and greatest in 2001, remember)

Page 15: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.6.0 - 22 Mar 2000 5.8.0 - 18 Jul 2002

5.10.0 - 18 Dec 2007 5.12.0 - 12 April 2010

see that five year gap there? yeah, those were not great times.

Page 16: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.6.0 - 22 Mar 2000 5.8.0 - 18 Jul 2002

5.10.0 - 18 Dec 2007 5.12.0 - 12 April 2010

but, starting with 5.10, which sort of brought perl 5 back to life, and then particularly, since 5.12, we've had this great thing! ...

Page 17: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Regular release cycle

a regular, predictable release cycle!

Page 18: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.12.0 - 12 April 2010 5.14.0 - 14 May 2011 5.16.0 - 20 May 2012 5.18.0 - 18 May 2013 5.20.0 - 27 May 2014 5.22.0 - 01 Jun 2015 5.24.0 - 09 May 2016

here are all the releases since 5.12. notice anything?

Page 19: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.12.0 - 12 April 2010 5.14.0 - 14 May 2011 5.16.0 - 20 May 2012 5.18.0 - 18 May 2013 5.20.0 - 27 May 2014 5.22.0 - 01 Jun 2015 5.24.0 - 09 May 2016

see those nice regular predictable releases, happening every year like clockwork? that's pretty cool.

underlying this is a regular series of dev releases (those are in odd numbered versions, e.g. 5.23 is the series of dev releases between 5.22 and 5.24), which happen on a monthly cycle

Page 20: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Perl5 pumpking

credit for starting and more importantly continuing this goes to a couple of p5 pumpkings, which is what we call the person who is in charge of the Perl5 effort -- our Benevolent Dictator for the Moment, if you will

Page 21: Modern Perl for the Unfrozen Paleolithic Perl Programmer

5.12.0 - 12 April 2010 5.14.0 - 14 May 2011 5.16.0 - 20 May 2012 5.18.0 - 18 May 2013 5.20.0 - 27 May 2014 5.22.0 - 01 Jun 2015 5.24.0 - 09 May 2016

Jesse

Rik

there were two pumpkings involved in this, Jesse Vincent for 5.12 and 5.14, and then Rik Signes for 5.16 thru 5.24 (which just came out a few months ago)

Page 22: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Regular release cycle

getting back onto a regular predictable release cycle has arguably been the single greatest factor keeping Perl5 relevant and catalyzing the Perl "Renaissance" you may be hearing about

Page 23: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ Jesse ❤ Rik

much respect to Jesse and Rik for the work involved in this, it was *not* a trivial undertaking to start or to keep going.

Page 24: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ Sawyer

this is also a good time to mention that Rik retired from the pumpking role after releasing 5.24.0, and our new pumpking is Sawyer. Sawyer is great and as you can see from this picture, he *really* loves hugs, so be sure to give him one when you see him at a conference.

Page 25: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Modern Perl

modernperlbooks.com

Another catalyst for the Perl Renaissance is the book "Modern Perl", written by chromatic. He has made this freely available online; you can also purchase a paper copy if that's how you roll.

Page 26: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ chromatic

modernperlbooks.com

Writing this book was a tremendous effort and it's an absolutely essential read if you want to understand what we call "Modern Perl", or how we do Perl in the 21st century.

Page 27: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Many language

improvements One of the main benefits of the regular release cycle has been a number of language improvements. I'm only going to talk about a few today, but you can always read the 'perldeltas', or change summaries that come out with each new release.

Page 28: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Unicode support!

In 2001, the world of Perl 5.6, Unicode existed but wasn't very well understood or very widely used. Today, of course, we live in a Unicode world, and it's something all programmers and languages have to deal with. It's kinda too complicated to get into here, so I'm just going to say that now we can get _really_ expressive in our Perl code

Page 29: Modern Perl for the Unfrozen Paleolithic Perl Programmer

$code = "😀";

So it's much easier to tell if we're happy...

Page 30: Modern Perl for the Unfrozen Paleolithic Perl Programmer

$code = "💩";

... or when things aren't going quite as well.

Page 31: Modern Perl for the Unfrozen Paleolithic Perl Programmer

This should be a familiar way of communication for you!

(okay, this is my last caveman joke...)

Perl unicode support got _ok_ in 5.12, and got good in 5.14.

Page 32: Modern Perl for the Unfrozen Paleolithic Perl Programmer

false values: 0, '', (), undef everything else is true

undefined values: undef everything else is defined

Quick Perl background

Before I can explain this next one, I need to do a brief refresher on a couple of aspects of Perl. Perl has the usual notion of true/false. These four values are false; everything else is true. 'undef' is a special value; it's what Perl gives to a newly declared but uninitialized variable. That means there's this additional dimension of defined/undefined we have to deal with

Page 33: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Boolean operators (or, and) look at truthiness.

Many times, only invalid value for something is undef. So can't look at truthiness; must look

at definedness

Quick Perl background

Now, Perl's Boolean operations *only* look at true/false. They don't care about defined/undefined at all, except for how undef is false.

But many times, you don't end up caring about true/false, you care about def/undef

Page 34: Modern Perl for the Unfrozen Paleolithic Perl Programmer

if(defined($this)){$value=$this}else{$value=$that}

So that leads to writing code that looks like this... *explain code*

Page 35: Modern Perl for the Unfrozen Paleolithic Perl Programmer

$value=defined($this)?$this:$that

The more idiomatic way of writing that code is to use the ternary operator -- this just does the same thing as the previous slide in a more compact way

Page 36: Modern Perl for the Unfrozen Paleolithic Perl Programmer

$value=$this//$that

defined-or

Now that I've given you that background, now I can explain this great new feature we got in 5.10, called 'defined-or'. It let's you write that code like so.

Which is pretty awesome. Defined-or was my favorite new perl feature of the 2000s

Page 37: Modern Perl for the Unfrozen Paleolithic Perl Programmer

$this//='default'#muchlikethis,but…$this||='default'

defined-or

You can also combine this with assignment, in much the same way you can say ||= for 'or equals'

Page 38: Modern Perl for the Unfrozen Paleolithic Perl Programmer

my$copy=$orig;$copy=~s/swap/stuff/;

Regular expressions are a big part of Perl programming, including substitution style regexps. If you want to apply a substitution to a variable but _not_ change your original value, you need to do something like this - make a copy, then do the sub on the copy

Page 39: Modern Perl for the Unfrozen Paleolithic Perl Programmer

(my$copy=$orig)=~s/swap/stuff/;

and this is just a more idiomatic way to do the same thing.

Page 40: Modern Perl for the Unfrozen Paleolithic Perl Programmer

(my$copy=$orig)=~s/swap/stuff/;

this makes the copy (and the parens are *required*)...

Page 41: Modern Perl for the Unfrozen Paleolithic Perl Programmer

(my$copy=$orig)=~s/swap/stuff/;

and then this applies the sub to the result of the left hand side, which means $copy gets changed and $orig is left unchanged

Page 42: Modern Perl for the Unfrozen Paleolithic Perl Programmer

my$copy=$orig=~s/swap/stuff/r;

non-destructive s///

new in 5.14, we have a new way do this. don't need the parens.

the key here is ...

Page 43: Modern Perl for the Unfrozen Paleolithic Perl Programmer

my$copy=$orig=~s/swap/stuff/r;

non-destructive s///

this 'r' modifier to the regexp, which makes

Page 44: Modern Perl for the Unfrozen Paleolithic Perl Programmer

my$copy=$orig=~s/swap/stuff/r;

non-destructive s///

this part return the result of applying the sub to $orig (hence, 'r' - for return)

Page 45: Modern Perl for the Unfrozen Paleolithic Perl Programmer

my$copy=$orig=~s/swap/stuff/r;

non-destructive s///

and then we just assign that to $copy.

Again, new as of 5.15

Page 46: Modern Perl for the Unfrozen Paleolithic Perl Programmer

dereferencing @{$arrayref}

so, if you've ever worked with references in perl, you've probably done this. a reference is how perl does data abstraction, it's kinda like a pointer (only way safer). this is how you turn a reference to an array back into the actual array

Page 47: Modern Perl for the Unfrozen Paleolithic Perl Programmer

postfix dereferencing $arrayref->@*

New syntax for this -- not really *less* punctuation, but different punctuation. I'm not a huge fan, but some people (including former pumpking Rik Signes) really like this.

We added postfix deref in 5.20; it became non-experimental in 5.24

Page 48: Modern Perl for the Unfrozen Paleolithic Perl Programmer

double diamond <<>>

We also got something called the 'double diamond' operator in 5.22

Page 49: Modern Perl for the Unfrozen Paleolithic Perl Programmer

diamond <>

This is related to the classic 'diamond' operator, which is used when processing files that are passed as arguments on the command line

Page 50: Modern Perl for the Unfrozen Paleolithic Perl Programmer

#loopoverfilesfromcommandlinewhile(<>){#dosomethingwitheachline}

#calllike'script.plfile1file2file3'

using the diamond operator typically looks like this, you'll have a script with this while loop, and then call it with a bunch of files on the command line. this will loop over the lines in file1, then file2, then file3, running the loop body for each one

Page 51: Modern Perl for the Unfrozen Paleolithic Perl Programmer

problem! <> uses 2-arg

open semantics! the problem with this is <> uses 2 argument open(). why is that bad?

Page 52: Modern Perl for the Unfrozen Paleolithic Perl Programmer

2-arg open open(IN,'<file');

this is what we call a 2 arg open call. we're opening a file, for reading, and attaching it to a file handle called IN

Page 53: Modern Perl for the Unfrozen Paleolithic Perl Programmer

2-arg open open(IN,'<file');

this thing right here, in front of the file name, is how you want to open the file. this is open for reading.

Page 54: Modern Perl for the Unfrozen Paleolithic Perl Programmer

2-arg open open(IN,'>file');

where as this is open for writing. (and if you wrote this code and called the file handle IN, we can't be friends.)

2 arg is bad, because if 'file' is actually in a variable, and somehow that variable gets a '>' or '<' or '|' in it, unexpected things happen

Page 55: Modern Perl for the Unfrozen Paleolithic Perl Programmer

3-arg open open($in,'<','file');

this is how we write that code these days, the three argument form. here the file name is just used literally, and if it gets one of those punctuation chars in it, you'll get an error rather than a bad surprise

Page 56: Modern Perl for the Unfrozen Paleolithic Perl Programmer

problem! <> uses 2-arg

open semantics! so, the problem is <> uses the 2-arg form...

Page 57: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Means that this:

script.pl'>file1'

is gonna be a bad time

So doing something like this will open 'file1' for writing, clobbering whatever is there.

Page 58: Modern Perl for the Unfrozen Paleolithic Perl Programmer

WHOOPS.

Page 59: Modern Perl for the Unfrozen Paleolithic Perl Programmer

<<>> fixes this.

again, available as of 5.22

Page 60: Modern Perl for the Unfrozen Paleolithic Perl Programmer

subroutine signatures

Finally, and I think this is maybe _the_ biggest feature this decade, we've also recently gotten support for subroutine signatures in 5.20

Page 61: Modern Perl for the Unfrozen Paleolithic Perl Programmer

subadd{my($one,$two)=@_;return$one+$two;}

this is how you might write a simple perl function to add together two numbers. the @_ is a special variable that's used to pass in the arguments for the function.

Page 62: Modern Perl for the Unfrozen Paleolithic Perl Programmer

subadd{my($one,$two)=@_;return$one+$two;}

This bit in the first line is called "unpacking @_", and code like this is at the top of literally almost every Perl function *EVER*

Page 63: Modern Perl for the Unfrozen Paleolithic Perl Programmer

subadd($one,$two){return$one+$two;}

this code does the exact same thing!

Page 64: Modern Perl for the Unfrozen Paleolithic Perl Programmer

subadd($one,$two){return$one+$two;}

so we don't even have to unpack @_ ourselves! you can even provide default values, validate arguments in the function signature, and all sorts of crazy stuff

Who has started using subroutine signatures? They're still experimental, but hopefully will be non-experimental in 5.26

Page 65: Modern Perl for the Unfrozen Paleolithic Perl Programmer

new toolsIt's not just language level features, we also have a host of new tools to make it easier to work with Perl

Page 66: Modern Perl for the Unfrozen Paleolithic Perl Programmer

"system" perl:

These days, we make a distinction between the Perl that comes with your OS

Page 67: Modern Perl for the Unfrozen Paleolithic Perl Programmer

"system" perl: just say no

and encourage people not to use it for their development projects

Page 68: Modern Perl for the Unfrozen Paleolithic Perl Programmer

/usr/bin/perl

Yes, that means good old /usr/bin/perl...

Page 69: Modern Perl for the Unfrozen Paleolithic Perl Programmer

/usr/bin/perl

is no more. Instead, we use tools to install new Perls, outside the control of the OS

Page 70: Modern Perl for the Unfrozen Paleolithic Perl Programmer

perlbrew

The first tool that was developed for this purpose is called Perlbrew

Page 71: Modern Perl for the Unfrozen Paleolithic Perl Programmer

perlbrew.pl

which you can get at perlbrew.pl

Page 72: Modern Perl for the Unfrozen Paleolithic Perl Programmer

plenv

there's also a newer option, plenv

Page 73: Modern Perl for the Unfrozen Paleolithic Perl Programmer

https://github.com/tokuhirom/plenv

its website isn't quite as snazzy as perlbrew's

Page 74: Modern Perl for the Unfrozen Paleolithic Perl Programmer

advantages• Solves "vendor Perl lockin" issues

• Install multiple Perls in your home directory

• ... or elsewhere

• Trivially switch from Perl version to Perl version

• Able to install modules without special permissions

• Easy to stay up to date with Perl development

either one of these tools will give you numerous advantages over using the system perl

Page 75: Modern Perl for the Unfrozen Paleolithic Perl Programmer

plenv > perlbrew• Less magic messing around with $PATH

• Can "pin" Perl different ways: globally, per-shell, or per-directory

personally, i'm using plenv these days -- the ability to easily specify a Perl version for a particular project is particularly useful to me

Page 76: Modern Perl for the Unfrozen Paleolithic Perl Programmer

perlbrew > plenv• Kicka** website

Page 77: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of installing...

we also have a few new tools that make installing and managing modules easier

Page 78: Modern Perl for the Unfrozen Paleolithic Perl Programmer

local::lib

one of them is a module called local::lib

Page 79: Modern Perl for the Unfrozen Paleolithic Perl Programmer

local::lib• Install your own copies of modules

• In your $HOME (so no special permissions needed)

• Can also install per-project modules

• Integrates well with other tools

• Not going to go into how to make it work, but the docs are great!

Page 80: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ mst

originally developed by matt trout, so thanks matt

Page 81: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of installation tools…

Page 82: Modern Perl for the Unfrozen Paleolithic Perl Programmer

cpanminus a/k/a cpanm

We've got a new CPAN client these days, cpanminus

Page 83: Modern Perl for the Unfrozen Paleolithic Perl Programmer

%cpanGit::WrapperCPAN:Storableloadedok(v2.54)Reading'/Users/genehack/.cpan/Metadata'DatabasewasgeneratedonSat,10Oct201501:17:02GMTRunninginstallformodule'Git::Wrapper'CPAN:LWP::UserAgentloadedok(v6.13)FetchingwithLWP:http://cpan.schatt.com/authors/id/G/GE/GENEHACK/Git-Wrapper-0.045.tar.gzCPAN:YAMLloadedok(v1.15)CPAN:Digest::SHAloadedok(v5.95)FetchingwithLWP:http://cpan.schatt.com/authors/id/G/GE/GENEHACK/CHECKSUMSCPAN:Compress::Zlibloadedok(v2.068)Checksumfor/Users/genehack/.cpan/sources/authors/id/G/GE/GENEHACK/Git-Wrapper-0.045.tar.gzoktmp-47326fortmp-47326:Nosuchfileordirectoryat/opt/plenv/versions/5.23.2/lib/perl5/5.23.2/CPAN/Distribution.pmline468.CPAN:File::Temploadedok(v0.2304)CPAN:CPAN::Meta::Requirementsloadedok(v2.133)CPAN:Parse::CPAN::Metaloadedok(v1.4417)CPAN:CPAN::Metaloadedok(v2.150005)CPAN:Module::CoreListloadedok(v5.20150820)ConfiguringG/GE/GENEHACK/Git-Wrapper-0.045.tar.gzwithMakefile.PLLocatingbin:git...foundat/opt/git/bin/git.Checkingifyourkitiscomplete...LooksgoodGeneratingaUnix-styleMakefileWritingMakefileforGit::WrapperWritingMYMETA.ymlandMYMETA.json

this is the output from using the default 'cpan' client to install something.

Page 84: Modern Perl for the Unfrozen Paleolithic Perl Programmer

GENEHACK/Git-Wrapper-0.045.tar.gz[17/1516]/opt/plenv/versions/5.23.2/bin/perl5.23.2Makefile.PL--OKRunningmakeforG/GE/GENEHACK/Git-Wrapper-0.045.tar.gzcplib/Git/Wrapper/File/RawModification.pmblib/lib/Git/Wrapper/File/RawModification.pmcplib/Git/Wrapper.pmblib/lib/Git/Wrapper.pmcplib/Git/Wrapper/Statuses.pmblib/lib/Git/Wrapper/Statuses.pmcplib/Git/Wrapper/Exception.pmblib/lib/Git/Wrapper/Exception.pmcplib/Git/Wrapper/Log.pmblib/lib/Git/Wrapper/Log.pmcplib/Git/Wrapper/Status.pmblib/lib/Git/Wrapper/Status.pmManifying6poddocumentsGENEHACK/Git-Wrapper-0.045.tar.gz/usr/bin/make--OKRunningmaketestPERL_DL_NONLAZY=1"/opt/plenv/versions/5.23.2/bin/perl5.23.2""-MExtUtils::Command::MM""-MTest::Harness""-e""undef*Test::Harness::Switches;test_harness(0,'blib/lib','blib/arch')"t/*.tt/00-load.t...............1/6#TestingGit::Wrapper0.045t/00-load.t...............okt/author-err.t............skipped:thesetestsarefortestingbytheauthort/basic.t.................#Testinggitversion:2.5.2t/basic.t.................okt/git_binary.t............okt/parse_args.t............okt/path_class.t............#Testinggitversion:2.5.2t/path_class.t............okt/release-pod-coverage.t..skipped:thesetestsareforreleasecandidatetestingt/release-pod-syntax.t....skipped:thesetestsareforreleasecandidatetestingAlltestssuccessful.Files=8,Tests=67,1wallclocksecs(0.04usr0.02sys+0.39cusr0.31csys=0.76CPU)Result:PASSGENEHACK/Git-Wrapper-0.045.tar.gz

and this is more of the output...

Page 85: Modern Perl for the Unfrozen Paleolithic Perl Programmer

(still not done but I got tired of pasting.)

Page 86: Modern Perl for the Unfrozen Paleolithic Perl Programmer

%cpanmGit::Wrapper-->WorkingonGit::WrapperFetchinghttp://www.cpan.org/authors/id/G/GE/GENEHACK/Git-Wrapper-0.045.tar.gz...OKConfiguringGit-Wrapper-0.045...OKBuildingandtestingGit-Wrapper-0.045...OKSuccessfullyinstalledGit-Wrapper-0.045

this is the output from cpanm installing the same thing

Page 87: Modern Perl for the Unfrozen Paleolithic Perl Programmer

%cpanmGit::Wrapper-->WorkingonGit::WrapperFetchinghttp://www.cpan.org/authors/id/G/GE/GENEHACK/Git-Wrapper-0.045.tar.gz...OKConfiguringGit-Wrapper-0.045...OKBuildingandtestingGit-Wrapper-0.045...OKSuccessfullyinstalledGit-Wrapper-0.045

this is the output from cpanm installing the same thing

Page 88: Modern Perl for the Unfrozen Paleolithic Perl Programmer

cpanminus a/k/a cpanm

Page 89: Modern Perl for the Unfrozen Paleolithic Perl Programmer

carton

Another tool, carton, helps manage your module dependencies in a project. Particularly useful for large projects with multiple devs

Page 90: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Like bundler but for Perl

it's like ruby's bundler, but for perl modules

Page 91: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Freeze deps,so you always install same

versions across dev/staging/prod

Page 92: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ Miyagawa

both cpanm and carton were developed by Miyagawa; many thanks to him!

Page 93: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of stuff on CPAN…

so, CPAN...

Page 94: Modern Perl for the Unfrozen Paleolithic Perl Programmer

metacpan.org

we have a whole new website for interacting with CPAN

Page 95: Modern Perl for the Unfrozen Paleolithic Perl Programmer

search.cpan.org

search.cpan.org is still around...

Page 96: Modern Perl for the Unfrozen Paleolithic Perl Programmer

but metacpan integrates and visualizes a bunch of information in a really useful way

Page 97: Modern Perl for the Unfrozen Paleolithic Perl Programmer

things like a syntax-highlighted source view, linking to home pages and code repos, showing test results, and the amount of activity in a project

Page 98: Modern Perl for the Unfrozen Paleolithic Perl Programmer

https://github.com/CPAN-API/metacpan-web

it's also open source, so if you can think of a way to make it better, you can

Page 99: Modern Perl for the Unfrozen Paleolithic Perl Programmer

❤ MetaCPAN team

thanks to the whole metacpan team for all their hard work

Page 100: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Duck Duck Go

we also have a new search engine here in 2016. it's cool, and it's partially written in Perl

Page 101: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Duck Duck Go !cpanm

The most useful feature, though, is ability to use 'bang searches' to restrict your search to a particular site - this is how you search metacpan

Page 102: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of modules...

if you haven't been playing close attention to perl community goings on, there are a few new modules you may have missed

Page 103: Modern Perl for the Unfrozen Paleolithic Perl Programmer

JSON::MaybeXS

anybody doing web development these days needs to interact with JSON - using JSON::MaybeXS will make sure that you have a JSON library available, picking the best one from a number of alternatives

Page 104: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Cpanel::JSON::XS JSON::XS JSON::PP

here's how the fallback works -- and if you install JSON::MaybeXS and don't have any of these installed, it will require Cpanel::JSON::XS (as long as you have a compiler to build the XS)

Page 105: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Moose Moo

To get a handle on how we do OOP in Perl these days, you should look into Moose -- and then when you're ready to write some code, you'll probably be able to get away with dropping down to Moo

Page 106: Modern Perl for the Unfrozen Paleolithic Perl Programmer

CGI.pm is

gone

I do have some bad news for you -- CGI.pm has been pulled out of core

Page 107: Modern Perl for the Unfrozen Paleolithic Perl Programmer

(not really)

don't worry, you can still find it on CPAN

Page 108: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Plack

But the current standard for web development in Perl is Plack/PSGI. Offers a number of advantages over CGI, and is the basis for all modern Perl web frameworks

Page 109: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of Perl websites…

we have quite a few new websites these days, which make it easier to keep up with the current state of things

Page 110: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://cpanratings.perl.org/

one of the problems with cpan is there's just _so_ _much_ _stuff_ there. it can be hard to decide which one of a dozen different modules to use. cpanratings helps with this problem

Page 111: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://cpanratings.perl.org/

you can see individual reviews, which version they're reviewing, and so on. one downside - because ratings are about a particular version, may not reflect current module state

Page 112: Modern Perl for the Unfrozen Paleolithic Perl Programmer

https://metacpan.org/

MetaCPAN links to reviews as well as showing an average review score

Page 113: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://cpants.cpanauthors.org/

we also have CPANTS - automated testing of some best practices around module development

Page 114: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://cpants.cpanauthors.org/

here's what that looks like for a particular module. super useful if you're not sure you're doing things the "right" way

Page 115: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://cpants.cpanauthors.org/author/GENEHACK

can also see modules by author, which can be useful when trying to decide whether to use somebody's code

Page 116: Modern Perl for the Unfrozen Paleolithic Perl Programmer

https://metacpan.org/

MetaCPAN links to CPANTS too

Page 117: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://prepan.org/

We also have PrePAN, which is a place to get feedback on module ideas you haven't even written yet

Page 118: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Perl 5 Porters mailing list summaries!

In a recent development, sawyer has revived the p5p weekly email summary -- excellent if you want to keep up with what's going on with perl5 development but don't have time to follow the email list yourself

Page 119: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://blogs.perl.org/users/sawyer_x/

and in a recent development, sawyer has revived the p5p weekly email summary -- excellent if you want to keep up with what's going on with perl5 development but don't have time to follow the email list yourself

Page 120: Modern Perl for the Unfrozen Paleolithic Perl Programmer

speaking of Perl community…

finally, you really should consider becoming more actively involved with the perl community, if you're working with (or even just playing with) perl

Page 121: Modern Perl for the Unfrozen Paleolithic Perl Programmer

irc.perl.org

irc.perl.org had a *bit* of a bad reputation </understatement> but things have been cleaned up a bunch. there's a documented standards of conduct, abuse is not tolerated, and it's a good place to get help from experienced perl folk

Page 122: Modern Perl for the Unfrozen Paleolithic Perl Programmer

Conferences & Workshops& Mongers

(oh my.)

big conferences: YAPC, once a year (or so), in North America, Europe, Asia. Sometimes Brazil, Russia too

workshops: smaller, regional. Pittsburgh, DC-Baltimore, Orlando

perl mongers groups: like MasterCard, we *errywhere* you want to be

Page 123: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://www.pm.org/groups/north_america.html

finally, you really should consider becoming more actively involved with the perl community, if you're working with (or even just playing with) perl, there's probably a local perl mongers group near you

Page 124: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://saltlake.pm.org/

here's the SLC one!

Page 125: Modern Perl for the Unfrozen Paleolithic Perl Programmer

http://perlweekly.com/

finally, let me give a big shout out to perl weekly, which is a once a week email newsletter and website aggregating perl related news from all over the web

if you're only going to pay attention to one perl thing, perl weekly is your best choice! sign up at perlweekly.com

Page 126: Modern Perl for the Unfrozen Paleolithic Perl Programmer

thanks!

thanks to the organizers for accepting my talk, thanks to all of you for attending and participating ...

Page 127: Modern Perl for the Unfrozen Paleolithic Perl Programmer

thanks to my employer for giving me the time to write this talk and sending me here to deliver it

Page 128: Modern Perl for the Unfrozen Paleolithic Perl Programmer

questions?

https://joind.in/event/openwest-2016/modern-perl-for-the-unfrozen-paleolithic-perl-programmer

http://tinyurl.com/unfrozen-perl

any questions? (mention feedback link)