Net::SSH::Perl, Perlbrew and You

For all of the admins who threw their computer out the window and swore they would never use CPAN again when they tried to install Net::SSH::Perl, try the following two things:
1. Install the GMP library(not the perl one) apt-get install libgmp-dev
2. Use cpanm instead of cpan. i.e. cpanm Net::SSH::Perl

This should solve the following error:
GMP.xs:4:17: error: gmp.h: No such file or directory

Also, while I am talking about it, check out perlbrew. It allows you to easily set up self contained instances of perl for multiple versions and switch between them. The possible uses for this are nearly endless, but I find that it increases my “sense of adventure” when messing with perl modules and my environment since I am not affecting the system perl.

Perlbrew

Perl invocation options

I have known about perl invocation options for a while, and I have used them on several occasions. However, I’m not sure I understood just how far the rabbit hole goes.

Try the following:

perl -wnle 'print "Each line of the file is printed here $_";' foo #Process through each line.
perl -wpie 's/replace/with/g;' foo # sed -i replacement
perl -wnlae 'print $F[0]' foo # awk '{print $1}' replacement

The best part is that these go beyond just replacing existing shell commands because of all the powerful constructs that exist in perl. If you are interested in more of the same, check out the linked book. Now if you will excuse me I am going to go follow the white rabbit…

http://www.amazon.com/Minimal-Perl-UNIX-Linux-People/dp/1932394508/ref=sr_1_1?ie=UTF8&qid=1329999439&sr=8-1

I need to write more.

It occurs to me that any skill which is not practiced regularly begins to suffer. I have not put anything on this blog recently, which is a sad thing. Perhaps this is because I have not done anything tech related lately which can easily be communicated through this medium without some extra effort in either censoring sensitive data or non code related accomplishments which would only be of interest to me.

My focus in the past has been to provide a steady stream of useful information through this portal, but in the interest of further developing my communication skills that focus may need to be modified slightly. I think that instead I will endeavor to write to this blog daily regardless of whether I have used bash to cure cancer or not.

Web based fortune cookie.

For those of you who enjoy the linux fortune package I would like to present http://fortune.circulous.net. This is a project page for me to test and hone my skills as a linux sysadmin so don’t feel bad about blowing up the server with requests. At the moment, ab rates the server at ~400 requests per second.

The intended purpose of this site is to be set as a user’s home page. It automatically redirects to google after a brief time out to give the user time to read the quote.

Perl SOAP::Lite Example

Recently I was tasked with integrating systemA with systemB. Could I be more vague? Yes, probably so. Anyway, systemB is a vendor’s system which is implemented with both a SOAP and a REST API. REST is inherently easier to implement given its use of URLs. However, I chose to use SOAP, because I figured that in my field I was far more likely to encounter a vendor who only implemented SOAP than I was a vendor who only implemented REST. That decided I set off down a long and SOAPy road…

Continue reading