On Fri, Aug 29, 2014 at 09:34:41AM -0400, David Mertens wrote: > We can all agree that Perl likes to give lots of rope to its programmers. > Calling UNIVERSAL::isa prevents mocking, but it also prevents nefarious > classes from lying about what they do. Apparently, allowing mocking is *so* > much more useful than safe-guarding against lying that the porters decided > to (1) remove the documentation of this behavior (though anybody who > understands Perl's object system could figure it out)
Yes, a lot of things are tailored towards the newbie programmer, and rightly so, because it's an army of well-intentioned but ignorant newbies that can code us into a deep dark hole from which it takes a long time to get us out. (And, as such, I tailor my answers on publicly archived and searchable mailing lists accordingly.) I'm also saying all this just after fighting with fixing UNIVERSAL::isa's code (the CPAN module, not the built-in version) and shaking my head at all the wrongness that I found on the CPAN. > and (2) remove it > from the Exporter list so that it is difficult to bring this function into > your current package. I don't think that's the reason why it was removed. There were technical issues involving interactions between UNIVERSAL and Export that were the primary motivators here, instead. The p5p list contains all the gory details. > If you think UNIVERSAL::isa is the > right way to go, then use it. But you really should know what you're > doing---and preventing---before using it this way. Chances are quite good > that the OP had code written by somebody who didn't understand what they > were doing. Agreed on all counts. And, FWIW, all the instances of 'UNIVERSAL::isa' that I found on my searches on grep.cpan.me were of the newbie-doing-it-wrong form, rather than the yes-I-really-want-the-true-answer-not-the-mocked-one-and-I-understand-the-difference form.