Perl Programming language| Part 4

Perl Programming language| Part 4

Perl – Availability

Perl is free software and is licensed under the Artistic License and the GNU General Public License. Distributions are available for most operating systems. Is particularly prevalent on Unix and similar systems, but has been ported to modern platforms (and many obsolete).

With only six reported exceptions, can be compiled from source on all Unix, or any other POSIX compliant Unix-compatible platforms. However, this is not usually necessary, because Perl is included in the default installation of most popular operating systems. Due to changes needed to support the Mac OS Classic environment, a special adaptation called MacPerl.

GNU / Linux

Perl is installed by default on most popular distributions of Linux including Gentoo, Mandriva, Debian, RedHat and SUSE.

Perl and Windows

Users of Microsoft Windows typically install a binary distribution of Perl. Compiling Perl from source on Windows is possible, but most do not have the necessary facilities C compiler

The Cygwin emulation layer provides another way to run Perl under Windows. Cygwin provides UNIX-like environment on Windows that includes gcc, so compiling from source, Perl is an affordable option for users who prefer this option.

In June 2006, was launched by Adam Kennedy on behalf of the Perl Foundation. It is a community web for everything related to Windows and Perl.

Perl – Interface to databases

Perl is widely favored for database applications. Its text handling facilities are good for generating SQL queries, arrays, hashes and automatic memory management makes it easy to collect and process the data returned.

In early versions of Perl, database interfaces were created by linking the player with a library database from the client side. This was somewhat awkward, a particular problem was that the resulting perl executable was restricted to use only a database interface, which had been bound. Also, relink the interpreter was difficult enough for only realized some of the most famous and important databases.

In Perl 5, the database interfaces are implemented by the Perl DBI module. The DBI module provides a single interface to Perl applications, independent of the database, while modules DBD (database driver) handle the details of accessing some 50 different databases. There are drivers DBD:: for most of the ANSI SQL databases.

Comparative performance

The “Computer Language Shootout Benchmarks comparing the performance of implementations of typical programming problems in various languages. Your Perl implementations usually take more memory than implementations in other languages, and had varied speed results. The benefits are similar to Perl from other languages like Python, PHP or Ruby, but slower than most compiled languages.

Perl can be slower than other languages do the same because you have to compile the source every time it runs. In “A Timely Start”, Jean-Louis Leroy found that his scripts in Perl it took much longer to run than he expected because the perl interpreter lost most of the time searching and compiling the modules. Because Perl can not save intermediate compilation as do Java, Python and Ruby, Perl scripts carry this overhead on each execution.

The overhead is not a problem when the implementation phase is long, but can significantly skew very short execution times, as often found in the benchmarks. Once perl implementation phase begins, however, can be very fast and typically outperforms other dynamic languages. Technologies like mod perl overcome this by keeping the compiled program in memory between runs, or Class:: AutoUser which delays the compilation of parts of the program until they are needed.

Continued : Perl | Part 5