http://qs321.pair.com?node_id=149861


in reply to Re: has it been blessed?
in thread has it been blessed?

The second test you pose is probably the more efficient, but you overlook a few candidates:

my $ref; if ($ref = ref($obj) and $ref !~ /^(SCALAR|ARRAY|HASH|GLOB|Regexp) +$/) { $obj->method(); }

Technically, the Regexp references are objects, but they are part of the core, and wouldn't represent an application-defined class. Of course, you can drop that from the regex above, if you like.

--rjray