|Don't ask to ask, just ask|
Perl6: Choosing language version in the shebang line?by reverendmred (Initiate)
|on Feb 22, 2017 at 02:22 UTC||Need Help??|
reverendmred has asked for the wisdom of the Perl Monks concerning the following question:
I'm returning to Perl after an absence of a couple years to pick up a lot of code I left in beta. Now, Perl6 has changed all the rules.
Languages need to evolve, but when C evolved into different varieties, ultimately, it was called a different language. The same seems to be true of Perl.
Is there any way to ensure a switch in Perl 6 so you can choose between languages? Once long ago, we used the top of the file to point the script at the executable. Can we have Perl6 provide something like this to preserve legacy code. It would also be nice for CPAN modules to provide a fork so we can keep alive old stable code.
I know you must now be thinking 'oh my god, you can't have two languages in one application' but actually, you can. When last left Perl behind and returned to it in the early 00s, it had switched from a procedural scripting language to a very fake OO language. I say very fake, because I worked on a bioinformatics project coming from a pure 00 environment and in my nw position I got criticized for crappy perl code and not doing good OO -- which only showed me my colleagues knew nothing about Perls history and had absolutely no idea what OO really was.
The point is, if you had good OO like Perl5 code, there should be no problem running it alongside new Perl6 code as long as you treat them as separate languages and you have a fork of the legacy CPAN code. What you need to make sure is that the interfaces between your Perl5 and Perl6 code are stable and work. (Of course, I hate to say, but that old bioinformatics project was not good OO and violated every aspect of encapsulation).
So, is there a way we can fork projects and modules on CPAN? This would be really, really useful.