
abigail at abigail
May 29, 2012, 3:42 PM
Post #12 of 33
(161 views)
Permalink
|
|
Re: CPAN / new Perl 5 features / Perl upgrade conundrum
[In reply to]
|
|
On Tue, May 29, 2012 at 11:14:02PM +0200, Elizabeth Mattijsen wrote: > On May 29, 2012, at 9:29 PM, Abigail wrote: > > On Tue, May 29, 2012 at 07:16:30PM +0200, Elizabeth Mattijsen wrote: > >> On May 29, 2012, at 7:03 PM, Ed Avis wrote: > >>> I guess I would add that 'maint' and 'blead' are not good names, if you intend to provide two versions which are both suitable for production use. ('Blead' in perl connotes a test version, and 'maint' the most recent production release, as I understand it.) Better to pick a new major version number - say you have 2.x and 3.x - and then users choose between 2 and 3. > >> > >> In fact, "blead" in the Thread::Queue::Any case, is at 1.x, whereas "maint" is still at 0.x. > >> > >> But indeed, maybe the phrases "maint" and "blead" are confusing. > >> > >> > >>> But anyway, what is the reason why not to just release the latest version to CPAN? The older versions are still there, and users who don't upgrade don't upgrade. > >> > >> Indeed. That would be the simplest way. But this has the serious > >> danger of breaking existing code out there. I don't want to do that. > > How's that? Isn't that what "use 5.XXX" and MIN_PERL_VERSION are for? > > What I want for Perl is a reason for organizations to upgrade their perl to a more recent version. This can be achieved by adding new features to CPAN modules that are written using newer Perl features. > > What I want for P5Pers, is that they can eat their own dogfood (aka features of newer perls) in the CPAN modules that they maintain. > > What I want for a packager / sysadmin who decides to upgrade a distribution to the latest and greatest (for whatever reason, in whatever environment), to not have to suddenly have to deal with the fact that the distribution won't work with the perl version that they have / want to migrate to. > > What I want for myself, is an easy way to start up a new "base" version of a distribution, using all new Perl features (if just for the fact that I want to get experience with said new features of Perl). > > > >> And if people should find bugs in the "maint" version, I still want to > >> be able to fix those for those users, without getting into very weird > >> version numbering territory. The setup I devised, allows me to do just > >> that as well. > > > > I'm not quite sure what it is you want to do. I've a hard time to come with > > functionality that actually requires a Perl that was released in the 21st > > century, except for some patterns and Unicode stuff. > > Other people might want to use other new features. This could be as > simple as being able to use // or when. The meme I've been seeing a > lot lately, is that all these new Perl features are fine, but you can't > use them in CPAN modules, because in the world out there, everybody is > still using 5.8.x. Everyone is free to put anything on CPAN they like. If you want to put code out there that requires 5.16, there's noone stopping you. > This is a chicken and egg problem. Organizations won't upgrade > because there is no real reason to. New features cannot be used, > because organizations don't upgrade. > > I think that everybody agrees that CPAN is one of the main reasons > people (still) use Perl. What we're seeing now is that on the one > hand, we have significant developments in the Perl 5 language. But the > modules on CPAN, one of the USP's of Perl, are still not using all those > new features. What kind of message are we sending with that? > > > > > But you were talking > > about upgrading all your modules. Can you give an example of what you want > > to do? > > convert: > > $self->{'maxjobs'} = 5 * ($add || 1) unless defined( $self->{'maxjobs'} ); > > to: > > $self->{maxjobs} //= 5 * ( $add || 1 ); > > > converting long winded if/elsif constructs all checking $_ to using when > > Stuff like that. I don't get it. That's just replacing the same functionality with a different way of writing it. If you keep both the old and the new way available, then there's no benefit for the user to upgrade, nor is there any benefit for yourself, and you'll be maintaining two code paths, one "modern", one "old". If your goal is to "push" organizations to upgrade their Perl by means of CPAN modules, write a killer module, and *don't* have an alternative "old style" version available. > > Anyway, the way I would do it is one of: > > > > > > eval <<"--" if $] >= 5.010; > > ... stuff that requires 5.010 ... > > -- > > eval <<"--" if $] >= 5.012; > > ... stuff that requires 5.012 ... > > -- > > eval <<"--" if $] >= 5.014; > > ... stuff that requires 5.014 ... > > -- > > eval <<"--" if $] >= 5.016; > > ... stuff that requires 5.016 ... > > -- > > Sorry, I don't want to get into the situation of having to support different > versions of Perl in a single file. That way lies madness. > > > use if $] >= 5.010, 'My::Module::perl5010'; > > use if $] >= 5.012, 'My::Module::perl5012'; > > use if $] >= 5.014, 'My::Module::perl5014'; > > use if $] >= 5.016, 'My::Module::perl5016'; > > Again, this causes all sorts of havoc on CPAN, when different distributions > have the same package declarations internally. There's no different distributions. There's just one distribution my-module-1234.5.67.tar.gz, which contains: lib/My/Module.pm (anything not rewritten) lib/My/Module/perl5010.pm (anything that requires 5.010) lib/My/Module/perl5012.pm (anything that requires 5.012) lib/My/Module/perl5014.pm (anything that requires 5.014) lib/My/Module/perl5016.pm (anything that requires 5.016) > Anyway, this would require code changes on the user code side. I want > to remain completely transparent as to the code using my module. If the > code uses the "maint" set of features, it doesn't matter whether the > "maint" or "blead" version of the module is loaded / installed. If the > code needs new features of a module, an upgrade of Perl is required. > At least that way, organizations have an incentive to upgrade. Why would that require any code changes? I presume the user had to do use My::Module; before, and I see no reason that would no longer work. The 'use if' block would appear inside My/Module.pm of course. Abigail
|