PERL: The Practical Extraction & Reporting Language
The
Perl language has become quite popular, especially among
those who administrate computers and networks. The
practicality and ease of use that Perl provides makes it an
indespensable tool in any administrators arsenal.
This is especially true
when it comes to Microsoft's Win32 platforms (Windows NT/2000/XP/.NET Server and Windows
95/98/ME). Since Win32 operating systems lack any decent scripting utility an
admin would have to write enormous amounts of C or Visual Basic code
to perform simple tasks. Perl simplifies all of this by providing a language rich with
text parsing capabilities, regular expressions, expanibilty, sockets for network programming,
and pretty much everything else you can imagine that you might need.
But if you step beyond just the obvious power of the Perl language itself, you'll find that
it is well supported as well. There are numerous web sites, Usenet groups, email lists and other
forums where Perl coding folk hang out and assist each other with questions, problems and troubleshooting.
Not to mention that the Perl community is one of open access. Generally speaking, when someone writes a script or module
that solves a particular problem it is usually uploaded into the Comprehensive Perl Archive Network (CPAN) for everyone
to use, extend and correct bugs. If you find yourself in need of a solution to a problem you should first look
on CPAN because someone has probably already solved it for you.
And with Windows Windows Shell Host (WSH) technology administrators can "plug in" one of
various scripting engines such as Visual Basic, JavaScript and Perl. WSH has indeed become a welcome addition
to the Win32 platform but as technologies such as WSH and Active Directory Services
Interface (ADSI) become infused to the OS so will the size and complexity grow.
Once again, this is where Perl is the undisputed champion. It is quite easy to copy Perl
from one computer to another--no need to execute some long drawn out installation process.
And since Perl can be installed as a lean mean scripting engine (you only install what you
need) it can be used on any platform.
If you are a system administrator then you really own it to yourself, your staff and your
management to install Perl. It is free and publicly available. The source code is even
available as Open Source, allowing to you examine and modify Perl's inner workings; if you are so brave.
Oh, and finally, Perl is a cross platform language. This means that if you write scripts that run on your
Win32 machines, they will also run on Linux, Unix, Macintosh, VMS and a variety of platforms!
How To Get Started
If Perl sounds good to you then you need to get started right away! The initial steps you need to follow:
- 1) Download and install Win32 Perl (aka ActivePerl) from ActiveState.com: http://www.activestate.com
- 2) Become familiar with the various Perl resources on the Internet: http://www.roth.net/perl/links
- 3) Get a good book on Perl: http://www.roth.net/books
Hint: if you have programming background you must get Programming Perl, by Larry Wall
and if you are new to programming you should get Learning Perl.
- 4) Start scripting your heart out!
Roth Consulting has been leading the charge for Win32 Perl extensions for years. We have created
a number of extensions that have given Win32 Perl coders the ability to perform tasks that other scripting
engines don't even understand.
For those of you using ActiveState's version of Perl 5.005
(aka ActivePerl) or Perl 5.005 with the PERL_OBJECT macro defined
then you can auto-download and install our extensions by using the
Perl Package Manager.
Other versions of Perl (such as ActiveState's builds up to build 500) and the core distribution without
PERL_OBJECT defined must manually download and install the extensions from
our FTP site: ftp://ftp.roth.net/pub/ntperl.
Our contributions to the Perl community include:
- GDBM_File
- We ported the GNU projects GDBM database to the Win32 platform providing the ability to offer
a Win32 port of the GDBM_File extension.
- Win32::ODBC
- A direct interface into Open DataBase Connectivity (ODBC). This extension provides access to any
database that you have an ODBC driver for.
- Win32::AdminMisc
- The most indispensable extension that an administrator can use. This fills the void of administration
functions left out of the stock Win32 Perl extensions.
This extension has been the spotlight of numerous magazine articles from such magazines as Windows
NT Sources, The Perl Journal and iX.
- Win32::API::Prototype
- One of the most useful general purpose extensions for Win32 Perl is Aldo Calpini's Win32::API extension.
It allows a Perl script to load any arbitrary dynamic link library (DLL) and call into the library's
functions. However the extension is difficult to use and can be complicated for anyone lacking
C programming experience. This is why we wrote Win32::API::Prototype. It simplifies using the Win32::API
extension by simply specifying a function's prototype.
Install it using PPM: ppm.pl install http://www.roth.net/perl/packages/win32-api-prototype.ppd.
- Win32::Daemon
- The Win32 Perl extension that provides true Win32 service support.
Using this extension a Perl script can become a native Win32 service without
requiring any stubs such as the srvany.exe program.
- Win32::EventLog::Message
- The Win32::EventLog::Message extension provides a generic message table and the functions required to register a Perl
script with the Win32 Event Log. This allow the script to submit Event Log entries that are properly
formatted when they are later viewed in the Event Log Viewer.
- Win32::Message
- Win32::Message provides a script with the functionality to send network messages to other machines. It also
manages a computer's registered network names.
- Win32::Perms
- This extension has quickly become one of our most popular ones. It gives Perl scripts the ability to
manipulate Win32 object's permissions and auditing. With this extension an administrator can modify
permissions on files, directories, Registry keys, network shares and shared printers.
- Win32::Pipe
- Win32 handles named pipes a little differently than UNIX does. This is the genesis for the Win32::Pipe
extension. It provides the capability to create named pipes as well as spawn instances of them. This can
make interprocess communication much easier.
The Win32::Pipe extension also provides a Perl script with the ability to
specify permissions and perform server side impersonation of clients.
- Win32::RasAdmin
- Remote Access Services (RAS) is what Win32 uses to allow users to dial into a domain. This can be used for
routers as well. The problem is that it is difficult to manage tens or hundreds of RAS servers. With this
extension a Perl script can programMatically manage such services quickly and efficiently.
- Win32::Tie::Ini
- Even though Microsoft wants you to use the Registry for all program settings there are times a good old
INI file just can not be beat. This extension makes managing such INI files a breeze. By tieing a hash
to an INI file you can access the contents of such files quickly and efficiently.
- Win32::Volume
- This extension is a simple interface to manage the volume of a computer's sound card.
Customized Perl Extensions
Quite often organizations have a need to access a proprietary library
or hardware device from Perl. They may need the quick prototyping that
Perl provides or the ability to quickly modify code without having all
the messy recompiling and linking that C requires. We can help.
Roth Consulting has extensive experience in creating Perl extensions
and we can use that experience to help you reach your goals.
Contact us for more details.
Camel & Llama images are trademarks of
O'Reilly & Associates, Inc. Used with permission.