NSA: Please Turn off the Lights When You Leave. Nothing to See Here.

Linux Advocate Dietrich Schmitz shows how the general public can take action to truly protect their privacy using GnuPG with Evolution email. Read the details.

Mailvelope for Chrome: PGP Encrypted Email Made Easy

Linux Advocate Dietrich Schmitz officially endorses what he deems is a truly secure, easy to use PGP email encryption program. Read the details.

Step off Microsoft's License Treadmill to FOSS Linux

Linux Advocate Dietrich Schmitz reminds CIOs that XP Desktops destined for MS end of life support can be reprovisioned with FOSS Linux to run like brand new. Read how.

Bitcoin is NOT Money -- it's a Commodity

Linux Advocate shares news that the U.S. Treasury will treat Bitcoin as a Commodity 'Investment'. Read the details.

Google Drive Gets a Failing Grade on Privacy Protection

Linux Advocate Dietrich Schmitz puts out a public service privacy warning. Google Drive gets a failing grade on protecting your privacy.

Email: A Fundamentally Broken System

Email needs an overhaul. Privacy must be integrated.

Opinion

Cookie Cutter Distros Don't Cut It

Opinion

The 'Linux Inside' Stigma - It's real and it's a problem.

U.S. Patent and Trademark Office Turn a Deaf Ear

Linux Advocate Dietrich Schmitz reminds readers of a long ago failed petition by Mathematician Prof. Donald Knuth for stopping issuance of Software Patents.

Showing posts with label CPAN. Show all posts
Showing posts with label CPAN. Show all posts

Sunday, October 6, 2013

Perl Does the Heavy Lifting

by Dietrich Schmitz


By metrics of late, I am an old dinosaur. You see, I cling to technology viewed by some as either falling out of use or just not good enough by their measure.


My eyebrow furrows as I read stories on programming trends and I chuckle at others with what is passed off as being genuinely novel.


The evangelicals proclaim: "A new scripting language with full Object-Oriented Programming (OOP) support for Javascript" (sigh) -- or, "We all should be using node.js." -- #facepalm. Which is not to say that my personal views should preclude the possibility that there are genuinely new programming paradigms at play, allowing each language to grow its own ecosystem. Indeed, they exist. It's just that many languages have been influenced by Perl, including Python, PHP, Ruby, ECMAScript, Javascript, and Windows PowerShell. Use the right tool for the right job but don't throw the baby out with the bathwater.

One Language for All


I do hate web programming -- mostly because it often requires knowing several languages to cobble the 'moving parts' together into a functioning website. Somehow, I feel it is a kludge. There are, of course, Model View Controller (MVC) frameworks which ease the burden of programming but still one must switch hats from html to templates to css to sql to scripting languages, both server- and client-side details. The level of effort required to get up a website varies according to requirements, scale and implementation details.

The goal of language frameworks like Google Web Toolkit (GWT) attempts to unify all coding into one language. GWT uses Java but in actuality doesn't conform to the GPLv2 with certain proprietary bindings either changed or omitted by Google. Follow-on efforts like Go and Dart are off to a slow start and their adoption depends on a Google-Apps for Business and Google-Apps-Engine centric approach. That's fine if you don't care that you've been 'roped in' by Google and want to focus on one language for everything, but if not, then such language implementations simply won't do. Enter PHP, Perl, Python with solutions all their own. What makes one better than the other can be very subjective and the degree of hair-splitting rivals the religious experience.

There are some good reasons why Perl has lasted just a little over 25 years. The struggle (or failure depending on your view) to get Perl 6 off the ground is perhaps indicative of just how dependent we are on Perl 5.x and how comprehensive a code base it has become, which continues to thrive as represented by CPAN, the Comprehensive Perl Archive Network. The name is quite appropriate and descriptive of a body of work done by thousands over the years since Perl's inception. So, to some extent, when discussion turns to 'one language for all', I prefer to think it has already been done -- Perl facilitates writing everything in a dynamic scripting application environment.

Maintainability


Undertaking any software development project, however large, requires careful planning and consideration of key factors that can make the difference between overall success and failure. chromatic at ModernPerlBooks.com wrote a story entitled Mrs. Feynman's Advice on Programming Language Popularity Contests, and distills a concise list of his project management concerns:

If we actually talked to people about what they wanted, we'd find out that they care about things like:
How easy is it to hire and/or train people in a language?
What are the deployment concerns for the language?
What are the security and support channels like?
How many programmers do you need to accomplish a task?
Is the language and its ecosystem suitable for one task or another?
Will a cancellation of the language by its primary vendor or abandonment by its single author or forking of its community have any detrimental effect on recruiting and retaining?
Does the language and its ecosystem support the desired platforms?
Will choosing this language solve more problems than it creates?

Popularity and Expressiveness


Every software development project requires finding talent. And, the degree to which programmers specialize in one language verses another varies and dictates the level to which resources are available in a given region to hire. Redmonk.com have put together their own annual analysis of programming languages and with two stories, we see to what extent the level of popularity and design integrate with two graphs shown directly below:
Redmonk Programming Language Rankings: 2013

Median-Weighted Programming Language Expressiveness

So, it becomes readily apparent that Perl is still 'in the game' as it were -- holding its own quite well despite its aged status. That speaks volumes not just about its flexibility and durability, but its enduring capabilities and true reliability. It is truly industrial strength and up to meeting the demands of small- to enterprise-scale projects.

Platform Support


Perl runs across multiple hardware platforms, including Windows, OSX, Linux, BSD Unix, IBM's AIX and other Unix dialects. It is pretty much a given that the majority of Linux Distributions will have Perl installed by default.

Vendor Support


Third party Vendor support for Perl remains strong with ongoing contributions coming from ActiveState and Strawberry Perl.

Industrial Strength Uses and Applications


So where is Perl in use? It's not just for the web.

Perl is being and has been used in places you might not have guessed -- such as Computer Chip Design, Bioinformatics, the Human Genome Project, Systems Integration, Data Warehouse ETL, EDI, and the popular Internet LAMP stack to name just a few places.

Major applications written in Perl include WebGUI, cPanel, RT, Bugzilla, TWiki, and Movable Type [Edit: Marco Vittorini was good enough to mention in a comment that DuckDuckGo's engine is written in Perl].

Websites that make use of Perl extensively include familiar names like Amazon, bbc.co.uk, Priceline.com, ImDb, Ticketmaster.com, Livejournal and Slashdot (/.). Recently, even Greg Kroah-Hartman has found Perl useful at the Linux Foundation.

Frameworks and Third-Party Tools


All of the above notwithstanding, while developers will write one-off scripts larger scale projects of increasing complexity need the leverage of pre-programmed routines referred to as 'Frameworks'. Third-Party Perl Frameworks include, Catalyst, Mojolicious, Dancer, Moose, in addition to thousands of other pre-made, tested, certified modules at CPAN. There isn't any shortage of bolt-on parts from which to resource needed functionality. This saves much man-hour time expense and reliability of CPAN's rigid testing certification process ensures bugs will be minimized in the course of program development.

Conclusion


No one programming language is a panacea. That isn't the point here. But one should not forsake a language by virtue of its age. Perl continues to broaden and grow, anneal, case harden like a fine steel Ginzu knife. Regardless of rumors of its demise, Perl remains 'alive and well', stolid, ready to serve those who avail themselves to it for many years to come.

Perl does the heavy lifting. -- Dietrich




Enhanced by Zemanta

Friday, March 15, 2013

Perl: The Language Everybody Wants to Declare Dead

by +Dietrich Schmitz

I keep looking, but I still haven't found a language that compares with Perl.  The level to which one can go with it soars above other languages with ease.  Perl will take you through a project and provide the deliverables.

It seems that many react and cringe when they hear the word Perl.  It's a funny reaction to me.  Because, all of the documentation for Perl is superb.  Writers like +Randal L. Schwartz or +Gabor Szabo will guide you with great thoughtful tutorials in their respective books and on-line websites.

My reaction to comments to the negative is that most are ill-informed and if a prospective student were to spend just two hours reading +Randal L. Schwartz's Learning Perl, they will have built a solid foundation upon which to expand their technical skill set.

Perl is found resident on most Unix, BSD, and Linux systems by default.  It often plays a large part in many 'behind the scenes' activities running on your system.  If you invest the time to learn, I would say it would not be a wasted effort as once done, Perl will be their in your toolbox for you to grasp and use on so many occasions throughout life.

Will Perl eventually die?  Some say it will.  But if you go by a recent study from RedMonks that measures the spectrum of programming languages in use on GitHub, it is evident that Perl is quite alive and well.


The RedMonk Programming Language Rankings: January 2013



Put forth the initial effort to learn Perl.  While the initial hill climb is steep, once mastered, Perl is powerful in the hands of the learned.  Perl can and does do the 'heavy lifting' in so many ways as exemplified by the CPAN repository.  CPAN is one step away  for anyone with Perl with a diverse set of open source modules ready to fill gaps in your programming needs.

Perl isn't just for writing projects; it is also good for quick 'one-off' utilitarian functions and can be quite convenient when invoked right from the Bash command line.  This one-liner upper-cases an entire text file:

$ cat sample.txt
Practical Extraction Report Language

$ perl -pi  -e “tr/[a-z]/[A-Z]/” sample.txt

$ cat sample.txt
PRACTICAL EXTRACTION REPORT LANGUAGE


Often, I visit +Gabor Szabo's excellent Perl5 Maven website to see what he is up to and come away learning something I didn't know before.  At his site you'll find his most excellent new book Perl Maven for Beginners, including in eBook downloadable format.  You can also find regular posts of his ideas and a dedicated section to tutorials especially made to coddle and encourage the newcomer to venture into this feature-rich, powerful programming language.  Here's a tutorial on reading a comma separated value (CSV) file and the requisite code:

#!/usr/bin/perl
use strict;
use warnings;
 
use Text::CSV;
 
my $file = $ARGV[0] or die "Need to get CSV file on the command line\n";
 
my $csv = Text::CSV->new ({
  binary    => 1,
  auto_diag => 1,
  sep_char  => ','    # not really needed as this is the default
});
 
my $sum = 0;
open(my $data, '<:encoding data-blogger-escaped-die="" data-blogger-escaped-fields="$csv-" data-blogger-escaped-file="" data-blogger-escaped-my="" data-blogger-escaped-n="" data-blogger-escaped-not="" data-blogger-escaped-open="" data-blogger-escaped-or="" data-blogger-escaped-ould="" data-blogger-escaped-utf8="" data-blogger-escaped-while="">getline( $data )) {
  $sum += $fields->[2];
}
if (not $csv->eof) {
  $csv->error_diag();
}
close $data;
print "$sum\n";

I can assure you from experience that for every 1 line of Perl, writing an equivalent piece of code in C will yield a ratio of 10 or more lines to accomplish same.  This is not to suggest that Perl serves to replace the venerable C language--certainly not.  But there are many applications where Perl excels and is the right tool for the job, particularly systems integration and the Internet web development.

So, please.  Make the investment.  Randal and Gabor will be there to help you.  I promise.   Learn Perl and it will be with you to serve your needs always.

-- Dietrich
Enhanced by Zemanta