Migrating Perl 5 code to Perl 6资料
本文为去找网小编(www.7zhao.net)为您推荐的Migrating Perl 5 code to Perl 6，希望对您有所帮助，谢谢！
The already contains most (if not all) the to deal with the issues you will confront in migrating Perl 5 code to Perl 6. But, as documentation goes, the focus is on the factual differences. I will try to go a little more in-depth about specific issues and provide a little more hands-on information based on my experience porting quite a lot of Perl 5 code to Perl 6.
How is Perl 6 anyway?
Very well, thank you! Since its first official release in December 2015, Rakudo Perl 6 has seen an order of magnitude of improvement and quite a few bug fixes (more than 14,000 commits in total). Seven books about Perl 6 have been published so far. by Brian D. Foy will soon be published by O'Reilly, having been re-worked from the seminal (aka "The Llama Book") that many people have come to know and love.
The user distribution is on a three-month release cycle, and more than 1,100 modules are available in the . The Rakudo Compiler Release is on a monthly release cycle and typically contains contributions by more than 30 people. Perl 6 modules are uploaded to the Perl programming Authors Upload Server ( ) and distributed all over the world using the Comprehensive Perl Archive Network ( ).
The online document has been translated into 12 languages, teaching over 3 billion people about Perl 6 in their native language. The most recent incarnation of has been reporting on all things Perl 6 every week since February 2014.
, a microservices framework, uses all of Perl 6's features from the ground up, providing HTTP 1.1 persistent connections, HTTP 2.0 with request multiplexing, and HTTPS with optional certificate authority out of the box. And a is now in (paid) beta (think of it as a Kickstarter with immediate deliverables).
Using Perl 5 features in Perl 6
Perl 5 code can be seamlessly integrated with Perl 6 using the module, making all of available to any Perl 6 program. This could be considered cheating, as it will embed a Perl 5 interpreter and therefore continues to have a dependency on the
perl(5) runtime. But it does make it easy to get your Perl 6 code running (if you need access to modules that have not yet been ported) simply by adding
In January 2018, I proposed a to convert Perl 5 functionality to Perl 6 as closely as possible to the original API. I stated this as a goal because Perl 5 (as a programming language) is so much more than syntax alone. Ask anyone what Perl's unique selling point is, and they will most likely tell you it is CPAN. Therefore, I think it's time to move from this view of the Perl universe:
to a more modern view:
In other words: put CPAN, as the most important element of Perl, in the center.
Programming and development
Since the publication of the CPAN Butterfly Plan, more than 100 built-in Perl 5 functions are now supported in Perl 6 with the same API. Many functions already exist in Perl 6 but have slightly different semantics, e.g.,
shiftin Perl 5 magically shifts from
@ARGV) if no parameter is specified; in Perl 6 the parameter is obligatory.
More than 50 Perl 5 CPAN distributions have also been ported to Perl 6 while adhering to the original Perl 5 API. These include core modules such as and , but also non-core modules such as and . Distributions that are upstream on the are targeted to have as much effect on the ecosystem as possible.
Rakudo Perl 6 has matured in such a way that using Perl 6 is now a viable approach to creating new, interactive projects. Being able to use reliable and proven Perl 5 language components aids in lowering the threshold for developers to use Perl 6, and it builds towards a situation where the sum of Perl 5 and Perl 6 becomes greater than its parts.
About the author
Elizabeth Mattijsen has been programming for a living since 1978 in various (mostly now defunct) programming languages. In 1994 she started programming in Perl 5 for the first commercial web site developer in the Netherlands. In 2012 she got more directly involved in the development of Rakudo Perl 6. From 2015 she has also been mostly responsible for the , a weekly blog post about developments in the Perl 6 world.
以上为Migrating Perl 5 code to Perl 6文章的全部内容，若您也有好的文章，欢迎与我们分享！