FTP: Windows 95 Perl, Windows NT Perl, OS/2 Perl. OS/2 GNU EMX0.9c runtime at ftp.cdrom.com or hobbes.nmsu.edu
Newsgroups: comp.lang.perl.announce and comp.lang.perl.misc and comp.lang.perl.modules
You can take advantage of the many existing Perl libraries as well as leverage the skills of many people who are already familiar with Perl.
WebPerl's strength is that you can embed Perl inside HTML and keep your code and document together in one place for improved management and development.
You can also create stand-alone Perl modules or functions that can be grouped into packages. The advantage of this approach is that your Perl code can be shared among many HTML documents.
PowerWeb also allows you to extend its internal engine by defining API Hooks which selectively override aspects of its behaviour, such as user authentication and access control. You can write these hooks in Perl as subroutines within packages and take advantage of PowerWeb's caching of Perl modules which compiles packages the first time they are used.
Special thanks are due to Ilya Zakharevich for assisting the Power Team with the OS/2 Perl interface.
You will need to install a copy of Perl version 5.00301 or later and ensure that Perl is operating correctly on your machine.
You will need a copy of the GNU EMX runtime 0.9c or later. Perl can be run from any drive, so long as you set your LIBPATH and PATH within your config.sys, such as in the following example:
LIBPATH=p:\perl5.003.os2\emx.add\dll PATH=p:\perl5.003.os2\emx.add\bin
For Windows NT/95:
You will need to install a copy of Perl version 5.001m build 110 or later and ensure that Perl is operating correctly on your machine. It is important that you run the INSTALL program that comes with Perl, otherwise your System Registry will not be updated and some Perl facilities will not operate.
For all platforms:
You should be able to type the following from a command line and have it execute without any errors or warnings:
perl -w -e "print('Test Successful');"
PowerWeb does not need any special installation to work with Perl because it automatically configures itself correctly on startup to be able to call Perl.
The process to follow is:
<!--#script ScriptName --> Your Perl Code <!--#endscript --> <html> Your HTML text. <!--#call perl=ScriptName --> Your further HTML text. </html>
If you are using an embedded Perl script, you access this "parcel" within Perl as follows:
my($parcel) = WebPerl::GetParcel();
my($parcel) = @_;
Your Perl script is expected to return a scalar integer result indicating the success or failure of your script, according to the following table:
For example, the "Tree" function within the example package in "\powerweb\system\perl-bin\Sample.pm" can be invoked with a URL as follows:
/example/perl-bin/Sample!Tree
A benefit of using packages is that you can take advantage of Perl compiling your package on first usage for better speed on subsequent invocations.
Caching
By default, PowerWeb caches Perl, which means that often-used packages get the benefit of compilation. The disadvantage is that during development when the code within the package may change frequently, Perl remembers the package as it was originally compiled.
So for development, use the Perl Management page to switch caching off so that you always get the results of your most recent change to the package. Another benefit for developers is that when caching is off, the Perl warnings switch "-w" is enabled, which helps in debugging your Perl scripts.
An alternative is to use old-style Perl modules instead of packages. Packages have a ".pm" extension and are found by searching along the PERLLIB path, whereas Modules have a ".pl" extension and the full path must be explicitly provided. WebPerl does not compile and cache modules, so during development you can write your Perl script as a Module and then convert it to a Package when it is finalised and debugged, to obtain the extra speed. When operating like this, you can leave the Perl caching on.
If you need to change a Perl script on a production server which is using Perl caching, use the Perl Management page to reload Perl which forces a recompilation next time the package is used.
PowerWeb reserves the "perl-bin" sub-directory underneath your server root directory for storage of your Perl packages. PowerWeb is automatically configured to recognise files in that directory as Perl scripts and also automatically includes that directory on the PERLLIB search path so that Perl will find your packages.
Perl is auto-loaded and cached by PowerWeb on demand, so all but the first usage of Perl on your server will be fast.
It is generally faster to use Perl to concatenate strings before sending them to PowerWeb, instead of using the WebPerl::AppendText or WebPerl::Print functions for each sub-string.
Browser Statistics: The module "browsers.pl" in the "\powerweb\system\perl-bin" directory shows how you can analyse your user-agent log files to report statistics on browsers accessing your site. TimeZone Display Example: Under "\powerweb\system\tour", there is a document "perltime.htm" which demonstrates how Perl can be embedded within HTML to display tables with dynamic content. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script. Directory Listing Example: Under "\powerweb\system\perl-bin", there is a Perl package "sample.pm" with function "DirList" which demonstrates how Perl can be used to process HTML forms and dynamically generate Web Macro code. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script. Tree Display Example: Under "\powerweb\system\perl-bin", there is a Perl package "sample.pm" with function "Tree" which is equivalent to the C-code Guided Tour example which displays your server configuration settings in a tree format. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script.
TimeZone Display Example: Under "\powerweb\system\tour", there is a document "perltime.htm" which demonstrates how Perl can be embedded within HTML to display tables with dynamic content. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script.
Directory Listing Example: Under "\powerweb\system\perl-bin", there is a Perl package "sample.pm" with function "DirList" which demonstrates how Perl can be used to process HTML forms and dynamically generate Web Macro code. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script.
Tree Display Example: Under "\powerweb\system\perl-bin", there is a Perl package "sample.pm" with function "Tree" which is equivalent to the C-code Guided Tour example which displays your server configuration settings in a tree format. Try it! The first time you try it, you may experience a delay while Perl loads and compiles the script.
You will need to read the API Function Reference, before writing code which calls these functions.
The WebPerl Interface Function Definitions Are:
ReturnValueFunctionNameInputParameters handle WebPerl::GetConfig parcel handle WebPerl::GetServer parcel handle WebPerl::GetConnect parcel handle WebPerl::GetRequest parcel handle WebPerl::GetParameters parcel handle WebPerl::GetArguments parcel handle WebPerl::Find parent, name type WebPerl::Kind handle size WebPerl::Size handle name WebPerl::Name handle bool WebPerl::Flush handle value WebPerl::ReadInteger parent, name value WebPerl::ReadFloat parent, name value WebPerl::ReadText parent, name value WebPerl::ReadBinary parent, name bool WebPerl::WriteInteger parent, name, value bool WebPerl::WriteFloat parent, name, value bool WebPerl::WriteText parent, name, value bool WebPerl::WriteBinary parent, name, value bool WebPerl::AppendText parent, name, value bool WebPerl::AppendBinary parent, name, value bool WebPerl::Print value bool WebPerl::NewInteger parent, name, value bool WebPerl::NewFloat parent, name, value bool WebPerl::NewText parent, name, value bool WebPerl::NewBinary parent, name, value bool WebPerl::NewList parent, name bool WebPerl::NewSemaphore parent, name bool WebPerl::Delete handle handle WebPerl::Parent handle handle WebPerl::Child handle handle WebPerl::Sibling handle bool WebPerl::Interpret parcel, code error WebPerl::GetError parcel WebPerl::GetParcel name WebPerl::GetFunction