Le jeudi 27 décembre 2012 à 13:40, David Precious a écrit :
> On Thu, 27 Dec 2012 12:46:20 +0100 > Alexis Sukrieh <[email protected]> wrote: > > > Actually, the whole thing is that dancer_version (or major_version) > > should clearly not be used for plugins to check their compatibility > > with 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 (whatever > > method 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 a > > rush, while releasing 1.9999_01 but was a mistake because of the > > reason explained above > > - api_version should be used whenever something needs to check its > > compatibility with the core > > > > > I'm not sure; a lot of existing plugins use dancer_version, and it's > meaning is fairly clear. > > I think the pragmatic approach is to let them continue to do so, with a > couple of tweaks: > > - dancer_version can strip /_\d+$/ so that dev releases don't cause > issues > - a special-case for D2 - e.g. return 2 if ($version >= 1.9) - if the > code is calling dancer_version, it most likely wants to know the > difference between D1 and D2, I can't see that it's likely to be > used in many other ways, you'd tend to use $Dancer::VERSION for that. > > Looks very close to my second proposal, so I'm all for it :) > > If that's no good, a potential other solution, which may be a little > voodish, is to return an object which uses overload to overload > stringification and comparison, so if you use it as a string (if you > wanted to output the current Dancer version) it gives you the full > version (perhaps minus the _\d+$ from a dev release), but if you use it > in a comparison (e.g. if (dancer_version >= 2), it Does The Right > Thing). > > What do you think? > > Whatever we decide to do, if we do change the behaviour of > dancer_version a little it should be documented clearly. > > > > -- > David Precious ("bigpresh") <[email protected]> > http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter > www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook > www.preshweb.co.uk/cpan www.preshweb.co.uk/github > > > _______________________________________________ > dancer-users mailing list > [email protected] > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > >
_______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
