The following module was proposed for inclusion in the Module List:

  modid:       Acme::Holy
  DSLIP:       Rdcfp
  description: Test whether references are blessed.
  userid:      IBB (Ian Brayshaw)
  chapterid:    2 (Perl_Core_Modules)
  communities:

  similar:

  rationale:

    Acme::Holy provides a single routine, holy(), which returns the
    name of the package an object has been blessed into, or undef, if
    its first argument is not a blessed reference.

    Isn't this what ref() does already? Yes, and no. If given a blessed
    reference, ref() will return the name of the package the reference
    has been blessed into. However, if ref() is passed an unblessed
    reference, then it will return the type of reference (e.g. SCALAR,
    HASH, CODEREF, etc). This means that a call to ref() by itself
    cannot determine if a given reference is an object. holy() differs
    from ref() by returning undef if its first argument is not a blessed
    reference (even if it is a reference).

    Can't we use UNIVERSAL::isa()? Yes, and no. If you already have an
    object, then isa() will let you know if it inherits from a given
    class. But what do we do if we know nothing of the inheritance tree
    of the object's class? Also, if we don't have an object, just a
    normal reference, then attempting to call isa() through it will
    result in a run-time error.

    holy() is a quick, single test to determine if a given scalar
    represents an object (i.e. a blessed reference).

  enteredby:   IBB (Ian Brayshaw)
  enteredon:   Mon Jun 16 02:31:03 2003 GMT

The resulting entry would be:

Acme::
::Holy            Rdcfp Test whether references are blessed.         IBB


Thanks for registering,
-- 
The PAUSE

PS: The following links are only valid for module list maintainers:

Registration form with editing capabilities:
  
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=a6500000_76b682262e274870&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
  
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=a6500000_76b682262e274870&SUBMIT_pause99_add_mod_insertit=1

Reply via email to