blessed v unblessed references

Ovid publiustemp-londonpm at yahoo.com
Fri May 2 11:26:07 BST 2008


--- Dirk Koopman <djk at tobit.co.uk> wrote:

> How do you safely tell whether a reference is blessed or not? When I
> say safely, I mean without the runtime aborting.

  use Scalar::Util 'blessed';

  if ( blessed $reference ) {
      dump;
  else {
      # :)
  }

OK, wee bit of a joke there.  Don't call 'dump'.  You get the idea :)

Cheers,
Ovid


--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/


More information about the london.pm mailing list