I have hundreds of Perl scripts that
I use. Many of these scripts
process some kind of data, such as
URLs, email addresses, or paths. Historically, I would write Perl scripts that
would obtain this data from an input
file or from the keyboard. For
example, I would run an application, copy
and paste the application's resulting
data into an input file, then run a Perl
script that read from the input file.
One day, however, all this changed. I
started using the Win32::Clipboard
extension. I can't tell you why it took
so long for me to realize a better way
of providing input for my Perl scripts. I suppose all that copying and pasting
never really bothered me enough to
do something about it.
With the Win32::Clipboard
extension, the way I provide input to scripts
has changed. For example, I have one
script that formats network packets
captured by the Ethereal network
tracing program. When network traffic is
captured, all I need to do is copy a
particular packet to the Windows
Clipboard. The script continuously
monitors the Clipboard for changes.
When a change is detected, the script
retrieves the packet of data from the
Clipboard, decodes it, and formats it
so that it's legible to humans. The
script then writes the formatted data
back to the Clipboard. Therefore, with
this script, all I need to do is run
Ethereal, copy a packet to the Clipboard,
then paste the formatted results into
an email or a report. . . .

