in reply to OO best practice basic questions

Writing your own objects in Perl is an excellent learning exercise and is perfectly fine for small projects (OO enthusiasts might disagree, but I think there's nothing wrong with whipping up one or two classes this way when best practices are followed). If you're going to be writing a lot of OO code, nowadays there are a lot of modules that can help you. The best-known one is Moose, and chromatic's "Modern Perl" has a chapter on it ("regular" Perl objects like the one you're writing are described later on in that chapter, "Blessed References"). Some people prefer Moose's smaller siblings, such as Mouse, Moo or even Mo (although that might be a little too small ;-) ).

Replies are listed 'Best First'.
Re^2: OO best practice basic questions
by tobyink (Canon) on Aug 27, 2014 at 20:24 UTC

    Usually skip Mouse - it's a good OO kit in its own right, but it doesn't play well with Moose. (You can't for example consume a Mouse role in a Moose class, or vice versa.)

    Rather than Mo, consider Class::Tiny. It has fewer features, but is less crazy. Sadly, it disobeys the naming rule of starting with "Moose" and then stripping away letters. There are ongoing efforts to get it to play nice with Moo and Moose, and they seem to be getting somewhere.

Re^2: OO best practice basic questions
by choroba (Cardinal) on Aug 27, 2014 at 16:14 UTC
    ... or even M (although that is a little too small).
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ