Microsoft's Win32 platforms (such as Windows
95/98 and NT) have become quite popular. The reasons behind this
depend upon how you view the industry. Some believe that Win32 is so
common because it is a good operating system. Yet others believe the
sole reason for its popularity is due to its presence on practically
every new PC being shipped. Regardless of the reason it is
uncontested that indeed more and more people are using the Win32
platform.
Along with this surge of Win32 users comes a
surge of Win32 Perl programmers. These coders are unique from most
others in the Perl community. They have been long pampered with the
Microsoft Windows GUI environment which provides clever and
convenient techniques to retrieve information. By using icons,
graphics, sounds and a host of other sense provoking resources the
ability to access programming documentation is effortless and even
enjoyable.
The documentation that exists regarding
Perl's Win32 extensions, however, is far from convenient.
Typically it includes a list of functions, the parameters they
accept, and a brief description of what each function does. But for
a Perl programmer new to Win32 or to someone new to programming in
general such limited documentation can leave him lost, confused and
frustrated. This becomes self-evident if you peruse the
Usenet's Perl forums where newbies post questions that others
bemoan about being obvious or in some obscure FAQ.
This book takes aim at this issue and
documents not only the Win32 extension's functions but explains what
they do, why the do it and goes into detail explaining what to
expect as a result of the function. For many functions there are in
depth details that give the reader not only the knowledge of how to
use the extension but also when to use them.
Back to the top
Who would benefit from this book?
This book is not really for the Perl
beginner. Someone just starting to learn the intricacies of Perl may
find this resource a bit confusing. This is not to say that
beginners should avoid it but they should understand that this book
assumes at least a rudimentary understanding of Perl. Concepts such
as regular expressions, scalar variables, hashes, arrays, modules,
extensions and others are routinely tossed around. If a beginning
Perl programmer reads this text without a good resource guide to
explain these concepts it will probably be of little use.
Just as a Perl newbie will find this book to
be a bit more than he bargained for so will someone with no Win32
background. This book assumes the user is familiar with Win32
concepts such as domains, user and group accounts, the Registry,
primary and backup domain controllers, networking and Remote Access
Services (RAS).
Keep in mind that lacking an understanding of
these concepts does not preclude anyone from reading and
appreciating this book. It simply means that the reader may need to
consult other resources to understand them. Some concepts, however,
are described because of the nature of the topic. For example the
topics of COM, OLE, ODBC and named pipes are directly related to the
way particular extensions function. Therefore a rudimentary
description of these concepts are provided to facilitate learning
how to use their respective extensions.
So there you have it. This book targets
intermediate and advanced Perl programmers who have at least a basic
understanding of Win32 platforms. These readers can be very
generally divided into five categories (for the sake of simplicity
and brevity I will address only five):
Win32 Users
Users make up the bulk of the Win32
market. Some are forced to use it at work and others use it at
home. Yet others fall into fringe categories but none the less
use the platform. Many of these people will eventually have
needs to automate processes for a variety of reasons. Maybe they
will want all temporary files deleted from the hard drive upon
boot up. Maybe some will want to automatically download a web
page every hour. Who knows what would cause a user to want to
learn Perl but indeed users are learning it.
This book explains how most of the common
Perl Win32 extensions work. While relating this information it
also explains many of the fine points that help to clarify why a
function may perform in a way that may not seem reasonable. Tips
and notes also pave the way for any user who is learning either
Win32 Perl or the Win32 platform (or both).
Win32 Administrators
Administrators have the greatest reason
to benefit from using Perl. Having been a system administrator
for WANs with thousands of users I can say without any doubt
that Perl has saved my hide too many times to count.
From simple utilities such as logon
scripts to automatic account creation scripts Perl is an
administrator's most indispensable tool. My colleagues and I
have used Perl scripts as a poor man's Systems Management
Service (SMS)--allowing me to install, update, and administrate
thousands of client and server machines across LANs, WANs,
internets and intranets.
Win32 Administrators will find this book
particularly important since it covers the most important
administration functions. Topics such as user, group and machine
management are covered as well as permissions, sending messages
and file management.
Win32 Programmers
Sure you can program some rather
sophisticated applications using C, Pascal or Visual Basic but
for quick prototyping I will bet that Perl would beat most any
language hands down. The ability to quickly and effectively slap
together a working script for a proof-of-concept project is one
of Perl's great abilities. For example I can write code that
connects to an ODBC data source, queries the database, retrieves
and processes the results faster using Perl than I can open
Microsoft Access and create a query by dragging and dropping
icons.
Any programmer will feel at home with
Perl by her side. Even if she uses another language Perl can
still be the reliable tool that saves the day. Recently I had to
walk through all the headers of one of our C++ projects picking
out error messages and their associated error code values. The
source tree was 38 megs of source code which equates to quite a
few header files. By taking 10 minutes to write a Perl script I
was able to process all header files in under 15 minutes
(including the time to write the script)!
Programmers will find this book to be a
valuable reference. Since Perl's Win32 extensions make copious
use of the Win32 API any Win32 programmer will have a better
understanding of which extension provides the best interface to
achieve a desired goal.
Win32 Webmasters
With all the hype about the Internet
webmasters have found it necessary to learn how to deal with
programming issues such as Active Server Pages (ASP), Complex
Gateway Interfaces (CGI), Data Source Names (DSN), user accounts
logging on as services, permissions, and a variety of other
issues. Of course Win32 Perl is a natural in these regards. This
book not only addresses common traps that webmasters fall into
but it explains how to avoid them.
Unix users
For our Unix brethren who have found it
necessary to migrate data or machines to the Win32 world this
book can be a life saver. Perl's Win32 extensions can ease the
migration by providing functions which are needed to make a Unix
user's pilgrimage into the Win32 landscape a bit more familiar.
This book covers topics such as scheduling batch jobs to run
(similar to CRON entries), InterProcess Communication (IPC) such
as named pipes, shortcuts (a kind of symbolic link) and
permissions in addition to user and group management.
Back to the top
How this book is structured
The way that this book is structured is a
bit of a departure from other books that cover similar topics.
It seems that most of them address Perl's Win32 extensions by
name. That is to say each chapter covers a particular
extension.
One of the biggest complaints I have
received from coders on the Internet relates to not knowing what
extension performs which function. Now consider this: if you
don't know what extension performs which function how useful is
a book that assumes you know each extension's functionality? If
you wanted to create a new user group would you intuitively know
to look up the chapter that covers Win32::NetAdmin? Or if you
needed to get a list of the CDROM drives on your computer would
you know to flip to the pages that discuss the Win32::AdminMisc
extension? Most users who have talked with me about these issues
tell me that they would have no idea.
This book addresses this problem by
designating each chapter with a programming topic. These
chapters cover a topic that a Win32 Perl programmer may find
useful from computer administration and automation to accessing
database data and interfacing directly with the Win32 API. There
are some extensions, however, that are so specific in their
functionality that they really only apply to one topic so they
end up getting a chapter all to themselves (such as the chapters
on OLE and ODBC).
The chapters break out into the following
discussions:
Chapter 1: Why Perl on Your Win32
Machine?
This chapter discusses the history of
the Win32 port of Perl. Exactly what extensions are and how
they are used. This includes an examination of the
difference between methods and functions. A discussion
regarding how to handle errors when using Perl 's Win32
extensions is also covered.
Chapter 2: Network Administration
Chapter 2 covers the basics of
network administration. This includes discussions on how to
discover the machines on your network, resolving DNS names,
managing shared resources and managing RAS
servers.
Chapter 3: Managing your Machine
Details on managing a computer are
discussed with emphasis on user and group accounts, user RAS
privileges, INI files, the Registry and Event
Logs.
Chapter 4: File Management
This chapter is all about files. Any
user who is looking for information on how to manage file
attributes and permissions would want to crack open this
chapter. Win32 shortcuts are also covered including how to
create, manage, update and assign hotkeys to them. Finally
the art of monitoring a directory for changes are
explained.
Chapter 5: OLE Automation
The ability to automate programs by
using OLE is discussed in chapter 5. Here you will learn not
only what automation is but how it works and how you can use
it to get the most out of Windows programs.
Chapter 6: Communication
Chapter 6 covers the details
surrounding Win32 communications techniques of message
sending and named pipes.
Chapter 7: Data Access
This chapter dedicates itself to
accessing databases using the Win32::ODBC extension. What
ODBC is and how your script can interact with it are what
the you can expect. Since SQL is the query language of
choice for ODBC it, too, is discussed.
Chapter 8: Processes
Process management is covered with a
emphasis on process creation. You will learn how to spawn a
new process using the various techniques.
Chapter 9: Console, Sound, and the
Win32::API Extension
This chapter covers some of the
miscellaneous tidbits that don’t seem to find a home
in the other chapters. Here a detailed discussion about
controlling consoles (AKA dos boxes), playing sound files
(in the .WAV format) and interacting with the Win32 API.
Additionally the miscellaneous functions found in the
Win32.pm module (and extension) are discussed.
Chapter 10: Writing Your Own
Extension
Whether you are writing an extension
or reading the source code for an existing extension this
chapter explains the details that make it all make sense.
Explanations of scalar variables, arrays, hashes and
references are provided. For anyone who has tried to read an
extension’s source code this chapter describes the
entire process.
Chapter 11: Common Mistakes and
Troubleshooting
This chapter describes some of the
more common problems that a programmer will run into when
using Perl’s Win32 extensions. This includes not only
extension specific problems but also CGI and ASP issues are
taken to task.
Appendix A: Extension Syntax
This appendix is a detailed reference
which illustrates the all of the functions in the extensions
which are covered in this book. Each function’s syntax
is shows along with a brief description of what it
does.
Appendix B: Win32::ODBC Specific
Tables
There have been so many requests for
Win32::ODBC constant and function details that I am
providing this information in Appendix B. Here you will find
a wealth of information regarding what functions ODBC
supports and what constants unlock the treasures that await
an ODBC user.
Appendix C: Win32 Network Error Numbers
and Their Descriptions
With the so many possible Win32
network errors this appendix provides a programmer a way to
help figure out what a network related error really
means.
Back to the top
Copyright © 1996- Roth Consulting.