Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Tuesday August 15, 2006
01:53 PM

Object::Deadly kills buggy diagnostics

[ #30639 ]

I wrote Object::Deadly because I was tired of diagnostic modules forgetting to watch for overloaded objects. It'd be nice for it to use Carp::Clan but C::Clan suffers from the same bug O::Deadly is meant to help test for!

http://rt.cpan.org//Ticket/Display.html?id=21002 contains a patch to bring Carp::Clan 5.3 up to 5.4 which *is* smart about overloading. I also wrote some tests for C::Clan that use O::Deadly because that's exactly what it's there for.

I'm amused by this - just getting O::Deadly off the ground required patching some of it's infrastructure.

Oh yes, infrastructure? I have a rant coming about the evil, evil, evil UNIVERSAL::require module.

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.
  • The only serious problem I see with UNIVERSAL::require is that people need to learn that if they use this module, they need to be careful if they have methods named require or use. As a general rule, it's a bad idea to use keywords as method names (though I've done this when it was appropriate). On the other hand, people use methods (even functions!) named isa, can and version incorrectly, so I can't expect them to play nicely with code.

    The only reason I submitted a patch to that module is that I'm seei

    • Inserting things in UNVERSAL that aren't already there causes *every* object and class everywhere to have to potentially know about it. I used Devel::Symdump to get the list of all the currently known functions in UNIVERSAL so I could know that all method calls made on my object were going to be handled within my object.

      This is an impossible task as long as people keep polluting UNIVERSAL. Say someone loads my module, then loads something else which pollutes. It's now possible for someone to use that insert

    • I suppose I'd like to add that I didn't even realize I had this problem with UNIVERSAL::require when I was complaining about it to you the other day. Yesterday it was just angst over ETOOMUCHMAGIC. Today it's a gripe that it actually breaks stuff when it loads.
      • On a side note, there's also Module::Load [cpan.org] which fixes the same problem UNIVERSAL::require is addressing, whithout polluting UNIVERSAL::*.

        On the upside, it's even core as of 5.9.4 [cpan.org]

        • Cheer! Cheer! Huzzah!

          "Fixing" UNIVERSAL pollution in a class means reading the source code for all the modules on CPAN that are likely to touch UNIVERSAL. Ugh. Did that yesterday. I'm considering putting up some kind of notification service to myself to watch for the next UNIVERAL polluting module.

          ****UGGGLLLYYY!!!