in reply to Re^2: RFC: DBIx::Iterator
in thread RFC: DBIx::Iterator
My best suggestion is to accept only one type of argument so you don't have to perform the check at all.
If that's not feasable, I suggest to dereference the reference appropriately inside an eval block. Otherwise you end up with a huge chain of tests just so that you don't miss all of the possibilities (non-reference, reference of the wrong type, reference of the right type, blessed reference, tied object, blessed reference of the wrong type with overloading, blessed reference of the right type with overloading).
Philosophically speaking, using UNIVERSAL::isa() to check for structural typing in Perl is perilous because Perl uses a nominal typing system (or behavioral, but no one ever talks about that). Sometimes the only way to know if you can do a thing is to do it and see if anything breaks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: RFC: DBIx::Iterator
by runrig (Abbot) on May 12, 2007 at 16:16 UTC | |
by chromatic (Archbishop) on May 12, 2007 at 23:21 UTC | |
by runrig (Abbot) on May 18, 2007 at 18:33 UTC |