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.

PERL AVAILABILITY AND INSTALLATION

1.1. What is Perl, and where can I get a ton of information about it?

Perl is a scripting language widely used for system administration and programming on the World Wide Web. It originated in the UNIX community and has a strong UNIX slant, but is still very useful for Win32 platforms. perl (small 'p') is the program used to interpret the Perl language.

There are several good books about Perl; consult your local technical bookstore. Two in particular to consider are _Programming_Perl_, 2nd Edition, by Larry Wall, Tom Christiansen and Randal L. Schwartz (O'Reilly & Associates, 1996) and _Learning_Perl_, by Randal L. Schwartz (O'Reilly & Associates, 1993). These are referred to by Perl enthusiasts as "the Camel book" and "the Llama book", respectively. The nicknames come from the pictures on the front covers.

If you are new to Perl, and there are any terms mentioned in this FAQ that you don't get, try one of the above resources.


1.2. What Perl interpreters are available for the Win32 platform?

The main Perl interpreter available for the Win32 platform is Perl for Win32. It was developed by ActiveWare, Inc. (originally Hip Communications) for Microsoft Corporation for inclusion in the Windows NT Resource Kit. It has since taken on a life of its own. When people talk about "Perl for Win32", it is this package that they mean.

The Perl for Win32 package includes perl, PerlIS, and several Win32-specific modules developed by ActiveWare.

A beta version of Perl for Win32, which is at the perl 5.003 level, is also available.

Another implementation is the perl port in the MKS Toolkit from Mortice Kerns Systems, Inc. (http://www.mks.com/). This is a package that includes numerous other UNIX-originated tools.

Another version is available compiled for OpenNT for Microsoft Windows NT (http://www.softway.com/OpenNT/). OpenNT is a replacement for the POSIX subsystem of Windows NT, and is produced by Softway Systems, Inc. You'll have to have OpenNT to run this version.

[Any other implementations that should be mentioned here? - ESP]


1.3. Can I build perl myself from the standard distribution source code?

The standard perl distribution is mainly geared for UNIX systems. The configuration scripts are in UNIX shell language. It is therefore not a simple task to build perl from the standard distribution.

However, it has been done. Karl Martin Syring has built perl with the GNU-Win32 development system. His port is available at:

http://www.edv.agrar.tu-muenchen.de/~syring/gnu-win32/perl.zip

To build this, you'll need GNU-Win32, which is available from Cygnus Support (http://www.cygnus.com/misc/gnu-win32).

Gary Ng has ported perl to be compiled with Microsoft Visual C++. His port is available at this address:

http://www.endcontsw.com/pub/perl_win32.zip

To build it, unzip the distribution file into a win32 subdirectory of your perl directory (from the standard distribution -- like the os2 subdirectory).


1.4. Where is the Perl for Win32 interpreter available?

The Perl for Win32 package is available as a ZIP archive by anonymous FTP from ActiveWare and from CPAN, the Comprehensive Perl Archive Network.

To download, click the download button on the toolbar above.


1.5. How do I unzip the Perl for Win32 package?

Because the Perl for Win32 package contains long file names (LFNs), normal zip file handlers like PKZip will not open them correctly. [Does the newest version of PKZip handle LFNs correctly? -ESP] You need to get a zip file opener that can work with LFNs, such as:

To extract the archive, make a new directory on your hard drive that will become your new perl directory ("C:\Program Files\perl5" and "C:\perl5" are good candidates). Extract the archive to that directory, making sure that directory names are expanded from the archive (this is crucial!). See the documentation for your unzipper for details.


1.6. How do I build Perl for Win32 from the source code package?

The source code package includes make files for Visual C++ versions 2.x and 4.x. The following instructions are for Visual C++ 4.x. [Does anyone have instructions for VC++ 2.x? How about other Win32 C++ compilers? -ESP]

The source distribution only includes Intel targets. If you're building for another platform, like DEC Alpha, you may have to fiddle with the build settings to get them to work. [Anyone done this? -ESP]

First, make sure you unzipped the archive correctly into the destination directory. Then, open the perl100.mdp project file in the dll-src subdirectory of your perl directory with Microsoft Developers Studio.

Build the "perl100 - Win32 Perl Intel DLL Release" target (Go have some lunch -- this will take a while). You'll end up with a perl100.dll file in your ntt subdirectory of your perl directory.

Now, open the perl.mdp project file in the exe-src subdirectory of your perl directory. Build the "perl - Win32 Perl Intel Release" target. You also have to build the "perl - Win32 PerlGlob Intel Release" target. These will produce perl.exe and perlglob.exe, respectively, in your ntt directory.

Optionally, you can build the extension files that come with the source distribution. These include:

  • Fcntl: Fcntl.mak in the dll-src\Ext\Fcntl directory.
  • SDBM_File: sdbm_file.mdp in the dll-src\Ext\SDBM_File directory.
  • Win32 extensions: Win32.mdp in the dll-src\Ext\Win32 directory. Consider doing a batch build of these, to save yourself some headaches.
  • Win32::NetResource: NetResource.mak in the dll-src\Ext\Win32\NetResource\ directory. For some reason, this one isn't included with all the other Win32 modules.

Note that the extensions look for perl100.lib in the dll-src\Release directory, which by default doesn't exist. You can either create the directory and copy the lib file there, or go through the build settings for the extensions and set them to point to the proper directory, dll-src\LibRel.

Building the extensions will put the extension binaries (.pll files) in the proper place in the Lib subdirectory.


1.7. OK, I've got it downloaded, unzipped, and optionally built. Now what?

The last step is running install.bat, a perl program masquerading as a batch file found in your perl directory. Running install.bat will register the perl program and PerlIS with your system, as well as copy the binary files from the ntt subdirectory to the bin subdirectory.

If you installed in a directory with long file names (like "C:\Program Files\perl5"), you may want to change directory to the DOS version of your directory (like "cd C:\PROGRA~1\perl5") before running install.bat. This ensures that you get only readable paths in your registry, and could avoid some annoying errors.


1.8. What does installing do to my registry?

Installing Perl for Win32 adds the following keys to your registry, if they don't already exist:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Resource Kit\PERL5: main registry key
  • BIN: path to the perl binaries
  • PRIVLIB: path to the library files
  • HTML-DOCS: path to the HTML documentation

The BIN and PRIVLIB values are probably used in the perl interpreter to find files for loading. The purpose of the HTML-DOCS value is unclear.

Installing also adds your perl binary path to the PATH variable for your system, as well as "." (current directory), for historical reasons.

Also, if you have Microsoft Internet Information Server (IIS) installed, install.bat will associate an extension of your choosing (.pl is the default) with PerlIS in the IIS script mapping registry key, HKEY_LOCAL_MACHINE\System\Services\W3SVC\Parameters\Script Map. See IIS documentation for more info on the script map.


1.9. How do I uninstall Perl for Win32?

You are not able to uninstall Perl for Win32 from the Add/Remove Programs section of the Control Panel (if you have such a section).

In your original perl directory, there is a file called uninstall.bat. Use this to clear out the registry settings created by install.bat.

uninstall.bat does not delete your Perl for Win32 files for you. You can do this manually with Explorer, File Manager, or "del [perl directory]\*.* /S /Q", where [perl directory] is your perl directory.


1.10. What is ActiveScripting?

Active Scripting is a new technology put out by Microsoft Corporation to allow code embedded in HTML pages to run on WWW clients or servers. It is designed to be language neutral, so that you can write Active Scripts in Visual Basic, JavaScript, Python, or, theoretically, Perl.


1.11. Is there an ActiveScripting version of Perl available?

Yes. On December 4, 1996, ActiveWare released a beta version of PerlScript, an ActiveScripting engine for the Perl language.

Download by clicking the button on the toolbar above.

You'll also need to download either the Perl for Win32 5.003 binary or source format package in the same directory.

There's no documentation to speak of, but there are several examples. ActiveScripting works a lot like OLE Automation, so if you review that documentation, plus the ActiveScripting documentation, you should be able to get along.


1.12. What other scripting languages are available for Win32 platforms?

Although it's possible to program in batch language or with QBASIC (a 16-bit BASIC interpreter that comes with Windows 95 and Windows NT), serious programmers will probably prefer one of the following other options:

Awk and UNIX shell languages are available from in several UNIX-to-NT packages. [Any others? -ESP]


1.13. Where's Perl for Win32 5.003?

On December 4, 1996, ActiveWare released a beta version of Perl for Win32 at the 5.003 level. It corrects many of the flaws of the 110 build at the 5.001m level. It's available at

ftp://ftp.activeware.com/Perl-Win32/beta/

or on CPAN at

http://www.perl.com/CPAN/ports/win32/Perl5/beta/

There are four beta packages:

  • Pw32i302.exe, the Intel x86 binary
  • Pw32302s.exe, the source distribution
  • PlSEi302.exe, the ActiveScripting PerlScript engine.
  • PlISi302.exe, the Perl for ISAPI distribution

Neither PerlIS or any of the RISC processor distributions can be found here.

Many of the answers in this FAQ do not apply to the beta version.


1.14. When I double-click on the "perl.exe" icon in Explorer, I get an empty DOS window with a blinking cursor. What gives?

Perl for Win32 is a Win32 command-line program. It expects to be run from the command line, not from Explorer.

If you want to run a Perl script, write the script out using a text editor like Notepad. A good starter program is:

    print "Hello, World!\n";
 

Save the program to a file on your hard disk (such as "C:\temp\hello.pl"). Now, start a command prompt window (sometimes erroneously called a "DOS window"), and type the following line at the command prompt:

    C:\> perl c:\temp\hello.pl
 

This should print out the words "Hello, World!" on the screen. You may have to do some fiddling with the PATH environment variable, or specify the full path name to perl.exe, in order for this to work.

perl.exe has a lot of nifty command-line arguments that can make your work a lot easier. See the perlrun documentation page for details.

To answer the original question about what's happening when you start perl from an Explorer window rather than a command-line window: starting from Explorer is roughly the same as starting perl without any command line arguments. When perl is started without a script file specified on the command line, it expects to receive a Perl program as standard input, i.e., from the keyboard.

The blinking cursor means perl is waiting for your input. You can actually type in a Perl program from the keyboard, and then let perl know to execute it by typing the Ctrl-Z key, which is the end-of-file marker on Windows systems.


1.15. When I install Perl for Win32, it says I don't have Internet Information Server, and asks if it should still install PerlIS.dll.

When I say yes, it says there was an error.  Why?

PerlIS.dll is a special interpreter for Perl. Because setting PerlIS up for Microsoft Internet Information Server (IIS) is such a pain in the keister, install.bat will do it for you automagically.

However, if you don't use IIS on the machine you're installing Perl for Win32 on, you should answer "no" when you're asked. A lot of people confuse "PerlIS.dll" that the message asks about with Perl for Win32 in general. Thus the problem.

If you get this error, ignore it. Perl programs should run just fine. If you're the kind of chucklehead who won't sleep knowing that there was an error during the installation, just run uninstall.bat, then run install.bat again, and answer "no" instead of "yes". Feel better?

If you want to use PerlIS.dll with another ISAPI-enabled Web browser, you'll have to set that up by hand. install.bat won't do it for you.

PERL AD MANAGEMENT

1) Banner Rotation
Banner Rotation is a simple and easy to use banner rotation script that can be used to rotate banners of your advertisers on your website easily and can manage them effectively.

2) AdvertPRO
AdvertPRO is a professional advertising delivery and management application capable of serving and tracking all of your online advertising endeavors

3) HTML Rotate
HTML rotate is a simple solution to randomly rotating almost anything on your web pages.

4) Easy Banner Rotating
Web based administration, unlimited advertisers, full stats - keep tracking of exposures, click-throughs and the ratio. Requires Server Side Includes (SSI).

5) Advertisement Rotation Manager
An Internet advertisement management tool including a forms based management utility. Also includes banners per page statistics.

6) ad-counter.pl
This script helps to record any hit by incrementing a counter file, then returning a hyperlinked image tag. This is useful for especially for multiple rotating ads. This cgi can be used by a file using Server Side Includes (SSI).

7) Bannermatic
This script will operate a rotating banner ad system on your website. Bannermatic comes in 3 flavors: Server-Side-Includes based, HTTP-Cookie-Powered and IP Address based. Also a banner manager script includes

8) Banner Creator
Banner Creator is an effective ad management utility which permits your web site visitors to create banners online with the required color and font for the text, speed of the animation etc.,

9) World Wide Banner Rotator
This is a very simple and easy to use banner rotation script .It is very easy to install and takes very little time and effort to install. It also allows you to add and delete banners. It requires SSI.

10) AdSpaceSeller
This is an online advertisement software that allows you to sell any space on your website for advertisers or sponsors thereby you can earn additional revenues by fixing your own price.

11) Banner Engine
This is a simple and easy to use script available online which can be used to rotate ad banners in multiple websites. It contains a web based admin interface which takes care of managing the banners on your website.

12) Ad Rotator
This script uses JavaScript to insert banners into the html and rotates any number of banners on the webpage at any spot. The script also keeps statistics on displays and clicks for each banner and provides for admin pages for listing, adding, and removing banners.

13) High Speed's Ultimate Ad Tracker
High Speed's Ultimate Ad Tracker is a simple and effective online ad tracking software written in perl. You can track ad hits through different URL's from password protected admin area.

14) ProAnalyzer Ad Tracking System
ProAnalyzer is a powerful, yet easy to use ad tracker, that can be run from your website. Capable of tracking unique hits, sales and other actions, it comes with free upgrades for life and unlimited tech support. Includes an automated set-up wizard. It is built with a split run tester.

15) AdTracker Pro
This is a complete ad tracking system that can be used for maintaining a set of rotating ad banners on your website. It keeps track of exposures and each click-thru per banner.

16) Ad Carousel
Carousel is a random ad banner script written in perl. This script allows you to use either ready-to-paste HTML code supplied by affiliates, or you can use image locations and link URL's.The HTML for each banner is written to a flatfile database and retrieved at random for display.

17) SunnyScript's AdvertisingSuite
SunnyScript's AdvertisingSuite is a top-featured advertising banner management system.

18) Ad Banners
Ad Banners is a banner management software that can be used to manage the banners and to rotate them on your website. You can view the online demo on the website.

19) Banners Pro
The professional Banner delivery system-Banners Pro is ready to help the webmasters in controlling advertisements in any websites. Banner Rotation is the main part controlled through this Banners Pro.

20) DAD
DAD is a comprehensive Web Ad Management System. DAD was originally developed for internal use at Student.Net Publishing and was released under GPL as a submission to Perl Conference 2.0 in July 1998.

21) Ad Click-Through Redirection CGI
This CGI is designed for use with ad banners. In order for you to properly calculate compensation for banners, you need to know who is clicking through them.

22) Power Ad
This is a script that helps you to setup and manage an advertisement program on your site. Along with keeping track of the number of times a particular banner has been displayed and clicked on the site, it maintains statistics about the payment schedules either daily , weekly or monthly as required.

23) Ad Master
Ad Master is a banner advertisement package. Helps you to optimize your banners

24) AdCycle
AdCycle is ad management software powered by mySQL. This script is written in perl.

25) Ad Smart
This program allows the webmasters to display their website with advertisements and earn revenue online as per cost per click(CPC) or by cost of impressions(CPM).

26) Netads
This script allows setting up of an advertisement program. In addition to keeping track of the number of times a banner is displayed, it also allows you to add, view, edit, delete, reset each banner's data easily and edit configuration file. This is an easy to install and use script.

27) LedAds
This is the second generation of Ledscripts.com's perl-based banner program. Using this one can manage the banners (add, delete, modify) and also can view the statistics of clicks on banners. You can use standard ad banners or use your own rich-media adcode.

28) Adwertise With Pleasure, AWP
This is a banner advertisement package that is easy to use and will simplify your banner campaign. It features easy installation, intuitive user/admin interfaces, no SSI required, stats, web based graphics upload, multiple expiry options, advertiser accounts, anti-caching features, templates & more.

29) Perl N' JavaScript Banners
This set of scripts allows you to run an ad banner rotation on your site. What's nice, is the rotation is done with JavaScript, which means your server doesn't have to waste cpu power on generating random banners

30) CosmicBannerRotator
Free banner rotation software to script for rotating advertisments for web pages.

31) BannerPlus Gold
BannerPlus Gold is fine ad manager software with multi-lingual interface, easy setup, free supports. The software offers many enhanced features. BannerPlus Gold is available in French, Spanish, German, Italian and Portuguese.

32) Blazing Fast Banner Rotator
Blazing Fast Banner Rotator is a program with which webmasters can display and manage ad banners on their existing websites. This program is based on PERL.

33) IntraLinks RotateAds
IntraLinks RotateAds is a simple and easy to use script that is available online to manage and rotate ad banners on your website easily. An online demo is provided on the website.

34) Ace Banner Rotator
banner rotater is packed with features, any thing you could want is here, the script can rotate HTML, groups/zones, weighting banners and loads more.

35) SimpleCycle
SimpleCycle is a simple banner management software that can be used to customize the banners to place them in each of your domains thereby increasing the traffic to your website.

36) Advertise With Pleasure! (AWP)
This is a banner advertisement package. Some of its salient features are easy installation, intuitive user and admin interfaces, no requirement of SSI, customizable output, support for many banner formats, multi-banner support, text ads exchange and many more.

37) Clicktimizer
Clicktimizer is a popup window management service. Provides a wizard driven configuration interface to provide a variety of functions.Creates popup windows on the fly,create and manage upto 5000 popup windows.

38) jbBanner
jbBanner is an Ad management system that is capable of maintaining a set of rotating banner ads on your website. It contains an advanced and secured admin interface that manages the banner ads effectively.

39) MojoBanner
MojoBanner is a feature rich banner and image management system that can be used to create, manage and publish banners and image rotations on a website. It uses MySQL as database backend.

40) BannerFusion
BannerFusion is a modular, full-featured, ad management system, design specifically for sites which demand a reliable, high-performance, easily customizable, scalable solution, at an extremely low cost

41) Banner Rotation
This is easy to setup cgi script allows to display unlimited numbers of banners on your site. Banners can be displayed randomly from a banners list.

42) CsBanner
This system allows maintenance of a set of rotating banner ads on your site. It allows creation of multiple groups and allows easy organization of the banners for rotations. You can place unlimited number of banner ads within each group.

43) Banner Serve
Banner Serve is an ad banner management script that is available in Perl for the purpose of placing your banners on remote sites. An online demo can be viewed on the website.

44) BanEx
. BanEx has been created for the average webmaster and webmistress to allow him and her to have random banners appear with links. It could be used to have have advertisers on your website, or for many other reasons...

45) vgBanners
Complete banner rotation and administration tool.

46) Stuffed Tracker
Stuffed Tracker is an useful tool for small and medium sized websites that helps them to track the return on investment for every ad banner they have placed online.

47) Amiex - text advertisement exchange script
This is a script for managing a text advertisement exchange on your website. It comes with numerous features for users as well as for the administrators.

48) InverseFlow Advertising Server
This CGI application is designed for easy integration and on-site customization of ad placements. With a set of PERL scripts using MySQL database, the application helps in displaying and tacking on unlimited sites for unlimited advertisers.

49) Linktrakker DUO
Linktrakker DUO is a perl script to manage banner campaigns.It has a user and admin interface, Add the html code into any webpage and start viewing the stats for each campaign. Easy to use.

50) Qbanner
Qbanner is a Perl+Mysql Ad-Server with support of GIP, JPG and PNG files. Provides Graphical representation of statistics.

Site owned by Hariharan | Saravanan