Saturday, April 28, 2007

Module Installation(s): UPDATE

Earlier today, I emailed Dan Sully, the author of Crypt::OpenSSL::X509, with regards to the errors that I received when trying to install the module.

Well, Dan was kind enough to respond( and quickly I might add), telling me that it didn't look like my system had the OpenSSL Development libraries and headers installed.

Having recently switched to Ubuntu I have been finding out how much I truely take for granted with distro's like Suse that let you pre select the software to install. Ubuntu just installs a base system and lets you configure it from there. It is one thing that would lead a newbie to Linux to absolutely drink, but it doesn't bother me, I am just learning what the OS's needs are.

Anywho, I installed the dev libraries for OpenSSL, deleted the unpacked module from the "~/.cpan/Build" directory and did a re-installation of the module. This time, after the libraries and headers were installed, the installation went flawlessly.

I did get curious though and tried to do the same to the OpenSSL module ( even though the documentation is.... well..... less than adequate) and it failed miserably as expected. Yes, I have given up hope for that package and suggest nobody else try to install it until it gets some MAJOR updates done.

So, my thanks go out to Dan Sully for his assistance with my missing libraries and headers! Thanks Dan!

Perl Module Installation Woes and Lessons

If you have been programming in Perl for even a short time and have used modules in any of your scripts, then you more than likely have had some experience with installing the modules that you need. When you find out that you now have to learn how to install a Perl module, the first question that enters your mind is..."How?". Well, hopefully, this will help a little.

Thankfully for the lot of us, Perl modules are kept in one standard repository called CPAN(which stands for Comprehensive Perl Archive Network) and is located at cpan.org. You can use the search page on cpan in order to search for Perl modules related to your specific task.

For instance, say you are working with X509 based keys, you could search for X509 modules on CPAN. Funny, but that topic is what led me to write this post. I am working on a script that will examine X509 certificates and parse them for their expiration date, returning the certificates that expire within a certain time frame given by the user.

Upon my first searching for x509 on cpan, I came across the "OpenSSL" module, which includes a number of sub modules for dealing with different aspects of OpenSSL. One specific module is "OpenSSL::X509".

To install a perl module there are typically two routes that you can take:

1. using the command line you issue the command:

perl -MCPAN -e 'install moduleName'

replacing with the name of the module you want to install. In this case it is OpenSSL or OpenSSL::X509 to be more specific.

2. using the cpan interface. To access this, you need to type "cpan" on the command line and hit enter. This will bring you to the cpan prompt where you simply type:

cpan> install moduleName


Please be warned that with both of the above methods, if you have never run either of these, that you will need run through the initial configuration that it brings up in order to use it. The configuration has information in it, but personally, with the exception of a couple of questions, I simply took the defaults.

***Note: I am running on Ubuntu and since a lot of stuff is done using sudo, I typically use sudo at the beginning of either of the two above commands as cpan tends to install things where only Root can create items. So, it is recommended that you use it, unless your installation directory is a place you have full access to.

Now, after the cpan interface is configured, you may be warned to install the Bundle::CPAN module. This is a necessity as it has a number of updates to the different packages it comes standard with, so install it before continuing.

When installing the OpenSSL module, I ran into a whole slew of errors. After looking around for a while and not finding the files it was complaining about, I emailed the Perl Beginners mailing list with the issue to see if they could help. Well, Tom Phoenix was first to respond and informed me that modules below version 1.0 are typically considered pre-releases. That said, the module I was installing was pre-release. Not only that, look at all the documentation of your Perl module you are trying to install. The README of this module was haphazardly written with cursing and did not seem complete. I examined the README at the suggestion of Mumia W on the Perl Beginners mailing list.

All in all, the module is not even close to finished and is completely unusable. So I began a search again and came across Crypt::OpenSSL::X509, written by another author, but, ended up with the same issues and same errors. I believe it may have been written around the other one but is at an even lower version number than OpenSSL.

So, after more research and reading, I came across Crypt::X509. The module looked to be extremely well documented with examples and explanations. Not only that, it was a module specifically for parsing x509 certs. I did the install and there were no issues.

So, my lesson most important bit of advice, before actually installing a Perl module, is to do your research. Read all the associated modules in your search and try to find one that is well documented and also does almost if not exactly what you want to do. Crypt::X509 is only version 0.32, but at least it is fully functional from what I can see ( from the installation). Only coding will tell I guess.

Thanks to Tom Phoenix and Mumia W on Perl Beginners mailling list for all the input on this issue. It really helped guide me to an answer.

If you are a beginner to Perl, I highly recommend that you join the Beginner's mailing list. It is quite a handy resource!!!

Thursday, April 26, 2007

Ah yes, now I remember..... I have a blog.

Yyeeeaaahh, I have not been the most studious person this year when it comes to keeping up on my blog(s). I admit it, but if you know me, you know the insanity that I have been going through and been putting up with.

It ends up being a mixture of work, kids and generally life that are the causes, but I am dealing and doing what I have been wanting to.... update my blog.

Well, some of you may remember that I was playing with Ruby a short time ago. Well, the back burner(on an extremely low flame) is where that language headed. I found myself truely delving feet and head first into Perl. I have always had a soft spot for Perl and love the language for its power and versatility. I have always wished I could just do more with it.

Well, I finally started about 1 1/2 months ago by taking some Perl courses online that my work has. They are really good at giving you a solid base and I plan on taking that to the next level( and the next, and the next).

I will elaborate in my next post where I am going technically, right now, I must recharge. Night!!!
 
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.