Re: [Module::Build] version.pm and version number comparison problem
Status: Beta
Brought to you by:
kwilliams
|
From: John P. <jpe...@ro...> - 2006-02-02 19:44:06
|
Julian Mehnle wrote: > "This is wrong and you should not do it." -- What kind of justification is > that?? The POD has a little more than that (from UNIVERSAL::can): > Some authors call methods in the UNIVERSAL class on potential > invocants as functions, bypassing any possible overriding. This is > wrong and you should not do it. Unfortunately, not everyone heeds > this warning and their bad code can break your good code. The use of UNIVERSAL::isa() and UNIVERSAL::can() as functions means that any class method by those names is rendered moot. It means that you cannot use objects that only instantiate their true class when required (where you might want to have a custom isa() that effectively lies about what class(es) the object belongs to). For example, imagine a polymorph class that takes on the characteristics of whatever class that is tested for (like Test::MockObject for example). I suppose you could suggest that Module::Build load UNIVERSAL::isa (or at least Scalar::Util for the blessed() sub and call isa() as a object method instead). > Why is it wrong to do UNIVERSAL::isa($foo, $type)? This usage is > documented in `perldoc UNIVERSAL`, and it works fine, after all. That POD was written a long time ago and should not be considered to be the only way to think about it. As it turns out, UNIVERSAL::isa (the core code, not the CPAN replacement) was written in a poorly designed way that does not DTRT with some objects that are now in usage. John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748 |