12 June 2008

PERL FOR ISAPI

PerlIS

What is ISAPI?

ISAPI ("Internet Server API") is an API for writing extensions to Web servers. It complements or replaces the Common Gateway Interface (CGI), the standard interprocess protocol for writing extensions to Web servers.

ISAPI's main advantage over CGI is that it uses dynamic-link library (DLL) function calls to communicate with extension components, rather than environment variables and standard I/O, as CGI does. There's a lot of overhead in running new processes on Win32 platforms, and DLL calls obviate the need for new processes.

Although it was originally developed for Microsoft Internet Information Server, many Windows NT-hosted Web servers now support ISAPI. See question 6.1 for the names of a few. If your server isn't there, check its documentation.

What is PerlIS?

PerlIS, also known as "Perl for ISAPI", is an ISAPI extension that runs Perl scripts on Win32 platforms.

PerlIS is mainly used for creating dynamic content on World Wide Web sites. Writing Perl scripts that run under PerlIS is not much different than writing scripts for the Common Gateway Interface (CGI).

PerlIS doesn't have much general purpose use. For general purpose programming, stick with the perl interpreter (perl.exe).

Where can I get PerlIS?

PerlIS is distributed with the binary Perl for Win32 distributions (XXX-i86.zip, XXX-Alp.zip, XXX-Ppc.zip). It is *not* included in the source distribution (XXX-src.zip).

When you run install.bat, PERLIS.dll will be copied to your perl directory's bin subdirectory.

Why should I use PerlIS rather than Perl for Win32 (perl.exe)?

The short answer is: it's faster. The long answer gets kind of technical, but it goes kind of like this:

The main advantage of PerlIS over perl.exe is that PerlIS runs as a DLL in the Web server's "process space". Because Win32 platforms set up a protected "memory space" for each process that is started, there's a lot of overhead in starting a new process or program. Passing scripts to an interpreter, such as perl.exe, requires starting a new process for every script, which gets expensive in terms of system resources.

DLLs, on the other hand, don't need their own process space; they use the space of the process that calls them. They don't require nearly as much overhead to start, and once loaded they stay loaded until the calling process ends. PerlIS therefore runs Perl scripts with a lot lower turn-around time than perl.exe.

Where's the source code for PerlIS?

That's a good question. Although a layman's interpretation of the GNU General Public License or the Artistic License (the two possible licenses available for the original perl standard distribution) seems to indicate that source code for any perl-derived programs should be made publicly available, there doesn't seem to be copy of the PerlIS code available for download from ActiveWare.

0 comments:

Site owned by Hariharan | Saravanan