Object Oriented Perl? July 12, 2008
Posted by claudio in Uncategorized.Tags: Java, OO, Perl
7 comments
I love perl. Really. This is not a post inspired by “5 things I hate about Perl“, but rather a question for the wider perl community out there (hi perlshere!). How do you write your OO perl code?
I have some code out there that follows the inside-out objects methodology of Perl Best Practices. Lately I have been writing java code, and inside-out objects feel like a lot of extra – not very intuitive – work to create your classes. I have been looking at Moose, but again it looks pretty cumbersome to create classes (constructors, named parameters for methods, returns, etc.). I am just probably missing a good howto (besides the cookbooks on cpan) or even a printed book on Moose. Any tips out there to get into Moose fast or a nice complete and intuitive alternative (extra points if it’s similar to java’s OO framework)? Thanks.
EDIT (Feb. 16th 2009): it seems I have a direct line with The Perl Foundation: a grant was approved for Dave Rolsky to work on the Moose documentation. Yannick greated a nice pdf output of the manual (see this as well).
CPAN on Ubuntu fails on bug IO/Uncompress/RawInflate.pm: solution May 30, 2008
Posted by claudio in Uncategorized.Tags: bug, cpan, GNU/Linux, Linux, Perl, Ubuntu
13 comments

apt-gettable perl modules on Ubuntu are great. A nice packager at Debian Gnu/Linux compiled the modules and included all dependencies specially for you
.
This is extremely handy when you are looking for a solution for a programming problem that you know someone else solved before. You apt-get the modules you need and have a quick try.
While doing exactly this (tryng to install HTML::TextToHTML) , I discover CPAN on Ubuntu was broken:” Can’t call method “value” on an undefined value at /usr/share/perl5/IO/Uncompress/RawInflate.pm line 64.”.
I don’t think it’s a Debian/Ubuntu problem, but rather a upstream bug. Some people have the same problem on Windows. How nice the apt-gettable modules are, there are always cases when you need to build modules not yet in the Ubuntu repositories or you need a newer version (both cases here). A non-working CPAN is not acceptable. This is what I did. (more…)
Perl tip: get fancy parameters on a command line script May 23, 2008
Posted by claudio in Uncategorized.Tags: Perl
add a comment

It is nice when your command line script has clear switches and parameters that have a long and short variant to please a different public. Have a look at this fictional example:
$ myscript.pl "config settings preferences" /var/tmp admin clean
or
$ myscript.pl --file config,settings,preferences --dir /var/tmp --user admin --clean
It’s undeniable that the last one looks more professional and less error prone. The user knows what kind of input is expected and he can type them in whatever order he/she wishes. When he/she is comfortable with your program he/she can even use a shorter notation. The program can be started like this with the same results:
An IDE for perl? May 23, 2008
Posted by claudio in Uncategorized.Tags: Perl
1 comment so far
szabgab writes (aggregated on planet.perl.org) about the absence of a decent IDE for perl. To be correct, he rather acknowledges the existence of some IDEs like Eclipse + Epic or Komodo but he prefers to work with the old trusted vi + command line.
That’s fine, but like he writes in his post, some people expect an IDE as they are used to using one while developing in other languages, specially in the Windows world. In my case, I know my way pretty well in Unix (I use it professionally and at my desktop) and vi and still, I prefer to use an IDE. Why? (more…)
Netbeans 6.1 is out && rant! April 29, 2008
Posted by claudio in Uncategorized.Tags: netbeans, Perl
add a comment
I would have never guessed that one day I’d use Netbeans and like it. Netbeans is really a great IDE for java programming and make a lot of things really easy: db connections (mysql!), GUI graphical editor (aka Matisse) for Swing applications, Webstart (deploy your *desktop* apps from a website), jar creation including jar dependencies, webservices apis (Flickr!, Google, …), subversion support, etc, etc. Really a nice product that has improved a lot.
If only Netbeans would support perl and shell scripts (very important for sysadmins), it would become – at least for me – the IDE to rule them all. For now, I use Eclipse with the epic plugin for perl development (syntax checking, factoring, context assitance, debugging …), and the shelled plugin for shell scripts. Who knows what the future will bring, but working with two IDEs is kind of suboptimal…
EDIT: by now (november 2008) Netbeans 6.5 is out with improved SQL editing, a new PHP editor and beta Python support. A nice and huge step in the right direction, but still no Perl. The support of these similar dynamic languages make it obvious that a good base for dynamic languages entered the Netbeans archticture. Hopefully an implementation Perl will next in line…
Non hexadecimal ifconfig (Solaris 8, 9 & 10) August 6, 2007
Posted by claudio in Uncategorized.Tags: Perl, Solaris, UNIX
1 comment so far
Solaris is nice, but its ifconfig is pretty annoying. It gives you an hexadecimal netmask.This gives you two choices. One learn to decipher all those f’s or write a ridiculous small wrapper script. Guess what I did. (more…)