Hi all!

I want to know more about why class data is the Wrong Thing to do.

I think of class data as complex constants. For example, say, I have a Model layer, which aggregates ORM table objects. I might have something like this:

use constant orm_class_name =>'Table::Account';
has table (..., builder => '_orm_table');

...
sub _orm_table{
        shift->orm_class_name->new();
}
sub class_method_from_orm{
       shift->orm_class_name->method();
}

---

Now it is sensible for me to compute the orm_class_name based on the current package name - and a builder is the elegant way to do it (and I have to admit, builders are just plain pretty!)

class_has orm_class => (..., builder => '_orm_class', ...other fancy stuff possible...);

--
the rest of the code is unchanged - the class data is really little more than a very pretty constant.

OK, so bottom line is, I am twitching because Dave Rolsky says, I am a Bad Person, and seeing as he's been right about everything else thus far, I'd like to see whether my argument makes sense, or if there is a better way to do it.

Kate

Reply via email to