http://qs1969.pair.com?node_id=510974

Ovid has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I know there has to be a module doing what I want, but I can't quite seem to find it.

Essentially, I'm looking for a module which lets me build simple getter/setters with an optional validation callback.

Class::MethodMaker
Has an annoying habit of failing tests
Class::Accessor
Must inherit from it. I don't want that.
Class::Accessormaker
Nice but no validation

I want something like this:

use Class::BuildMethods 'name', 'rank' => { default => 'private' }, 'date' => { default => $some_date, validate => &validate_date };

Those the the things I'm doing over and over again. Constantly. That's what I want to abstract out but I'm not finding something which provides that in one easy to use module. Writing this is trivial but I'm loathe to upload yet another friggin' module into the Class:: namespace. I know this module must be out there. What did I miss? :)

Cheers,
Ovid

New address of my CGI Course.