<P>Microsoft has a port of sendmail available on their FTP site at <A href="ftp://ftp.microsoft.com/developr/drg/unix-to-windows/ports/sendmail/">ftp://ftp.microsoft.com/developr/drg/unix-to-windows/ports/sendmail/</A></P>
<P>A commercial sendmail product is available from MetaInfo, Inc. An evaluation version is
available at <A href="http://www.metainfo.com/">http://www.metainfo.com/</A></P>
<P>Another commercial mail product is wrmail, part of the slmail product from Seattle Labs. A
free version is available at <A href="http://www.seattlelab.com/">http://www.seattlelab.com/</A></P>
</DD>
</DL>
<HR>
<H2><A name="How_do_I_schedule_jobs_on_Win32_">How do I schedule jobs on Win32 platforms?</A></H2>
<P>The UNIX cron utility doesn't exist on Win32 platforms.</P>
<P>For Windows NT, a scheduling tool called <CODE>AT</CODE> is available. Unlike the UNIX cron
utility, <CODE>AT</CODE> doesn't store its schedule in a flat file, but is configured using
command-line arguments. Note the AT command seems to be very picky about syntax. Here is one
example:</P>
<PRE>
at 23:37 /interactive /every:M,T,W,Th,F,S,Su cmd /c "c:\perl\bin\perl.exe c:\test.pl"
</PRE>
<P>If you don't like the command-line version of <CODE>AT</CODE>, there's a GUI version, WinAT,
which is available with the Windows NT Resource Kit. The "Schedule" service must be
running when your job is supposed to happen.</P>
<P>Note that you may have problems when running AT or WinAT if the scheduled program or script
requires any special rights or permissions other than those held by "System" (ie, if it is
working across computers or NT domains). This is because NT does not properly allow you to run
preinstalled NT services, such as the "Schedule" service as a user with network priveleges.
It may <I>look</I> like you can set the scheduler to login as a user with network priveledges, but
the service just does not recognize that user's right's and permissions and the System userid has
only local permissions.</P>
<P>An all-Perl cron-like solution exists at <A href="http://www.megadodo.demon.co.uk/perl/">http://www.megadodo.demon.co.uk/perl/</A>
which uses a familiar Unix-like crontab file. This script can be ran as an NT Service (see <A href="#What_is_a_Windows_NT_service_">How
do I set up a Perl script as an NT Service?</A>). When you create your own NT service, NT lets you
set the useid/password pair, and these services do recognize that userid's rights and permissions.
Hence, the scheduled program or script will have the necessary rights.</P>
<P>There are a few commercial cron-like schedulers. NTcrond, is available from ifdef software: <A href="http://www.ifdef.com/">http://www.ifdef.com/</A>
and AutoTask2000 is available from <A href="http://www.cypressnet.com/">http://www.cypressnet.com/</A>.
These programs <I>should</I> recognize the rights and priveleges of the userid you set their service
to run under to enable the scheduled program or script to have the necessary rights.</P>
<P>For Windows 95, there's a System Agent available with the Microsoft Plus! Pack. Also, there are
several shareware scheduling utilities, notably LaunchPad and Metz Scheduler. These can be found on
a good shareware search engine, such as <A href="http://www.shareware.com/">http://www.shareware.com/</A>.
There is also an optional "Task Scheduler" component with IE4.01 and Windows 98.</P>
<P>Because scheduled jobs on Windows NT run as a service (see <A href="#What_is_a_Windows_NT_service_">What
is a Windows NT service?</A>), you need to take special steps to make sure that files and
environment variables are available to your script.</P>
<P>In some instances, Perl's internal <CODE>sleep</CODE> function might be an appropriate means of
scheduling. For example:</P>
<PRE>
$seconds = 180;
sub action;
while(1) {
&action;
sleep($seconds);
}
</PRE>
<P> </P>
<HR>
<H2><A name="Where_can_I_find_Win32_ports_of_">Where can I find Win32 ports of UNIX tools?</A></H2>
<P>You might want to take a look at the help file for Windows NT and Windows 95 commands to see if
there's a rough equivalent distributed with your Win32 platform. If not, try one of these URLs:</P>
<UL>
<LI>
<P>GNU-Win32 - a Win32 port of many GNU tools, as well as a complete development environment. <A href="http://www.cygnus.com/misc/gnu-win32/">http://www.cygnus.com/misc/gnu-win32/</A></P>
</LI>
<LI>
<P>Virtually Un*x! - various ports of UNIX programs for Win32. <A href="http://www.itribe.net/virtunix/">http://www.itribe.net/virtunix</A></P>
</LI>
</UL>
<P>There are also several UNIX-like tools available in the Windows NT Resource Kit. Also, there are
several UNIX-to-Win32 commercial packages available, including the MKS Toolkit from Mortice Kerns
Systems, Inc.: <A href="http://www.mks.com">http://www.mks.com/</A> and Interix from Softway
Systems: <A href="http://www.interix.com/">http://www.interix.com/</A> (the product formerly known
as OpenNT).</P>
<P>You can also check into the Perl Power Tools, being developed under the UNIX Reconstruction
Project. Here you can find UNIX tools that are being reimplemented into all Perl. You can see the
latest at <A href="http://language.perl.com/ppt/">http://language.perl.com/ppt/</A></P>
<HR>
<H2><A name="What_is_a_Windows_NT_service_">What is a Windows NT service?</A></H2>
<P>On Windows NT, a service is a special kind of executable program that runs in the background.
Services are used for programs that are constantly working, such as network protocols or database
servers. Most WWW servers on Windows NT are implemented as services.</P>
<P>A service is different from other programs in several ways:</P>
<UL>
<LI>
<P>Services aren't run interactively, although the <CODE>NET START</CODE> and <CODE>NET STOP</CODE>
commands can be used to start or stop a server. The Services control panel is used to start,
stop, or pause a service.</P>
</LI>
<LI>
<P>Services don't act with the authority of the logged-in user. That means that services can't
see user environment variables or read files that are readable only by the logged-in user. You
can set the account that a service uses in the Services control panel.</P>
</LI>
<LI>
<P>Services run even when no one is logged in to the machine.</P>
</LI>
</UL>
<P>The most important thing to remember is that you have to take special steps to make resources
available to services. In general, you need to make files available to the Everyone group, and you
have to have environment variables (like <CODE>PATH</CODE>) be system environment variables.</P>
<HR>
<H2><A name="How_do_I_run_a_Perl_script_as">How do I run a Perl script as a Windows NT Service?</A></H2>
<P>You can run your Perl scripts as Windows NT Services via a program called srvany.exe, which comes
with the Windows NT Resource Kit. Once srvany.exe is installed, read the srvany.wri file which
should be with it. This document will explain how to set up registry entries for your new service.</P>
<P>After you are set up, to run your script as a service do:</P>
<PRE>
x:>srvany perl script.pl
</PRE>
<HR>
<H2><A name="How_do_I_set_permissions_on_a_fi">How do I set permissions on a file?</A></H2>
<P>Win32 platforms don't have the same mechanisms for setting permissions on files as UNIX does. For
files on FAT partitions (which means all files in Windows 95), you don't have to set permissions
explicitly on a file. All files are available to all users.</P>
<P>For files on an NTFS partition on Windows NT, you can set the security permissions on a file
using the Explorer and the properties sheet of the file. Right-click the file in Explorer, and
choose Properties from the drop-down menu. Select the Security tab, and click Permissions to set the
Permissions on the file. Click Help for more information.</P>
<P>A command-line program, <CODE>CACLS</CODE>, will also change the permissions on a file. For more
details, type <CODE>HELP CACLS</CODE> on the command line.</P>
<P>Windows 95/98 machines that are administered using Novell can have accounts and permissions
similiar to NT. However, these permissions must be set up by the Novell administrator.</P>
<HR>
<H2><A name="How_do_I_associate_Perl_scripts_">How do I associate Perl scripts with perl?</A></H2>
<P>On Windows systems, association is the process of specifying which programs should be used for
which kind of files. Files are grouped into file types, such as JPEG files or Perl scripts. The file
type of a file is identified by its file name extension (all the letters after the last ``.'' in the
file name).</P>
<P>So, for example, we can say that there's a type of file called a text file, which has the file
extension <EM>.txt</EM>, and which is handled by the Notepad program.</P>
<P>Usually, ActivePerl programmers create a file type like Perl Script and associate the extension <EM>.pl</EM>
with that type. We specify that the perl interpreter binary, <EM>perl.exe</EM>, is responsible for
that file type. Several Web servers require that you associate your scripts with <EM>perl.exe</EM>
before the script can be run.</P>
<P>On Windows 95 and Windows NT 4.0, you can create a new file type and associate the perl
interpreter with it as follows:</P>
<OL>
<LI><STRONG><A name="item_"></A></STRONG>
<P>Open the My Computer icon on the Desktop. The My Computer window should appear.</P>
</LI>
<LI>
<P>From the View menu in the My Computer window, choose Options. The Options dialog box appears.</P>
</LI>
<LI>
<P>In the Options dialog box, select the File Types tab.</P>
</LI>
<LI>
<P>Click the New Type button. The Add New File Type dialog box appears.</P>
</LI>
<LI>
<P>In the ``Description of type'' box, type ``Perl Script''.</P>
</LI>
<LI>
<P>In the ``Associated extension'' box, type ``.pl''.</P>
</LI>
<LI>
<P>Leave the Content Type (MIME) box blank.</P>
</LI>
<LI>
<P>Click the New button beneath the Actions list. The New Action dialog box will appear.</P>
</LI>
<LI>
<P>In the Action box, type ``Open'' (it's important to use this name for the action!).</P>
</LI>
<LI>
<P>In the ``Application used to perform action'' box, type <CODE>[full path to perl]\perl.exe %1
%*</CODE>, where [full path to perl] is the full path to <EM>perl.exe</EM> on your machine. If
perl is in your path, you <EM>can</EM> put just <EM>perl.exe</EM>, but for esoteric reasons it's
better to put the full path. Also, if the path to your interpreter includes spaces (like <EM>C:\Program
Files\perl5</EM>) put in the DOS path instead (<EM>C:\progra~1\perl5</EM>).</P>
</LI>
<LI>
<P>Click OK to close the New Action dialog box.</P>
</LI>
<LI>
<P>Click OK to close the Add New File Type dialog box.</P>
</LI>
<LI>
<P>Click OK to close the Options dialog box.</P>
</LI>
</OL>
<P>You can test your association by double-clicking on a perl script in the Explorer window. If <EM>perl.exe</EM>
starts and executes the script, things are OK.</P>
<P>On Windows NT 4.0, you can avoid all the hassle of the above and just type the following from the
command line:</P>
<PRE>
ASSOC .pl=PerlScript
FTYPE PerlScript=[full path to perl]\perl.exe %1 %*
</PRE>
<P>For more information on these commands, type <CODE>HELP FTYPE</CODE> at the command prompt.</P>
<P>Note that for this to work you have to have command extensions enabled. (These are enabled by
default; you'd know if you'd turned them off.)</P>