PERL

Different versions
Briefly constrasting Perl 5 and Perl 6 development

As noted by Wikipedia's article on Perl: “Early Perl 5” section, Perl 4.036 was released in 1993. “At that point, Wall abandoned Perl 4 to begin work on Perl 5.” “Perl 5.000 was released on October 17, 1994.”

As noted by Wikipedia's “Perl” article, “Perl 6” section, work on Perl 6 started in the year 2000. Wikipedia's article (version from mid-2015) on Perl 6 says “The design process for Perl 6 began in 2000. A release candidate is expected in September 2015 and a final release by December.” “In 2001, it was decided that Perl 6 would run on a cross-language virtual machine called Parrot.” So, Perl 6 has taken roughly 15-16 years from the time it started to be designed to the time that it ws really considered to be “released”.

On the Perl.com website, some notes (apparently written by Randal Schwartz) stated,

“Perl 5 development stagnated a bit, trigging the whole "Perl 6" revival, and the relationship between Perl 5 and Perl 6 is still not understood by most people outside the direct Perl community (nor even by some who are *in* the community). But with the establishment of the quarterly point release, and the annual major releases, Perl 5 seems to have gotten firmly back in the saddle of modern development again.

So, Perl 5 and Perl 6 have experienced language development simultaneously.

At the time of this writing (in the year 2015), when most people think of the Perl language these days, they are probably thinking of Perl version 5.

More notes about Perl versions

Perl “5.10” is newer than Perl “5.8”. The best way to think of the version numbers is that the number after the decimal point is part of a three digit number. The use function in Perl (Perldoc: use) supports treating version numbers as a three digit number, so Perl 5.10 would show up as version “5.010” when using this syntax.

When the numbers after the first decimal point (e.g., in the version “5.22.0”, this is referring to the “22” portion) is an odd number, then the release of Perl is considered to be a “development” version. The even-numbered versions are considered to be a “maintenance” release, which is what is generally recommended for production usage. (PerlMonks: Odd version of perl

Perl Policy states, “We "officially" support the two most recent stable release series.” The provided example notes that with version 5.18.0, version 5.14 lost support.

  • To analyze that in further detail: the supported versions were 5.18 and the 5.17, which would be a “development” version, and 5.16, which was a stable release, and 5.15, which was a development version. However, at that time, the two most recent stable releases were 5.18 and 5.16, so version 5.14 got dropped.
Names/Websites
Comprehensive Perl Archive Network (“CPAN”)

On PerlMonks discussion about Perl's “Killer App”, William Ross (under the username “thpfft”) identified the Comprehensive Perl Archive Network (“CPAN”) as Perl's “killer app”. (The name CPAN is a modification of the Comprehensive TeX Archive Network (“CTAN”).)

CPAN may be a collection of things, but the most famous element of CPAN is an archive of lots of programming code. As noted by CPAN FAQ: “What is CPAN?”, “CPAN is also the name of a Perl module, CPAN.pm, which is used to download and install Perl software from the CPAN archive.”

This comment looked interesting: A comment to Nornagest's answer to a question by ZJR's on Programmers.StackExchange.com question looked interesting: “In my opinion CPAN is great if you need a wheel of any shape, but less great if you need a car factory.” What this means is that CPAN may have solutions for small tasks, so people don't need to “re-invent the wheel” quite so often, but much more work may be needed for larger projects.

Larry Wall made Perl.

A Perl “pumpking” has been described as being one of “Larry's lieutenants”, by chromatic's “The Value of a Pumpking”. (This term is also used by official documentation: Perl documentation: Perl Policy uses the term multiple times, and (at this time, before Perl 6's release) states, “These days, Larry spends most of his time on Perl 6, while Perl 5 is shepherded by a "pumpking", a porter responsible for deciding what goes into each release and ensuring that releases happen on a regular basis.”

The Perl Foundation's home page states some things that the Perl Foundation does. One of those things is that the Perl foundatino “[c]arries the legal responsibility for Perl 5 and Perl 6; perl.org; Perl Mongers; PerlMonks.” (Some of those hyperlinks were shortened, or modified for longevity, from the original quoted text.) So, the Perl Mongers website and the PerlMonks community does seem to have some official tie-in.

Getting Perl

First, here's the simple information, even if it is less-than-thorough:

There are a couple of very noteworthy options for using Perl 5.

base Perl 5

One option is to use the base Perl 5 distribution, which is included as software bundled with quite a few operating systems.

Perl 5 has become quite popular over the years, and is actually bundled in with a number of operating systems. Before trying to determine how to obtain the software, you may wish to check whether it is pre-installed.

Strawberry Perl

For Microsoft Windows, the most equivilent distribution is probably Strawberry Perl. http://perl.org/get.html calls Strawberry Perl, “A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else”. Strawberry Perl @ Code.google.com identifies the license as “Artistic License/GPL”, which matches Perl's license (Artistic License, or GPLv>=1).

The main page of Strawberry Perl has been known to have this quote from Perl's creator, Larry Wall:

"When I'm in Windows, I use Strawberry Perl"
-- Larry Wall
ActivePerl (ActiveState Perl)

The other major disribution to note is ActivePerl, which is released by an organization called ActiveState. ActiveState Perl is the same thing as ActivePerl, and versions of ActivePerl exist for many platforms as well.

ActivePerl may have a history of doing some certain things well (like having an easy way to download/import code) before Strawberry Perl did. Today, one of the most significant distinctions of being an ActivePerl customer may be the commercial support that ActiveState may provide. Strawberry Perl's support page states, “If the fact that Strawberry isn't released by a company worries you, remember that 100,000+ people and companies trust our releases, including Larry Wall and most of the top CPAN authors.”

DWIM

For Microsoft Windows, the top of http://perl.org/get.html mentions Strawberry Perl and ActiveState Perl, while the Getting Perl: Win32 section at the bottom of the page also mentions one other distribution, “DWIM Perl for Windows”. This same DWIM Perl for Windows is not mentioned by CPAN Ports: Binaries: Win32 section (which does mention Strawberry Perl and ActivePerl). The DWIM Perl for Windows page mentions what that distribution comes with, including Strawberry Perl. According to PerlMonks discussion: question about IDEs, it looks like DWIMPerl is basically Strawberry Perl (possibly an old version) and Padre. Padre is an IDE, which can be added easily by running “ cpan Padre ”.

MSYS Perl

This distribution has been known to be years out of date: in mid-2015, the last release was over four years old. However, the MSYS files have been known to work well with less overhead than many other programs. (This guide is not necessarily trying ot recommend this release, at this time, but is mentioning it as an alternative that can work well, and may work better for some people's usage.) For example, in mid-2015, the Strawberry Perl 5.22.01 installer was just under 76MB (75.9MB), whereas the binary files for MSYS PERL (version 5.8.8-1) was approximately 7MB (not including any seperately-downloadable libraries that might be needed). For automated projects where MSYS PERL is sufficient, the low overhead may be preferable to the experience offered by some other distributions.

Actually, the SourceForge Projects page for MSYS PERL seems to have instructions about downloading other components, so prepare to get your hands dirty if you want to explore this route.

So, what this seems to really boil down to is that people who want the most “pure” Perl releases may want to use the base distribution, except that people using Microsoft Windows will likely want to try to use Strawberry Perl. If additional features, like an IDE, are desired, those features may be easily addable. (For example, PerlMonks discussion: Perl Development Tools, PERL IDE discussion.)

However, for those who desire larger packages that may have more functionality bundled in, there are some alternatives that the http://perl.org/get.html refers to.

Using Perl

Perl can be used by specifying a filename on a command line. Using the -e parameter can allow a string containing some simple Perl code.

Details about using Perl with CGI technology is not fully covered directly in this section, but an example is shown by Multi-Server Project Tutorial: CGI in OpenBSD httpd. (Details about additional platforms may be added here at a later time.)

Sample commands

Running a script file:

perl filename.pl

Seeing version of Perl installed:

perl -v

Another way:

perl -e "print 'The PERL version is: ' ; print $^V"

Microsoft Windows:

perl -e "print 'The Operating System platform is: ' ; print $^O"

For the 64-bit version of Strawberry Perl for Microsoft Windows, this has been known to print out: “MSWin32”.

Quotation Mark Variation

For the most part, Strawberry Perl will act rather similar to the base Perl packages for Unix. However, here is one exception.

With Unix, the outer “quotation marks” can be apostrophes (also known as “single quotes”). Then, literal text on the inside can be the standard “double”-style quotation marks. So, the following will work in Linux:

perl -e 'print "The Operating System platform is: " ; print $^O'

The results may look like: “linux” or “openbsd”.

People may be rather inclined to use this syntax, so that the apostraphes are on the outside, to affect how special characters get parsed. For example:

$ perl -e 'print "The Operating System platform is:\ " ; print $^O'
The operating system is: linux
$ perl -e "print 'The Operating System platform is:\ ' ; print $^O"
The operating system is:\ linux
$

Notice that the first way processed the backslash as a metacharacter, while that didn't happen in the second method. For this reason, some people may be tempted to place the apostraphes on the outside.

However, on Microsoft Windows:

C:\> C:\Strawberry\perl\bin\perl -e 'print "The Operating System platform is: " ; print $^O'
Can't find string terminator "'" anywhere before EOF at -e line 1.

C:\>

This does not appear to be caused by the shell, so it seems to be a behavior of Strawberry Perl.

(It is currently believed that ActivePerl also does this.)

Therefore, using double quotation marks on the outside may be the more portable approach.

Some people may be concerned about the complexity that could be required by an apparent need to escape more characters. Keep in mind that complicated code, involving a “metacharacter”, may typically be placed inside a “script file”, in which case there may be no need to be escaping characters.

Debugging
ActivePERL users

ActivePERL may come with its own debugging software that is designed to use a GUI. To use the debugger that comes with PERL, there may be a step or two to perform.

The first step is to eliminate the value of the PERLDB_OPTS environment variable.

The other may be specific to ActivePerl for Microsoft Windows, and is to set the PERL5DB variable, as follows:

SET PERL5DB=BEGIN { require 'perl5db.pl'; }
Microsoft Windows users
SET TERM=dumb

Apparently this was needed sometime between versions 5.18.2 and 5.20.2, per PerlMonks guide.

Add a -d switch. Here are some examples:

perl -d file.pl

Loads a script file for debugging.

perl -d -e "print"

The earlier example didn't really need quotation marks.

perl -d -e print

This loads the debugger with the code, "print". Instead of running that function, the “expression” in the quotation marks could simply be another command, like setting a variable, or the expression could be a number. For example, PerlDoc: Debugging (“Calling the Debugger”) section has:

perl -d -e 0

To quit the debugger, use Ctrl-C (interrupt) or EOF (Ctrl-Z in Microsoft Windows, typically Ctrl-D in Unix), or run the q command.

Installation of Tk

One way to create graphical elements is to use Tk. (Wikipedia's article on Tk calls the License for Tk is “BSD-style”.)

To install Tk (in Strawberry Perl), it is believed that the following may be useful/helpful:

cpan -f -i Tk
Language details
Learning Perl

Strawberry Perl Support has some references, including qntm Perl guide (in English; qntm Perl refers to the guide provided in some other human-spoken languages).

...

Variable names

The following may work:

${varName}

The following may also work:

$varName

However, ${varName}str will be treated as the variable name followed by a string, whereas $varNamestr will be treated as a variable named $varNamestr. (This is really just like how Unix sh works.)

string

${varName} = "value"

Perhaps could also be written as:

$varName=value

What that will end up doing is trying to find an expression named “value”. For example, if “value” is the name of a function, then the function will run, and the phrase “value” will be replaced by the return value of the function.

However, if no such function exists, then the “value” will be treated like a string that is simply missing the quotation marks. So, the quotation marks can be optional.

Currently this is listed here, just becuase it is yet unsorted. Index of some files related to PERL for MS-DOS