Archive
Posts in Perl
Printing status displays in Perl scripts
While developing a Perl script this weekend to summarize Solaris zone usage, I wanted to display some type of status while my script did it's thing. My friend Clay came up with a cool way to do this, and I thought I would share it here in case others needed to do something similar. Here is the code: There may be a better way to do this (adding an additional module isn't an option), but I have yet to find it. Niiiiiice!
$ read more →Building Perl modules for Solaris
This week I needed to install a few Perl modules on a Solaris 10 host. I didn't want to download and install a fourth perl interpreter (Solaris 10 comes with 5.6.1, 5.8.3 and 5.8.4 for some reason), since Solaris 10 comes with a relatively recent version of Perl (5.8.4). To build the module in question (DBD::mysql), I downloaded the module from CPAN, verified that the MD5 checksum was correct, and used the following steps to compile the module: The 'make Makefile.PL' completed succesfully, but the make failed with the following errors: Since I was building the module with gcc, the compiler and linker got a bit confused when they were passed Sun studio compiler flags (i.e., -KPIC in this example). There are two fixes for this problem…
$ read more →Locating and printing modules with perldoc
I have recently started using perldoc to access the Perl documentation collection, and can't believe it took me this long to do so. Perldoc has a slew of nifty options, including "-l" (print the path to a Perl module) to print the full path to a given module: And "-m" (display the modules Perl code) to display the modules code and pod documentation (if it exists): If you haven't used perldoc to access the Perl documentation, I highly recommend doing so. You can get started with perldoc by running perldoc with the argument perldoc (e.g., $perldoc perldoc).
$ read more →Perl module library madness!
While reading up on website performance monitoring applications last week, I came across the cricket HTTP-performance module. HTTP-performance allows you to graph the time it takes to connect to a website and to render a page. This sounded interesting, so I decided to download and install cricket. After reading through the beginners guide, I installed all of the required Perl modules, and proceeded to run the cricket compile script: Ack…
$ read more →Resolving hostnames with Perl
I recently added name resolution support to ldap-stats.pl. This was super easy to do, and only required three lines of Perl code: Once the conversion and resolution complete, the name will be available in the $host scalar variable. Giddie up!
$ read more →