Skip to main content

Just My Type

Piers Cawley (Thermeon)
Perl
E145
Average rating: ****.
(4.33, 6 ratings)

There’s been a revolution in the way we think of types in Perl in the last few years. Not the kind of frustrating annotations of Java that seem to be more about placating the compiler than helping the programmer, but a powerful way of describing what data should look like and how to convert from one form to another.

In this talk I intend to cover different aspects of Moosish types and the different ways we use them:

  • Types for descriptions – a data structure satisfies a type.
  • Types for conversion – how to be liberal in what you expect
  • Types for error handling – how to steal good ideas from Haskell

In the examples we’ll expand configuration files into objects, go from HTTP parameters to user and session objects and from DBI urls to database handles without any of the conversion logic getting tangled in our class definitions. We’ll use parameterised types to handle errors without the overhead of throwing exceptions and we’ll finish up with cleaner code that’s easier to understand, test and extend.

We’ll be using recent Perl 5 for this code, so if you’ve not seen things like state variables and the /r substitution modifier in action in real world code, this talk will be of interest too.

People planning to attend this session also want to see:

Photo of Piers Cawley

Piers Cawley

Thermeon

Piers Cawley started programming Perl in the mid nineties, but recently spent a few years working as a Ruby programmer.

He’s currently writing Perl for Thermeon Europe

He’s a singer and balloon modeller, and has created custom balloon millinery for Sarah Novotny.

Leave a Comment or Question

Help us make this conference the best it can be for you. Have questions you'd like this speaker to address? Suggestions for issues that deserve extra attention? Feedback that you'd like to share with the speaker and other attendees?

Join the conversation here (requires login)