Michael G Schwern <[EMAIL PROTECTED]> writes: > 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.
Well, yes. At least the point about overridden isa didn't get lost... -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?