in reply to Re^5: RFC: Perl meta programming
in thread RFC: Perl meta programming
If I want to verify membership in a class, I'd need to do something like: eval { $foo->isa( 'Some::Class' ) }Right. That ->isa call might throw an exception because $foo isn't an object, it might resolve to UNIVERSAL::isa, or $foo might have a different ->isa method. Using UNIVERSAL::isa on all objects and classes breaks objects and classes which implement their own ->isa methods. That's much of the interesting code being written these days so you'd best not lock yourself off from the future by hardcoding UNIVERSAL::isa in.
Here's one additional note. Try to remember to localize $@ when you're using eval. It protects your caller's view of $@ from your eval blocks.
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|