Archive for '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 […]

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 […]

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: $ /usr/perl5/5.8.4/bin/perldoc -l Net::DNS /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/Net/DNS.pm And “-m” […]

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 […]

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: ### Import the required modules use Socket; ### Convert the IP address string to an Internet address my $ipaddr = inet_aton($index); ### Resolve the IP address to a hostname my $host = gethostbyaddr($ipaddr, […]

Printing ranges with Perl

When developing Perl scripts, it is often useful to process a range of characters or numbers. This is easily accomplished with Perl’s “..” range operator: $ perl -e ‘foreach (1 .. 10 ) { print “$_\n”; }’ 1 2 3 4 5 6 7 8 9 10 Perl seems to contain just about everything, and […]

« Older Entries