UNIVERSAL-isa reviews

RSS | Module Info

UNIVERSAL-isa (0.06)

this module's use case is very very very simple.

Everyone seems to be making something it's not out of it.

If/when you encounter mis-use of UNIVERSAL::isa as a function, and this hinders your ability to e.g. test with Test::MockObject, you can load UNIVERSAL::isa (the module) to temporarily fix this problem until the author of the code that is causing the problem fixes it.

Automatically using it with Test::MockObject was a mistake, in my opinion. Shipping it and using it in production is also a mistake.

Admittedly the documentation was abusive but this spawned out of numerous frustrations with authors of modules refusing to fix their problematic code, and was not meant to be taken seriously.

That's all. Could we please stop beating the dead horse?

UNIVERSAL-isa (0.06) *

Everyone deserves a second chance, so I've ditched my original review and re-evaluated this dist.

Firstly, let me say that it is well and truly agreed (by people that understand the way that the can/isa methods works) that calling them as a function is bad.

However, as someone that learnt it the hard way themselves, playing games with UNIVERSAL is frought with peril, and should always be undertaken with humility, a strong concern for corner cases, and a perfectionist attitude.

The (original) author continues to display an unwarranted attitude of superiority, WITHOUT actually being superior. He insults Perl authors in the abstract, and then proceeds to make mistakes in UNIVERSAL::isa. And worse, without realising he's making the mistakes.

My original example of UNIVERSAL::isa(undef, 'Foo') dying was just that, an example. While it may now be fixed, the attitude that _caused_ that bug continues, and so a quick read of the source shows further obvious bugs.

For example, this distribution doesn't just warn about bad UNIVERSAL::isa usage, is disables any correct usage of UNIVERSAL::isa altogether, when an approach more in tune with the rest of Perl would be to warn and then allow the bad use anyway. (because Perl in general has the attitude of people not using strict and warnings do whatever they want with the rope, including hang themselves)

In the 1% of cases you ACTUALLY need to use UNIVERSAL::isa directly, you can't lexically disable warnings, and then call UNIVERSAL::isa and have it intentionally ignore overloaded ->isa methods.

As just another example, UNIVERSAL::isa is not reentrant. It stops infinite loops by means of a global $recursive variable. This means that if an overloaded ->isa method itself uses UNIVERSAL::isa then the global variable is incorrectly set, and any overloaded isa method in that second call is NOT called. This means that methods act differently depending on where they are called.

This stems from the continuing arrogance displayed by the author, which has resulted in him doing only relatively light unit testing that ignores vast numbers of cases in which there might potentially be problems. In addition he only tests for true results, with no testing for correct failures to catch problems that might stem from false positives.

So 1 star removed for insulting and unhelpful documentation, 1 star for only doing trivial unit testing, 1 star removed to balance the author 5-star rating himself when CPAN Ratings allows an undef rating specifically for the author to respond without a conflict of interest, and 1 star removed for both preventing legitimate uses of UNIVERSAL::isa and making isa no longer reentrant.

People in glass houses shouldn't throw stones.

I should note that the current maintainer, chromatic, is not who I refer to above. Although he has mis moments as well, he generally accepts legitimate criticism quite readily and improves things.

I've added back a start for fixing the documentation, but I'd still much prefer to see a warnings::isacan that warns but doesn't change behaviour.

UNIVERSAL-isa (0.05) *

I feel compelled to counteract the 5-star rating by the module's author.

Adam Kennedy's review is NOT bullshit for saying that UNIVERSAL::isa(undef, 'Foo') dies, when you consider that:

* the review was written for version 0.02 of the module, which did have that bug
* the bug was fixed for version 0.03, which is great, but there's no mention of the change, or acknowledgement that the bug ever existed. Heck, there's not even a changelog!

UNIVERSAL-isa (0.04) *

This is a poor module that should either be rewritten or moved to the ACME namespace.

This module asserts that it's better that programs should crash than that authors call UNIVERSAL::isa as a function. The rationale is good -- that calling isa() as a function breaks OO-style modules which may override the isa() method call -- but given that Perl 5 cannot call methods on unblessed objects means that the functional form is the only useful form of isa() without a lot of extra code.

Here's a case where isa() called as a function works where the method syntax fails:

my $foo = undef;

print UNIVERSAL::isa($foo, "Foo") ? "yes" : "no"; # prints "no"

print $foo->isa("Foo") ? "yes" : "no"; # dies with "Can't call method "isa" on an undefined value"

1 hidden unhelpful review