<LI><A HREF="#author and copyright">AUTHOR and COPYRIGHT</A></LI>
<LI><A HREF="#history">HISTORY</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>perlopentut - tutorial on opening things in Perl</P>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Perl has two simple, built-in ways to open files: the shell way for
convenience, and the C way for precision. The choice is yours.</P>
<P>
<HR>
<H1><A NAME="open la shell">Open à la shell</A></H1>
<P>Perl's <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> function was designed to mimic the way command-line
redirection in the shell works. Here are some basic examples
from the shell:</P>
<PRE>
$ myprogram file1 file2 file3
$ myprogram < inputfile
$ myprogram > outputfile
$ myprogram >> outputfile
$ myprogram | otherprogram
$ otherprogram | myprogram</PRE>
<P>And here are some more advanced examples:</P>
<PRE>
$ otherprogram | myprogram f1 - f2
$ otherprogram 2>&1 | myprogram -
$ myprogram <&3
$ myprogram >&4</PRE>
<P>Programmers accustomed to constructs like those above can take comfort
in learning that Perl directly supports these familiar constructs using
virtually the same syntax as the shell.</P>
<P>
<H2><A NAME="simple opens">Simple Opens</A></H2>
<P>The <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> function takes two arguments: the first is a filehandle,
and the second is a single string comprising both what to open and how
to open it. <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> returns true when it works, and when it fails,
returns a false value and sets the special variable $! to reflect
the system error. If the filehandle was previously opened, it will
be implicitly closed first.</P>
<P>For example:</P>
<PRE>
open(INFO, "datafile") || die("can't open datafile: $!");
open(INFO, "< datafile") || die("can't open datafile: $!");
open(RESULTS,"> runstats") || die("can't open runstats: $!");
open(LOG, ">> logfile ") || die("can't open logfile: $!");</PRE>
<P>If you prefer the low-punctuation version, you could write that this way:</P>
<PRE>
open INFO, "< datafile" or die "can't open datafile: $!";
open RESULTS,"> runstats" or die "can't open runstats: $!";
open LOG, ">> logfile " or die "can't open logfile: $!";</PRE>
<P>A few things to notice. First, the leading less-than is optional.
If omitted, Perl assumes that you want to open the file for reading.</P>
<P>The other important thing to notice is that, just as in the shell,
any white space before or after the filename is ignored. This is good,
because you wouldn't want these to do different things:</P>
<PRE>
open INFO, "<datafile"
open INFO, "< datafile"
open INFO, "< datafile"</PRE>
<P>Ignoring surround whitespace also helps for when you read a filename in
from a different file, and forget to trim it before opening:</P>
<PRE>
$filename = <INFO>; # oops, \n still there
open(EXTRA, "< $filename") || die "can't open $filename: $!";</PRE>
<P>This is not a bug, but a feature. Because <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> mimics the shell in
its style of using redirection arrows to specify how to open the file, it
also does so with respect to extra white space around the filename itself
as well. For accessing files with naughty names, see <A HREF="#dispelling the dweomer">Dispelling the Dweomer</A>.</P>
<P>
<H2><A NAME="pipe opens">Pipe Opens</A></H2>
<P>In C, when you want to open a file using the standard I/O library,
you use the <CODE>fopen</CODE> function, but when opening a pipe, you use the
<CODE>popen</CODE> function. But in the shell, you just use a different redirection
character. That's also the case for Perl. The <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> call
remains the same--just its argument differs.</P>
<P>If the leading character is a pipe symbol, <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> starts up a new
command and open a write-only filehandle leading into that command.
This lets you write into that handle and have what you write show up on
that command's standard input. For example:</P>
<PRE>
open(PRINTER, "| lpr -Plp1") || die "cannot fork: $!";
print PRINTER "stuff\n";
close(PRINTER) || die "can't close lpr: $!";</PRE>
<P>If the trailing character is a pipe, you start up a new command and open a
read-only filehandle leading out of that command. This lets whatever that
command writes to its standard output show up on your handle for reading.
For example:</P>
<PRE>
open(NET, "netstat -i -n |") || die "cannot fork: $!";
while (<NET>) { } # do something with input
close(NET) || die "can't close netstat: $!";</PRE>
<P>What happens if you try to open a pipe to or from a non-existent command?
In most systems, such an <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> will not return an error. That's
because in the traditional <A HREF="../../lib/Pod/perlfunc.html#item_fork"><CODE>fork</CODE></A>/<A HREF="../../lib/Pod/perlfunc.html#item_exec"><CODE>exec</CODE></A> model, running the other
program happens only in the forked child process, which means that
the failed <A HREF="../../lib/Pod/perlfunc.html#item_exec"><CODE>exec</CODE></A> can't be reflected in the return value of <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A>.
Only a failed <A HREF="../../lib/Pod/perlfunc.html#item_fork"><CODE>fork</CODE></A> shows up there. See <A HREF="../../lib/Pod/perlfaq8.html#why doesn't open() return an error when a pipe open fails">Why doesn't open() return an error when a pipe open fails? in the perlfaq8 manpage</A> to see how to cope with this.
There's also an explanation in <A HREF="../../lib/Pod/perlipc.html">the perlipc manpage</A>.</P>
<P>If you would like to open a bidirectional pipe, the IPC::Open2
library will handle this for you. Check out <A HREF="../../lib/Pod/perlipc.html#bidirectional communication with another process">Bidirectional Communication with Another Process in the perlipc manpage</A></P>
<P>
<H2><A NAME="the minus file">The Minus File</A></H2>
<P>Again following the lead of the standard shell utilities, Perl's
<A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> function treats a file whose name is a single minus, ``-'', in a
special way. If you open minus for reading, it really means to access
the standard input. If you open minus for writing, it really means to
access the standard output.</P>
<P>If minus can be used as the default input or default output, what happens
if you open a pipe into or out of minus? What's the default command it
would run? The same script as you're currently running! This is actually
a stealth <A HREF="../../lib/Pod/perlfunc.html#item_fork"><CODE>fork</CODE></A> hidden inside an <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> call. See <A HREF="../../lib/Pod/perlipc.html#safe pipe opens">Safe Pipe Opens in the perlipc manpage</A> for details.</P>
<P>
<H2><A NAME="mixing reads and writes">Mixing Reads and Writes</A></H2>
<P>It is possible to specify both read and write access. All you do is
add a ``+'' symbol in front of the redirection. But as in the shell,
using a less-than on a file never creates a new file; it only opens an
existing one. On the other hand, using a greater-than always clobbers
(truncates to zero length) an existing file, or creates a brand-new one
if there isn't an old one. Adding a ``+'' for read-write doesn't affect
whether it only works on existing files or always clobbers existing ones.</P>
<PRE>
open(WTMP, "+< /usr/adm/wtmp")
|| die "can't open /usr/adm/wtmp: $!";</PRE>
<PRE>
open(SCREEN, "+> /tmp/lkscreen")
|| die "can't open /tmp/lkscreen: $!";</PRE>
<PRE>
open(LOGFILE, "+>> /tmp/applog"
|| die "can't open /tmp/applog: $!";</PRE>
<P>The first one won't create a new file, and the second one will always
clobber an old one. The third one will create a new file if necessary
and not clobber an old one, and it will allow you to read at any point
in the file, but all writes will always go to the end. In short,
the first case is substantially more common than the second and third
cases, which are almost always wrong. (If you know C, the plus in
Perl's <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> is historically derived from the one in C's fopen(3S),
which it ultimately calls.)</P>
<P>In fact, when it comes to updating a file, unless you're working on
a binary file as in the WTMP case above, you probably don't want to
use this approach for updating. Instead, Perl's <STRONG>-i</STRONG> flag comes to
the rescue. The following command takes all the C, C++, or yacc source
or header files and changes all their foo's to bar's, leaving
the old version in the original file name with a ``.orig'' tacked
<P>It's not for nothing that this is called magic <CODE><ARGV></CODE>.
Pretty nifty, eh?</P>
<P>
<HR>
<H1><A NAME="open la c">Open à la C</A></H1>
<P>If you want the convenience of the shell, then Perl's <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> is
definitely the way to go. On the other hand, if you want finer precision
than C's simplistic <CODE>fopen(3S)</CODE> provides, then you should look to Perl's
<A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A>, which is a direct hook into the <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open(2)</CODE></A> system call.
That does mean it's a bit more involved, but that's the price of
<CODE>O_NOCTTY</CODE>, <CODE>O_NDELAY</CODE> and <CODE>O_LARGEFILE</CODE>. Consult your <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open(2)</CODE></A>
manpage or its local equivalent for details. (Note: starting from
Perl release 5.6 the O_LARGEFILE flag, if available, is automatically
added to the <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen()</CODE></A> flags because large files are the the default.)</P>
<P>Here's how to use <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A> to emulate the simple <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> calls we had
before. We'll omit the <CODE>|| die $!</CODE> checks for clarity, but make sure
you always check the return values in real code. These aren't quite
the same, since <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> will trim leading and trailing white space,
but you'll get the idea:</P>
<P>To open a file for reading:</P>
<PRE>
open(FH, "< $path");
sysopen(FH, $path, O_RDONLY);</PRE>
<P>To open a file for writing, creating a new file if needed or else truncating
somefunction("&$fd"); # not an indirect function call</PRE>
<P>It can be easier (and certainly will be faster) just to use real
filehandles though:</P>
<PRE>
use IO::Socket;
local *REMOTE = IO::Socket::INET->new("www.perl.com:80");
die "can't connect" unless defined(fileno(REMOTE));
somefunction("&main::REMOTE");</PRE>
<P>If the filehandle or descriptor number is preceded not just with a simple
``&'' but rather with a ``&='' combination, then Perl will not create a
completely new descriptor opened to the same place using the <CODE>dup(2)</CODE>
system call. Instead, it will just make something of an alias to the
existing one using the <CODE>fdopen(3S)</CODE> library call This is slightly more
parsimonious of systems resources, although this is less a concern
these days. Here's an example of that:</P>
<PRE>
$fd = $ENV{"MHCONTEXTFD"};
open(MHCONTEXT, "<&=$fd") or die "couldn't fdopen $fd: $!";</PRE>
<P>If you're using magic <CODE><ARGV></CODE>, you could even pass in as a
command line argument in @ARGV something like <CODE>"<&=$MHCONTEXTFD"</CODE>,
but we've never seen anyone actually do this.</P>
<P>
<H2><A NAME="dispelling the dweomer">Dispelling the Dweomer</A></H2>
<P>Perl is more of a DWIMmer language than something like Java--where DWIM
is an acronym for ``do what I mean''. But this principle sometimes leads
to more hidden magic than one knows what to do with. In this way, Perl
is also filled with <EM>dweomer</EM>, an obscure word meaning an enchantment.
Sometimes, Perl's DWIMmer is just too much like dweomer for comfort.</P>
<P>If magic <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> is a bit too magical for you, you don't have to turn
to <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A>. To open a file with arbitrary weird characters in
it, it's necessary to protect any leading and trailing whitespace.
Leading whitespace is protected by inserting a <CODE>"./"</CODE> in front of a
filename that starts with whitespace. Trailing whitespace is protected
by appending an ASCII NUL byte (<CODE>"\0"</CODE>) at the end off the string.</P>
<PRE>
$file =~ s#^(\s)#./$1#;
open(FH, "< $file\0") || die "can't open $file: $!";</PRE>
<P>This assumes, of course, that your system considers dot the current
working directory, slash the directory separator, and disallows ASCII
NULs within a valid filename. Most systems follow these conventions,
including all POSIX systems as well as proprietary Microsoft systems.
The only vaguely popular system that doesn't work this way is the
proprietary Macintosh system, which uses a colon where the rest of us
use a slash. Maybe <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A> isn't such a bad idea after all.</P>
<P>If you want to use <CODE><ARGV></CODE> processing in a totally boring
and non-magical way, you could do this first:</P>
<PRE>
# "Sam sat on the ground and put his head in his hands.
# 'I wish I had never come here, and I don't want to see
# no more magic,' he said, and fell silent."
for (@ARGV) {
s#^([^./])#./$1#;
$_ .= "\0";
}
while (<>) {
# now process $_
}</PRE>
<P>But be warned that users will not appreciate being unable to use ``-''
to mean standard input, per the standard convention.</P>
<P>
<H2><A NAME="paths as opens">Paths as Opens</A></H2>
<P>You've probably noticed how Perl's <A HREF="../../lib/Pod/perlfunc.html#item_warn"><CODE>warn</CODE></A> and <A HREF="../../lib/Pod/perlfunc.html#item_die"><CODE>die</CODE></A> functions can
produce messages like:</P>
<PRE>
Some warning at scriptname line 29, <FH> line 7.</PRE>
<P>That's because you opened a filehandle FH, and had read in seven records
from it. But what was the name of the file, not the handle?</P>
<P>If you aren't running with <CODE>strict refs</CODE>, or if you've turn them off
temporarily, then all you have to do is this:</P>
<PRE>
open($path, "< $path") || die "can't open $path: $!";
while (<$path>) {
# whatever
}</PRE>
<P>Since you're using the pathname of the file as its handle,
you'll get warnings more like</P>
<PRE>
Some warning at scriptname line 29, </etc/motd> line 7.</PRE>
<P>These topics aren't really arguments related to <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> or <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A>,
but they do affect what you do with your open files.</P>
<P>This finds all bogus symbolic links beneath a particular directory:</P>
<PRE>
find sub { print "$File::Find::name\n" if -l && !-e }, $dir;</PRE>
<P>As you see, with symbolic links, you can just pretend that it is
what it points to. Or, if you want to know <EM>what</EM> it points to, then
<A HREF="../../lib/Pod/perlfunc.html#item_readlink"><CODE>readlink</CODE></A> is called for:</P>
<PRE>
if (-l $file) {
if (defined($whither = readlink($file))) {
print "$file points to $whither\n";
} else {
print "$file points nowhere: $!\n";
}
}</PRE>
<P>Named pipes are a different matter. You pretend they're regular files,
but their opens will normally block until there is both a reader and
a writer. You can read more about them in <A HREF="../../lib/Pod/perlipc.html#named pipes">Named Pipes in the perlipc manpage</A>.
Unix-domain sockets are rather different beasts as well; they're
described in <A HREF="../../lib/Pod/perlipc.html#unixdomain tcp clients and servers">Unix-Domain TCP Clients and Servers in the perlipc manpage</A>.</P>
<P>When it comes to opening devices, it can be easy and it can tricky.
We'll assume that if you're opening up a block device, you know what
you're doing. The character devices are more interesting. These are
typically used for modems, mice, and some kinds of printers. This is
described in <A HREF="../../lib/Pod/perlfaq8.html#how do i read and write the serial port">How do I read and write the serial port? in the perlfaq8 manpage</A>
<P>With descriptors that you haven't opened using <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A>, such as a
socket, you can set them to be non-blocking using <A HREF="../../lib/Pod/perlfunc.html#item_fcntl"><CODE>fcntl</CODE></A>:</P>
<PRE>
use Fcntl;
fcntl(Connection, F_SETFL, O_NONBLOCK)
or die "can't set non blocking: $!";</PRE>
<P>Rather than losing yourself in a morass of twisting, turning <A HREF="../../lib/Pod/perlfunc.html#item_ioctl"><CODE>ioctl</CODE></A>s,
all dissimilar, if you're going to manipulate ttys, it's best to
make calls out to the <CODE>stty(1)</CODE> program if you have it, or else use the
portable POSIX interface. To figure this all out, you'll need to read the
<CODE>termios(3)</CODE> manpage, which describes the POSIX interface to tty devices,
and then <A HREF="../../lib/POSIX.html">the POSIX manpage</A>, which describes Perl's interface to POSIX. There are
also some high-level modules on CPAN that can help you with these games.
Check out Term::ReadKey and Term::ReadLine.</P>
<P>What else can you open? To open a connection using sockets, you won't use
one of Perl's two open functions. See <A HREF="../../lib/Pod/perlipc.html#sockets: client/server communication">Sockets: Client/Server Communication in the perlipc manpage</A> for that. Here's an example. Once you have it,
you can use FH as a bidirectional filehandle.</P>
<PRE>
use IO::Socket;
local *FH = IO::Socket::INET->new("www.perl.com:80");</PRE>
<P>For opening up a URL, the LWP modules from CPAN are just what
the doctor ordered. There's no filehandle interface, but
it's still easy to get the contents of a document:</P>
<P>Now you can use <A HREF="../../lib/Pod/perlfunc.html#item_read"><CODE>read</CODE></A> and <A HREF="../../lib/Pod/perlfunc.html#item_print"><CODE>print</CODE></A> on that handle without worrying
about the system non-standard I/O library breaking your data. It's not
a pretty picture, but then, legacy systems seldom are. CP/M will be
with us until the end of days, and after.</P>
<P>On systems with exotic I/O systems, it turns out that, astonishingly
enough, even unbuffered I/O using <A HREF="../../lib/Pod/perlfunc.html#item_sysread"><CODE>sysread</CODE></A> and <A HREF="../../lib/Pod/perlfunc.html#item_syswrite"><CODE>syswrite</CODE></A> might do
sneaky data mutilation behind your back.</P>
<PRE>
while (sysread(WHENCE, $buf, 1024)) {
syswrite(WHITHER, $buf, length($buf));
}</PRE>
<P>Depending on the vicissitudes of your runtime system, even these calls
may need <A HREF="../../lib/Pod/perlfunc.html#item_binmode"><CODE>binmode</CODE></A> or <CODE>O_BINARY</CODE> first. Systems known to be free of
such difficulties include Unix, the Mac OS, Plan9, and Inferno.</P>
<P>
<H2><A NAME="file locking">File Locking</A></H2>
<P>In a multitasking environment, you may need to be careful not to collide
with other processes who want to do I/O on the same files as others
are working on. You'll often need shared or exclusive locks
on files for reading and writing respectively. You might just
pretend that only exclusive locks exist.</P>
<P>Never use the existence of a file <CODE>-e $file</CODE> as a locking indication,
because there is a race condition between the test for the existence of
the file and its creation. Atomicity is critical.</P>
<P>Perl's most portable locking interface is via the <A HREF="../../lib/Pod/perlfunc.html#item_flock"><CODE>flock</CODE></A> function,
whose simplicity is emulated on systems that don't directly support it,
such as SysV or WindowsNT. The underlying semantics may affect how
it all works, so you should learn how <A HREF="../../lib/Pod/perlfunc.html#item_flock"><CODE>flock</CODE></A> is implemented on your
system's port of Perl.</P>
<P>File locking <EM>does not</EM> lock out another process that would like to
do I/O. A file lock only locks out others trying to get a lock, not
processes trying to do I/O. Because locks are advisory, if one process
uses locking and another doesn't, all bets are off.</P>
<P>By default, the <A HREF="../../lib/Pod/perlfunc.html#item_flock"><CODE>flock</CODE></A> call will block until a lock is granted.
A request for a shared lock will be granted as soon as there is no
exclusive locker. A request for a exclusive lock will be granted as
soon as there is no locker of any kind. Locks are on file descriptors,
not file names. You can't lock a file until you open it, and you can't
hold on to a lock once the file has been closed.</P>
<P>Here's how to get a blocking shared lock on a file, typically used
for reading:</P>
<PRE>
use 5.004;
use Fcntl qw(:DEFAULT :flock);
open(FH, "< filename") or die "can't open filename: $!";
flock(FH, LOCK_SH) or die "can't lock filename: $!";
# now read from FH</PRE>
<P>You can get a non-blocking lock by using <CODE>LOCK_NB</CODE>.</P>
<PRE>
flock(FH, LOCK_SH | LOCK_NB)
or die "can't lock filename: $!";</PRE>
<P>This can be useful for producing more user-friendly behaviour by warning
if you're going to be blocking:</P>
<PRE>
use 5.004;
use Fcntl qw(:DEFAULT :flock);
open(FH, "< filename") or die "can't open filename: $!";
unless (flock(FH, LOCK_SH | LOCK_NB)) {
$| = 1;
print "Waiting for lock...";
flock(FH, LOCK_SH) or die "can't lock filename: $!";
print "got it.\n"
}
# now read from FH</PRE>
<P>To get an exclusive lock, typically used for writing, you have to be
careful. We <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A> the file so it can be locked before it gets
emptied. You can get a nonblocking version using <CODE>LOCK_EX | LOCK_NB</CODE>.</P>
<PRE>
use 5.004;
use Fcntl qw(:DEFAULT :flock);
sysopen(FH, "filename", O_WRONLY | O_CREAT)
or die "can't open filename: $!";
flock(FH, LOCK_EX)
or die "can't lock filename: $!";
truncate(FH, 0)
or die "can't truncate filename: $!";
# now write to FH</PRE>
<P>Finally, due to the uncounted millions who cannot be dissuaded from
wasting cycles on useless vanity devices called hit counters, here's
how to increment a number in a file safely:</P>
<PRE>
use Fcntl qw(:DEFAULT :flock);</PRE>
<PRE>
sysopen(FH, "numfile", O_RDWR | O_CREAT)
or die "can't open numfile: $!";
# autoflush FH
$ofh = select(FH); $| = 1; select ($ofh);
flock(FH, LOCK_EX)
or die "can't write-lock numfile: $!";</PRE>
<PRE>
$num = <FH> || 0;
seek(FH, 0, 0)
or die "can't rewind numfile : $!";
print FH $num+1, "\n"
or die "can't write numfile: $!";</PRE>
<PRE>
truncate(FH, tell(FH))
or die "can't truncate numfile: $!";
close(FH)
or die "can't close numfile: $!";</PRE>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P>The <A HREF="../../lib/Pod/perlfunc.html#item_open"><CODE>open</CODE></A> and <A HREF="../../lib/Pod/perlfunc.html#item_sysopen"><CODE>sysopen</CODE></A> function in perlfunc(1);
the standard open(2), dup(2), fopen(3), and <CODE>fdopen(3)</CODE> manpages;
the POSIX documentation.</P>
<P>
<HR>
<H1><A NAME="author and copyright">AUTHOR and COPYRIGHT</A></H1>
<P>Copyright 1998 Tom Christiansen.</P>
<P>When included as part of the Standard Version of Perl, or as part of
its complete documentation whether printed or otherwise, this work may
be distributed only under the terms of Perl's Artistic License. Any
distribution of this file or derivatives thereof outside of that
package require that special arrangements be made with copyright
holder.</P>
<P>Irrespective of its distribution, all code examples in these files are
hereby placed into the public domain. You are permitted and
encouraged to use this code in your own programs for fun or for profit
as you see fit. A simple comment in the code giving credit would be