minor hate: autoload and universal

rjbs on 2008-04-14T18:06:47

I just spend twenty minutes or so on this nonsense.

A number of our objects get decorated by Mixin::ExtraFields::Hive, which lets us say:

$object->hive->some->random->path->to->datum->SET(1);

It's a nice convenient way to store arbitrary hierarchical data about stuff.

I was trying to store the "moniker" of the test object being stored:

$object->hive->test->moniker->SET($moniker);

This kept failing, saying I couldn't call "SET" on "hive." What?

Well, UNIVERSAL::moniker was getting in the way. Argh! I hate UNIVERSAL. I will never abuse it outside of Acme again.


I agree

perrin on 2008-04-15T12:54:00

Every time I complain about UNIVERSAL, people tell me not to worry about it because collisions will never happen.

Re:I agree

rjbs on 2008-04-15T13:58:06

I used to be a big fan of UNIVERSAL::moniker. Now I think, "Why couldn't I just say Data::Moniker->for($thing) and it would call ->moniker if blah blah blah." Data::Moniker could export a class-bound version of the method, etc.

People complain a lot about monkeypatching Object in other languages, but I feel like you're right: a lot of people who see the evil of that seem to let UNIVERSAL methods go.