Four Ways to Improve Perl 5
Perl recently celebrated its 21st anniversary in December of 2008. And although Perl 5 has seen many changes in its 14 year history, the language still leaves much room for improvement. Perl 6.0 is sure to change the landscape for server-side programming but is there any way for version 5 to stay relevant? By adding a few essential elements, Perl 5 can be easier to use, faster and more productive.
Frequent Releases
The Parrot framework is currently in its 24th consecutive monthly release. This succession of releases has allowed the team to find a nice development rhythm, proving that they can meet commitments while identifying and recovering from mistakes that simply come along with the territory. While such a cycle for Perl may be difficult and painful to achieve, it could also take the stress out of development by knowing improved functionality and features will soon be delivered in the next version.
Autobox, Moose and Mouse
Autobox is one of the most beloved features of the Ruby programming language, a function that is capable of calling methods on primitives just like they were objects. Even though Smalltalk’s “everything is an object” theory conflicts with Perl pragmatics, this concept can occasionally eliminate some of the complexity of its code.
While Perl 5 took from Python’s object-orientated system, the nature of its default objects are aimed at flexibility, not simplicity. Moose and Mouse offer an enhanced default object system that would make Perl 5 much better, scaling upward in functionality for developers that require more power. With these models subsumed into the core, those utilizing version 5.12 would have an easier path to the object system projected for Perl 6.
ctypes
Perl’s extension system is baroque to say the least, requiring far too much knowledge of its internals to simply pass and return values to and from your shared libraries. Python’s ctypes library offers a smarter, more practical approach opposed to writing and compiling C code to simply map between Perl’s and C’s calling conventions. While ctypes isn’t perfect, the concept is sound and therefore, desperately needed in Perl 5.
mod_perlite
Mod_perl is a useful technology but it demands a lot from system administrators. It can also take over the server and consume vital resources if you’re not careful. The language could perform a lot better on the web with mod_perlite, which is the equivalent mod_php for Perl, implemented by default. Serious developers may always have a use for mod_perl but inexperienced users and others who don’t enjoy high-traffic sites could excel with a tool that is easier to use and lighter on resources than CGI.
Conclusion
Recently, many debates have been initiated on the topic of how Perl 5 can be improved. Other than the consideration of Autobox, Mouse and Moose, it doesn’t seem as if the open-source community has paid any other improvements much, if any attention at all. While ctypes and mod_perlite might be somewhat outside of the scope of the core developers, Perl has some gaps and deficiencies that make it less desirable than other options on the open-source market.
Related tutorials and articles
Leave a Reply
