Perl module tutorial

Everyone who programs, regardless of programming language, reaches a point when they need to move away from throwaway code to reusable code.

For Perl people, this means modules. Of the many “how to write your first module” tutorial on the web, I like lesson 8 in Steve’s Perl tutorial – the other chapters are good too.

Here’s my small perl+modules at del.icio.us collection.

2 thoughts on “Perl module tutorial

  1. Pedro Beltrao

    Perl does not really motivate this. I worked with Java for a couple of months and I did it from the start. With Perl, it has been 4 years and I have almost no re-usable functions that I made myself.

  2. nsaunders Post author

    That’s true – I’ve been hacking Perl for years and only wrote my first module last year. Maybe there’s a sense that in Perl, modules are provided by “other people”; CPAN or for biology, BioPerl. It took me a long time to get my head around OO Perl and it was almost a let-down when I realised that objects are just complex data structures! I guess OO was tacked onto Perl late in the day, whereas it’s taught to you from the start in other languages.

    That said, I recommend trying to rewrite your old procedural scripts in module form; it’s quite educational and makes you view things from a new perspective.

Comments are closed.