Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

rjbs
  (email not shown publicly)
http://rjbs.manxome.org/
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Monday April 14, 2008
02:06 PM

minor hate: autoload and universal

[ #36148 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Every time I complain about UNIVERSAL, people tell me not to worry about it because collisions will never happen.
    • 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.
      --
      rjbs