Le jeudi 27 décembre 2012 à 13:40, David Precious a écrit :
On Thu, 27 Dec 2012 12:46:20 +0100Alexis Sukrieh <sukria@sukria.net> wrote:Actually, the whole thing is that dancer_version (or major_version)should clearly not be used for plugins to check their compatibilitywith the core. Actually, what plugin should do is to use api_version.Simple example :Dancer 1.9999_01 is "Dancer 1" is you look at the VERSION (whatevermethod you choose) but it's actually "Dancer 2" regarding its core.So to summarize:- dancer_major_version should be removed, it has been added in arush, while releasing 1.9999_01 but was a mistake because of thereason explained above- api_version should be used whenever something needs to check itscompatibility with the coreI'm not sure; a lot of existing plugins use dancer_version, and it'smeaning is fairly clear.I think the pragmatic approach is to let them continue to do so, with acouple of tweaks:- dancer_version can strip /_\d+$/ so that dev releases don't causeissues- a special-case for D2 - e.g. return 2 if ($version >= 1.9) - if thecode is calling dancer_version, it most likely wants to know thedifference between D1 and D2, I can't see that it's likely to beused in many other ways, you'd tend to use $Dancer::VERSION for that.
If that's no good, a potential other solution, which may be a littlevoodish, is to return an object which uses overload to overloadstringification and comparison, so if you use it as a string (if youwanted to output the current Dancer version) it gives you the fullversion (perhaps minus the _\d+$ from a dev release), but if you use itin a comparison (e.g. if (dancer_version >= 2), it Does The RightThing).What do you think?Whatever we decide to do, if we do change the behaviour ofdancer_version a little it should be documented clearly.--David Precious ("bigpresh") <davidp@preshweb.co.uk>http://www.preshweb.co.uk/ www.preshweb.co.uk/twitterwww.preshweb.co.uk/linkedin www.preshweb.co.uk/facebookwww.preshweb.co.uk/cpan www.preshweb.co.uk/github_______________________________________________dancer-users mailing listdancer-users@dancer.pmhttp://lists.preshweb.co.uk/mailman/listinfo/dancer-users