venerdì 1 marzo 2013

My story about using Perl

I first met Perl on a book related to Red Hat Linux 6: at the end of the book there was a few chapters about programming and deploying on Linux and one of those chapter was dedicated to Perl.
However at that time I was not interested in Perl at all and I thought Java was the only true language.
Oh poor my!
The fact is that I was a young university student and I was truly believing what teachers were telling me, and teachers were truly believing what Sun Microsystem was telling them...
A couple of years later I start being interested in Perl. The truth is I was interested in this cool scripting thing that allowed me to build up very complex programs using little pieces and combining them and, oh mama look, you don't have to compile and deal with pointers and type declarations and all other stuff that real big programs require you to focus on. And by the way, the final result is the same.
Having read something about Perl in a Linux book, as already stated, I thought that Perl was the right language for me to learn to jump out "boring" Shell scripting and do even more. Therefore I asked to my
girlfriend (err..now ex-girlfriend) to buy me the camel book for  Christmas, and she did, and so I passed my holidays reading about Perl. Ok, the Italian version of the camel book was quite horrible, due to wrong translations and formatting, and therefore I had to read it more than once to get even the simpler concepts.
In the beginning I was rejecting Perl. What the hell, why should I write something like:

print "Hello World!" if( ! $rude );

while in all the other structured C-based programming languages I know I have to write:

if( ! $rude )
  print "Hello World!";

Well, I have to admit, Perl has a quite weird syntax, and can be confusing in the beginning (this is the reason why I appreciate Python, even if I don't know it very well). However, as the camel book authors' say, you don't have to exploit every piece of the syntax and can do a baby-like programming. And so I started doing a baby-like programming. But excluding some really tiny personal projects, like file formatting and text mangling, I was not developing very much in Perl.

A few years later I was in charge of administering one University laboratory made by a few Sun Workstations.
One of my tasks was to generate a lots of accounts for all the students  attending the courses. My tutor was a Shell addicted, and therefore was using some poor-quality Shell scripts to do the job. I was a junior administrator and I was not aware of programs like pw and similar (neither was my tutor!) and therefore I wrote a quite long Perl script that did all the job including creating directories, shares, profile files
and passwords. I think this was my first real Perl program at all!

A few months later I was consulting for a factory that was using an Hylafax server to send faxes, and I was in charge of producing a report about outgoing faxes and I used Perl again to study the server logs. In a few hours I did the job!

From the above I was realizing that Perl allowed me to solve complex problems, or apparently complex problems, with a few lines of code and in a more elegant way than Shell did. And so I start using Perl for a lot of
small glue applications.

One day I even used Perl for a kind of evil aim, or better to contrast an evil task. My boss was angry with me and therefore gave me a stupid task to make me waste my time: substitute in almost one hundred source files a few strings, recompile them and deploy. Since I was forced to do it connected to a remote machine without any kind of file sharing (and therefore to use locally a powerful editor) and an X server, my boss thought this would have kept me busy for half a day. I spent half an hour writing a Perl script that did all the job for me and I spent the rest of time on the Web! Well, I have to admit, that if I knew Emacs as I know today I would have rather used it, but that was the power that Perl gave me: I was able to code what I wanted to do in a simpler manner even if I had not or did not know about the right tool to use!

At the university I was also in charge of teaching programming languages, that at that time were C and Java. I asked the professors several time to let me do even one single lesson about Perl, without success (again, I guess it was the Sun Microsistem evangelism...). And I found that Perl was rejected not only as a language to teach, but also
as a language to use: when I told my colleagues I was using Perl in my consultancy they were looking at me as I was a poor developer. I felt like they were judging me as I was not able to write an OOP program and compile it, linking and running it, and therefore I needed something simpler to write and launch. And I think this is still true here in Italy, since Perl (and to some extent even Python) is seen as something that you use only if you are unable to design a system full of objects and messages.

By the way, I was happy with Perl and continued to use it as my glue private tool.

A few years later I was in charge of developing my first Web application, and of course the tool I used was Perl. At that time CGI seemed to me the right tool to use, but of course it was not the right choice since more powerful framework like Catalyst were recommended. Anyway, the application was developed quite fastly and did what was required. Unluckily, the client decided later to rewrite the same application using Java and a client-server approach. Despite the latter, the size of the code (not its quality) was at least four times of the Perl one!

Today I would like my day to day job involves Perl, but as already stated I believe this great language is not well understood here in Italy, and therefore I have to use it again as my private glue tool.

Nessun commento: