On Mon, Dec 17, 2001 at 08:12:43AM +0000, Piers Cawley wrote:
> >> What's wrong with
> >>
> >> ok ( eval { $foo->isa('Foo') } );
> >>
> >> or even:
> >>
> >> ok (eval { ref($foo) && $foo->isa('Foo') });
> >
> > As Kurt already pointed out, you can do:
> >
> > ok( UNIVERSAL::isa($foo, 'Foo') );
> >
> > but if it fails you have no idea what $foo was.
>
> No you can't. Not if you've overridden isa anywhere. (Which is
> perfectly possible.)
Ooooh, hadn't thought about that. I've done it myself a few times (to
make a delegation look like inheritance). Now I have to go fix
Test::More to deal with it. Ya know, I was literally just about to
release 0.40 and I HAD to go read my email first.
Either way, your above ok() solutions still give you no failure
diagnostics, which is the whole point.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
pleasing symmetry
the paste goes in at one end
comes out the other.
-- mjd