tags:

views:

459

answers:

6

I have not done Perl for about 8 years and now I'm going into project that's heavily utilizing object-oriented Perl so I need to resharpen my Perl skills and do it quickly. During these past years I mainly did all sorts of Java development and some PHP. I'm very good at OO and I'm not a novice programmer by any remote extent.

So here comes the question: what are the best resources/sites/practices/ways/books you guys can recommend to pick up on my rusty Perl skills and learn Perl "the new way"? Your suggestions will be much appreciated.

P.S. I did researched some previous answers. I want to emphasize that I'm not looking for novice book/resource (syntax, core principals, etc) but specifically ones that cover OOP capabilities that weren't there when I was programming in Perl (or I may overlooked it at that time)

P.P.S. Thanks to everyone for their suggestions and tips. After some consideration I went with @MBO answer since it's first mentioning Moose which I really like so far.

+21  A: 

I don't write Perl code at this time (currently I work in other languages), but I read from time to time this site: http://www.modernperlbooks.com/mt/. Also check Moose for new way of defining objects in Perl

MBO
Moose is the leading OO framework in Perl
kixx
I'll second both the Modern Perl blog and Moose; check out Catalyzed for a quick Moose intro: http://www.catalyzed.org/2009/06/a-gentle-introduction-to-moose.html
Drew Stephens
why downvote? Should I copy answer from link posted in comment by [mercator](http://stackoverflow.com/users/23263/mercator)? Or I answered wrong to question?
MBO
I can't imagine that someone would downvote this answer (so I upvoted it) rather than trying to pull his own answer up. In fact - based on my question and timing (this one is first that mentions Moose) I'm considering to accept it as the answer
DroidIn.net
+20  A: 

The book "Higher order Perl" might be of interest for you. Best of all - it's free.

Doc Brown
Very interesting, great tip, thanks and it's free (even better)
DroidIn.net
We get this for any new developers at work if they're not already familiar with it.
fennec
+1 Nice link ..
mobrule
Wow, MJD finally got the text online!
Michael Carman
+1 definitely, one of the best programming books I've read so far (still reading it)
kemp
+4  A: 

Use Perl::Critic. Read about Moose and MooseX::Declare. Try Padre. Read Perl Iron Man Planet aggregator.

Alexandr Ciornii
+8  A: 

Check out:

  • Perl Best Practices - nice collection of suggested best practices. Even if you don't adopt them, the discussion of the reasoning behind the suggestions is valuable.

  • Perl Testing: A Developer's Notebook - Provides excellent coverage of Perl's testing capabilities.

  • Object Oriented Perl - An excellent book about how to use and abuse the Perl's object system. This book is a bit dated. It predates inside out objects (whose time has come and gone) and Moose, both important developments in OOP. If you have a large body of older OO Perl to maintain, this book may well come in handy.

  • PerlMonks - A very handy Perl focused site with a very generous and collegial tone. A good place to go for help and feedback. Its been in operation for years, so there is also a massive archive of posts.

daotoad
Testing (with Test::More, Test::Exception, Test::NoWarnings, etc) is pretty important, and Perl (well, CPAN) makes it easy. Of course you may be very familiar with all this depending on what you were doing/where you were working 8 years ago...also you may be interested in Log4perl - especially if you've used Log4j in Java - which is probably the easiest to add logging
plusplus
Good list - going through it - thanks!
DroidIn.net
+18  A: 

Well, first of all Higher-Order Perl is really good, but it's about functional programming, not objects.

Perl Best Practices is an excellent book, but it has limitations, and one of them is that Conway recommends using his own Class::Std module to do inside-out objects, and the general consensus seems to be (1) that if you're going to do inside-out objects, Object::InsideOut and Class::InsideOut are better ways to do it (2) and anyway, using "Moose" based objects is a better way to go.

This illustrates what is probably the major difference between the Java and Perl world: There's rarely one standard way of doing anything with Perl. Starting as someone who feels comfortable with objects in another language, I would guess that the most interesting thing about Conway's now slightly dated Object Oriented Perl is watching him gradually develop different ways of adding OOP features you've been taking for granted.

I like the basic blessed-hash style of Perl OOP myself, but you need to understand that it's encapsulation is really weak, and that while method-inheritance works, there's typically no data-inheritance. There are also some rather perlish tricks in wide use, such as automatically generating accessors using an AUTOLOAD routine.

As for what you can read on the subject, don't neglect the on-line documentation that comes with Perl: perldoc. Note the "Tutorials" section at the top. If you're rusty on Perl's references and data structures, read the first two: perldoc perlreftut and perldoc perldsc. A little down the list, you'll see multiple OOP tutorials. These are largely about simple href-based objects, though there are some serious oddities in there, such as Tom Christiansen's scheme for closure-based objects down at the bottom of: perldoc perltoot

If you're interested in some of the newer ways people do things, you might want to start with Moose which is supposed to be the closest you can get to perl6 objects while still writing perl5 code. By the way: ignore the word "postmodern" there, it's a silly joke that doesn't make any sense.

If you're interested in inside-out objects (which have bullet proof encapsulation, but are perhaps a little annoying to debug-- you can't just use Data::Dumper on the object to get it's status), I'd suggest starting with this perl5 wiki page.

Awesome! Thanks for taking your time and giving this impressive write up!
DroidIn.net
Class::Std sucks badly, all it does is cause pain. That suggestion is probably the worst idea in PBP. I wonder if 'Std' is an acronym here ( http://www.cdc.gov/STD/ ). There is a lot of discussion of PBP suggestions to be found on Perlmonks and elsewhere.
daotoad
I think you mean "hash-based" instead of "href-based"
Michael Carman
Well no... really with a typical perl OOP approach you bless a hash-reference, which is often abbreviated as "href", and when speaking loosely, we sometimes just call this "hash-based".
@user256307 Not to be a stickler, but we bless a hash and bless just happens to take and return a reference to it.
converter42
+3  A: 

If you can use Moose then that is the best way to go (IMHO).

There is a book available: Moose. A postmodern object system for Perl 5

Moose Book

The book is the printed version of the excellent online Moose::Manual

/I3az/

draegtun
thanks, Moose seems to be a hot thing, darn the book is not free :)
DroidIn.net
@DroidIn.net: Yep its damned hot! Checkout out the Moose question/answers here on SO. BTW... there is a free PDF: http://blog.urth.org/2009/02/moose-book-well-sort-of.html (see "PDF output..." link) and see the Github link in comments for creating your own.
draegtun