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

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.
  • Perhaps you could add something like
    Object::ID->object_id_for($object)

    Or use Object::ID qw(obj_id);

    These would both avoid UNIVERSAL and avoid needing to add *anything* to *any* class *ever*.

    Every time someone puts something in UNIVERSAL, %%RND_BAD_THING%%.

    --
    rjbs
    • All the objections associated with UNIVERSAL::isa($obj, $class) vs $obj->isa($class); come to mind. Why would you override object_id()? Its too early to say. Apparently we thought the same thing about isa() and can().

      OTOH maybe someone might write their own object_id() method that does something different and you'll accidentally get that? Entirely possible, but turns out to be highly improbable. A Google Code Search [google.com] there's only a handful of object_id() methods out there (I cut out BioPerl, Moco and

      • "FWIW you can already call object_id($obj)."

        Oh, of course, because although it is advertised that you're importing it to be called via your package as a method, it can be imported in for use as a function. Hooray!

        --
        rjbs
      • You can check in object_id_for if the object provides a method can trampoline to that. Then you get to have it both ways.