preload
Apr 13

This is a follow-on to my Python Connectivity Check Script that I posted a while back. It functions the same way…its just written in Perl. I use both program as part of a System Connectivity Check program I wrote in Ruby to connect to many hosts, upload one of these connectivity check programs, run it and place the results into an Excel spreadsheet with a simple red/green status. When you are installing systems with hundreds of nodes that all need to talk to 30-odd other nodes, its a huge time saver!

Here’s the code: Continue reading »

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Tagged with:
Dec 08

From time to time I need to create a utility that will work on one of my customer’s messaging systems to monitor something about it. Since Ruby isn’t on a lot of these systems (yet) I usually end up having to use Perl to create these utilities. Once nice thing about Perl is that there are lots and lots of packages out there that already do all sorts of functions. So after I have found the package that I need, I go out and see if its already on the messaging system. Since a standard Perl installation has any number of places where the package could be, I wrote this quick little Perl script to go parse through the @INC directories and print out all the package names it can find. The output can then be grep’d for the package in question quite easily.

Here’s the code:

#!/opt/perl/bin/perl
#
#  ShowLibs.pl  --  Print out all the packages in the @INC paths.
#     Useful if you want to see if a particular package is on your system or not.
#
#  John D. Allen, June 2009
#

use File::Find;

$cdir = "";
find(\&wanted, @INC);

sub wanted {
   if (/\.pm$/) {
      if ($cdir ne $File::Find::dir) {
         $cdir = $File::Find::dir;
         print "\n$cdir:\n";
      }

      open(PM, $File::Find::name);
      while(<PM>) {
         if (/^\s*package\s*(.*);/) {
            print "$1\n";
         }
      }
      close (PM);
   }
}

exit;
1;

You may need to change the first line, as my Perl home directory is not in a default location.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Tagged with: