Resources for getting started on "modern" Perl
Asked Answered
K

5

19

After having heard about new parts of the Perl ecosystem, such as Moose, DeclareX, and Catalyst, I thought that it'd be nice to take a look at Perl. Unfortunately, all of the introductory material I can find targets Perl 5.8 or 5.6, and knows nothing about these newer frameworks—let alone features introduced in recent Perl versions, such as the ~~ operator. What resources are available for someone interested in coming to Perl fresh, and wanting to learn the current best-practice way to do things right from the get-go?

While I can read the 3rd edition of the camel book, then work the rest of my way through piles of CPAN documentation and the like, I'd tremendously appreciate a tutorial that doesn't force me to learn a bunch of deprecated ways to do things, just to turn around and unlearn them again when I read a reference manual. Real-world code that's well-documented and uses some of these newer corners of Perl would also be wonderful.

Kalynkam answered 18/11, 2009 at 20:42 Comment(5)
It would be awesome if someone took on the project of writing a "Post-Modern Perl Programming" book which covered Moose, perhaps to coincide with the release of 1.0?Lambda
"They" (whoever they are) might be waiting for a production release of Perl 6 to produce more modern docs. I agree that it would be nice to have a good introduction based on current versions of Perl 5, considering how long it's been out and how much it's been upgraded.Pettiford
Even if Perl 6 shipped tomorrow, part of the attraction for me in looking at Perl again is that it--and by "it", I mean "Perl 5"--is installed absolutely everywhere. Perl 6 won't be for a long time after its release. For that reason, if none other, having up-to-date Perl 5 documentation strikes me as a worthwhile endeavor.Kalynkam
Agreed, perl5 has a lot of life left in it, even if perl6 came out today (and we're still a long time away from its release from what I hear).Lambda
With respect to the smart match operator ~~ be sure to read about the changes in its behavior in perl 5.10.1: search.cpan.org/~dapm/perl-5.10.1/pod/….Ironware
E
19

chromatic is in the process of writing a Modern Perl book which is available for preview in his Github account. The recent Catalyst book by Kieren Diment and Matt Trout covers several modern perl practices and the current "Enlightened Stack" as Matt I believe calls it.

There is also work going on for a Moose book, but I doubt it will be available before next summer even if the authors were able to focus on it full time. For learning Best Practices, as long as you take it with a huge grain of salt the discussion in Damian's Perl Best Practices is worth reading. I wouldn't recommend his practices are best, but they illuminate where the conversation points are and you can google around for people's comments on it. The biggest problem I personally had was the OO suggestions it had, and it led me to find Moose which I adore.

Finally, interact with the community. Join a mailing list or three, an irc channel or two, and blog regularly about what you're learning. The Perl community is generally supportive of helping people who really are interested in learning find the tools they need.

Econah answered 18/11, 2009 at 22:55 Comment(3)
For some reason, clicking on the github link gives a "File Not Found" page even though the URL seems to be correct.Overactive
Yeah, Stack Overflow's Markdown engine is mangling the URL. I tried to fix it, but it's still getting mangled. The URL, for anyone else out there, is github.com/chromatic/modern_perl_bookKalynkam
On the topic of modern Perl blogs, the Ironman Blogging Competition (ironman.enlightenedperl.org), held by the Enlightened Perl Organisation is an excellent way to find blogs that deal with the post-modern aspects of Perl and highlights modules and techniques that aren't (yet) in any books.Belcher
O
12

Learning Perl, 5th Edition is current up to 5.10. There's even a chapter for the smart match operator, just like you want, in addition to the other new features that a beginner will want. If you want to start learning Perl, that's the book to use. Once you get through it, move onto whatever else you want to do. I'll have Effective Perl Programming, 2nd Edition out around the start of spring too. That will be current up to 5.10.1 (and maybe a little farther since we use at least one 5.12 feature in some code).

You really don't want a book on Catalyst or Moose. Anything you read will be out of date because those projects have a high velocity and the practices change pretty quickly. You're going to need to learn the basics before you dive into the advanced topics, anyway.

To continue as a programmer, you're going to have to get used to not depending on books. I can't write them as fast as stuff changes, so you have to learn from the documentation too. That's just how life is.

Offing answered 19/11, 2009 at 1:24 Comment(3)
I've had enough experience programming that I appreciate your comment about books being immediately out-of-date, but that cuts both ways: if the book's immediately out-of-date, then so's the code I wrote last year, and that can get incredibly frustrating in and of itself. It's nevertheless useful to know that these frameworks are so much in flux that anything I learn is likely to be immediately invalidated.Kalynkam
Well, your code is only out of date if you hitched your wagon to the latest fad. Stop chasing the fads. :) If you stick around long enough you'll see that if you put off some hot topics for a year or so, you save yourself a lot of work when people change to the latest cool thing. For what it's worth, most of "modern Perl" works with any Perl within the last five years.Offing
In defense of Catalyst, the project actually tries really hard not to break running code. Quite a few apps written as far back as Catalyst 5.3 still run on 5.8, or run with the smallest of modifications. Best practices change, but the fundamentals don't. The latest book is also very forward-looking. All that said, you don't need a Catalyst book. Worry about learning Perl instead. Read any book from 2001 or later, read perldocs, read code, talk to people online!Capel
G
4

There was an excellent talk at OSCON by Paul Fenwick on "Awesome Things You've Missed in Perl" where he gives several code examples and usage tips for using Modern Perl.

The talk was recorded, but it's not on the list of recordings yet: http://www.oscon.com/oscon2010/public/schedule/proceedings

Here are some other great talks worth checking out that also provide examples of Modern Perl:

And finally (not from OSCON):

Larry Wall speaking at Google

Guide answered 26/7, 2010 at 23:12 Comment(1)
+1 Thanks, I did not know OSCON was providing video and PDFs.Ironware
R
3

Even if this answer is very late, a new book about Modern Perl has came out on 2012. It's called Beginning Perl and is written by Curtis 'Ovid' Poe. It focuses on learning the Perl skills employers are looking for and is for both programming beginners or for experimented programmers who want to learn a new language.

After introducing the language itself, Ovid continue on DBIx::Class, Moose, Catalyst, and more CPAN tools and community's best practices with a lot of real-world examples, demonstrating how you actually use Perl in the workplace, for web development, data processing or system administration. The book was first available for free on the O'Reilly website, but has been removed now (you have to pay for a printed or electronic version).

Hope it will be useful for future readers of this QA.

Rabelaisian answered 20/8, 2013 at 17:46 Comment(1)
Thank you for the plug :) One thing to keep in mind is that while I subtly introduce a lot of "Modern Perl", the book is still, as you point out, very much focused on the actual workplace. More and more Perl shops are asking for Modern Perl skills, but large numbers of shops still rely on legacy Perl (source: my wife and I also do IT recruiting).Calcific
I
2

I would recommend the mentioned Learning Perl 5th Edition followed by Damian Conway's Perl Best Practices (also previously mentioned).

I would like also point you to the PBP Module Recommendation Commentary that discusses the current "community view" of the modules discussed in Perl Best Practices.

Despite what is discussed (or not) at this site, two of my favorite Perl Best Practice recommendations are Data::Alias and Smart::Comments (Even though Smart::Comments is a source filter, you can easily remove it before sending your code to production. It is great for debugging.).

Ironware answered 20/11, 2009 at 23:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.