Perl Scripting Language

The Perl scripting language is surely one of the most potent tools that makes automating recurring tasks possible. Perl can be enhanced to work in a lot of situations through the use of modules. There are modules for almost any task—the Comprehensive Perl Archive Network (CPAN) archive contains a huge number of modules. Table A-5 lists some examples of modules that might be useful for daily administration duties.

Module

Task

DBI

DBI is the standard database interface module for Perl. It can be enhanced with database drivers (like DBD::mysql) to connect to a variety of databases. This module is quite handy to automate tasks that involve accessing a database.

Net::DNS

This module acts as a DNS resolver. Useful for performing queries against DNS servers.

Nmap::Scanner

Performs and manipulates Nmap scans.

Net::SMTP::TLS

SMTP client that is capable of using Auth and TLS.

Sys::Filesystem

Retrieves list of filesystems and their properties.

Passwd::Linux

Manipulates /etc/passwd and /etc/shadow on Linux systems.

Curses

Creates user interfaces using the curses or ncurses library.

Proc::Daemon

Runs a Perl program as a daemon process.

Digest::MD5

Uses the MD5 algorithm within Perl; for example, a checksum calculation. Modules are also available for other algorithms, such as Digest::SHA1.

Logfile::Rotate

Rotates log files.

Sys::Syslog

Sends log messages to the local syslog daemon.

Table A-5 Some Useful Modules from CPAN

Perl features very strong abilities for working with strings and regular expressions. Therefore, you can also automate tasks that involve the parsing and editing of configuration files. Automating complex tasks (such as adding a virtual host to web server configuration or setting up user accounts) can save time and assure some level of quality. Manual system configuration has the disadvantage in that single steps of a setup process can be accidentally forgotten.

Best of all, Perl runs on a variety of platforms—ranging from various Unix derivates and free operating systems to Windows. There are even some operating-system-specific modules (such as Win32::EventLog to process Windows event logs).

Using Perl requires knowing the language and that can't be covered within the few pages of this appendix. The website (http://www.perl.org/) of the project provides a lot of resources for people new to Perl.

Was this article helpful?

0 0
The Ultimate Computer Repair Guide

The Ultimate Computer Repair Guide

Read how to maintain and repair any desktop and laptop computer. This Ebook has articles with photos and videos that show detailed step by step pc repair and maintenance procedures. There are many links to online videos that explain how you can build, maintain, speed up, clean, and repair your computer yourself. Put the money that you were going to pay the PC Tech in your own pocket.

Get My Free Ebook


Post a comment