⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch1.htm

📁 美国Macmillan出版社编写的Perl教程《Perl CGI Web Pages for WINNT》
💻 HTM
📖 第 1 页 / 共 4 页
字号:
to: majordomo@mail.hip.com with this text in the body (not the

subject line) of the message:

<BLOCKQUOTE>

<PRE>

subscribe ntperl

</PRE>

</BLOCKQUOTE>

<P>

and the announcement list is joined by sending a message to:

<BLOCKQUOTE>

<PRE>

majordomo@hip.com

</PRE>

</BLOCKQUOTE>

<P>

with the message:

<BLOCKQUOTE>

<PRE>

subscribe ntperl_announce

</PRE>

</BLOCKQUOTE>

<P>

in the message body.

<H3><A NAME="SupportforPerl">

Support for Perl</A></H3>

<P>

A strong and loyal support group has developed around Perl as

it has grown in popularity. A good source of information relating

to all aspects of Perl can be found on the newsgroups already

discussed in this chapter. Larry Wall and other Perl architects

post articles regularly. Wall and the other Perl architects are

quite keen on advancing Perl's power, and they very actively try

to solve bugs and add requested features to upcoming versions

of Perl. While sending e-mail messages to Wall directly generally

gets a response, the best way to communicate your wants and needs,

or report a bug, is to post to the newsgroups listed above.

<P>

You can also access Perl gurus by sending a request to perl-users-request@virginia.edu,

where a human will send you information on how to receive the

<I>Perl</I> <I>Users</I> <I>Digest</I> which contains answers

to many questions, including several Perl scripts in every issue,

as well as the guidelines to how it works. There is also an extensive

Perl FAQ listing at <A HREF="javascript:if(confirm('http://www.perl.com/perl/faq/index.html.  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.perl.com/perl/faq/index.html.'" tppabs="http://www.perl.com/perl/faq/index.html.">http://www.perl.com/perl/faq/index.html.</A> Where

else can you get this level of customer support, especially for

something that's free?

<H2><A NAME="PerlfortheNT"><FONT SIZE=5 COLOR=#FF0000>

Perl for the NT</FONT></A></H2>

<P>

There are several considerations that need to be dealt with before

you install Perl on your system, such as the hardware and software

requirements. These considerations are outlined here, as well

as the inclusion of a security alert that will affect where you

decide to store the Perl interpreter perl.exe.

<P>

Thanks to the dedicated people at hip.com there is a wonderful

version of Perl ready for Windows NT.

<H3><A NAME="Hardware">

Hardware</A></H3>

<P>

The system requirements needed for running Perl 5.001 on Windows

NT are a Windows NT Workstation 3.5 or an Advanced Server 3.5

or later, with at least 2MB of free disk space. The recommended

amount of free space for maintaining a working Perl system is

at least 10MB. Perl for Windows NT has been constructed with Microsoft

Visual C++, version 2.0. The Windows NT Perl 5.001 source release

has included the source files and test scripts. There is also

a makefile that can be used to build Windows NT Perl 5.001 from

your Software Development Kit, or SDK, if you regularly use one.

If some of this doesn't make sense to you, don't worry, just install

Perl from the command line using install.bat. You will need at

least 15MB of free disk space to house Perl 5.001.

<H3><A NAME="Software">

Software</A></H3>

<P>

In order to use Perl, you need to be able to run either the Windows

NT 3.51 server or workstation operating system. You should have

a copy of Microsoft's Internet Information Server to make full

use of CGI functions like Server Side Includes, and an NT Web

or HTTP service like the one that comes with IIS, or the EMWAC

HTTP server. There are many other software toolkits out there

that will make your job of designing and administering a Web site

on NT easier.

<H4>Installing Perl for Windows NT</H4>

<P>

Installation instructions are also found in the INSTALL.TXT file

of Perl 5.001. A successful installation begins by starting the

install from the Perl 5.001 directory. First, run the executable

&quot;install&quot; program from the command line in MS-DOS. The

&quot;install&quot; program will add Perl-related entries to the

Registry; create the directory \perl\bin; add the file perl.exe

and then update its name to perl.{version number}.exe; add \perl\bin

to your path; and create a log of the installation events in \Perl\5.001\install.log.

Next, copy any of your own Perl scripts or libraries to the \perl\bin

directory. This should allow you to run your scripts from any

other directory.

<P>

Alternatively, you can build Windows NT Perl 5.001 from the source

release using the makefile provided. If you are using Visual C++,

start Microsoft Visual C and load Perl\5.001\src\perl.mak. You

can build both perlglob and Perl using the assigned targets that

have been predefined for your platform. If you are using SDK,

run nmake from the Perl\5.001\src directory. This builds Perl.exe

and PerlGlob.exe using the Perl\5.001\src\makefile. Perl.exe is

the actual Perl interpreter, while PerlGlob.exe is involved with

processing the regular expressions in your Perl scripts. If you

do not regularly use an SDK to install software of this nature,

please use the install.exe to put Perl on your computer.

<P>

Regardless of which installation method you use, the next step

is to test the Perl binary by running the test scripts. Go to

the directory Perl\5.001\scr\ntt and run &quot;test.&quot; This

will test the Perl installation and create a report on all the

functions tested, as well as any functions not currently in operation.

<P>

The final step, if you do not use the SDK, is to run &quot;install&quot;

again, which is in Perl\5.001. This copies perl.exe to the Perl\5.001

directory and completes the rest of the installation process as

was outlined previously. It is important to install the perl.exe

again so that any corrections made during the testing phase become

permanent.

<H4>Notes for Windows 95 Users</H4>

<P>

While Windows NT Perl 5.001 was created for Windows NT 3.51, it

should run on Windows 95. Since this was not the primary environment

for Windows NT Perl 5.001, Windows 95 has not been tested thoroughly

and has a few known bugs.

<P>

The scripts that are converted from pl2bat into batch files don't

run from the command line. The batch file uses cmd.exe, the Windows

NT command shell, to run Perl. Replacing all cmd.exe with command.com

should solve this hitch.

<P>

Win32 extensions, like Win32 Registry and OLE, might not work

properly on Windows 95 with Perl 5.001 installed.

<P>

The Perl 5.001 install program does not work on Windows 95. These

must be implemented manually. To install Perl 5.001 on Windows

95:

<OL>

<LI>Unzip the Perl 5.001 file into the directory where you want

it to reside.

<LI>Copy perl.exe, perlgolb.exe, pl2bat.bat, and mkolex.bat to

the directory where you want them to reside.

<LI>Add this key to your registry: \HKEY_LOCAL_MACHINE_\SOFTWARE\Microsoft\Resources

Kit\PERL5.

<LI>Add these values to this key:<BR>

BIN = binpath<BR>

HTML-DOCS = perlpath\docs<BR>

PRIVLIB = perlpath\lib<BR>

where binpath is typically c:\perl\bin, but can be the name of

wherever you place perl.exe and perlglob.exe. The perlpath is

typically c:\perl\5.001, but can be the name of wherever the main

Perl 5.001 package is kept. To modify your search path just add

the binpath to the head of the path.

</OL>

<H3><A NAME="UnsupportedFeaturesinWindowsNTPerl">

Unsupported Features in Windows NT Perl 5.001</A></H3>

<P>

For those of you who have worked with Perl on other platforms,

Appendix A has a list of Perl 5.001 functions that are not supported

for Windows NT. The list entitled &quot;Unsupported Routines&quot;

lists the various network routines, system V compatible IPC routines,

I/O routines, filesystem routines, process related routines, and

miscellaneous routines not included in this porting of Perl. 

<H3><A NAME="TipsonInstallingPerlforWindowsNT">

Tips on Installing Perl for Windows NT</A></H3>

<P>

To ensure quick and easy installation of Perl 5.001 on your system,

read these tips to avoid unnecessary hazards.

<OL>

<LI>Make sure that the directory has the correct permissions (for

example, Read and Execute) for the Web user accounts to be able

to access it.

<LI>To execute the script use the address of the machine and type

? at the end. For example,<BR>

<TT>http://my.www.server/scriptdir/perlscript.pl?</TT>

<LI>Make sure that when you install the PerlIIS.dll that .pl is

the extension that you ask it to use.

<LI>You can download this .dll file from <A HREF="javascript:if(confirm('http://www.perl.hip.com.you/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.perl.hip.com.you/'" tppabs="http://www.perl.hip.com.you/">http://www.perl.hip.com.

You</A> might want to install Windows NT Perl 5.001 from that site

too if you no longer have the CD-ROM that originally came with

this book.

</OL>

<P>

The first thing that you should know is once you have installed

Perl you have a choice to make. You may not want to choose, but

you have it to make anyway. To execute Perl scripts, Windows NT

has to know that it is a Perl script, and where to locate the

support files and executables that will make your Perl script

work. In traditional Perl the first line of the program is:

<BLOCKQUOTE>

<PRE>

#!/usr/bin/perl

</PRE>

</BLOCKQUOTE>

<P>

where the #! symbols are a command understood by UNIX. This command

lets UNIX know where the Perl interpreter is to be used with this

script. The single # symbol signifies a comment line in Perl.

In Windows NT Perl this does not work. Windows NT does not recognize

the #! command. To get around this you can rework any imported

Perl scripts into batch files, or you can associate the file format

of Perl files &quot;.pl&quot; to the Windows NT. Since most of

the Perl you will come across in other books and on the Internet

use the #! symbols in their first line, associating the .pl file

format will be the suggested choice in this book. The batch method

is explained later, in case batch files better fit your CGI needs.

<P>

To associate the .pl extension with perl.exe use File Manager:

<OL>

<LI>Choose the Associate command under the File menu.

<LI>Press the New Type button.

<LI>In the Change File Type dialog box, fill in the following

information: Perl as the File Type; Open as the Action; and pl

as the New Extension. Make sure you press the Add button to make

the .pl extension active.

<LI>With the Command Field put in the path to perl.exe. If you're

not sure of where it is exactly, then use the browse function.

When you are done your screen should look something like Figure

1.1.<BR>

<P>

<A HREF="f1-1.gif" tppabs="http://210.32.137.15/ebook/PC%20Magazine%20Programming%20Perl%205.0%20CGI%20Web%20Pages%20for%20Microsoft%20Windows%20NT/f1-1.gif"><B>Figure 1.1 :</B> <I>Associating the Perl file extension in Windows

NT</I>.</A>

<p>

<LI>Click OK. Then click OK again on the Associate dialog box.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -