[EMAIL PROTECTED] writes:

> I know, I know, this makes a grand total of three posted to the list in one 
> day :-)
> 
> I have what will usually be a list of objects, but on occasions nasty
> programmers (including me) do things to annoy me like inserting a hashref,
> so I end up with a data structure that looks like:
> 
>   [
>     bless({}, 'Some::Class'),
>     bless({}, 'Some::Class'),
>     {},
>     bless({}, 'Some::Class'),
>   ]
> 
> which as expected, makes things go crazy when I try to call a method on
> every object in the list.
> 
> So what I really need is a surefire method to find out if something is blessed,
> rather than just a reference.  I know that I could do a simple regex against
> ref to find out if it is a HASH|ARRAY|SCALAR|CODE|REF|Regex, but a nice simple
> keyword like blessed( $svref ) would be nice.

eval {$ref->isa(UNIVERSAL)} will return true iff $ref is blessed.

-- 
Piers Cawley
www.iterative-software.com

Reply via email to