Apache-ASP-2.63/0000755000175000017500000000000013252400404011346 5ustar jobjobApache-ASP-2.63/make_httpd/0000755000175000017500000000000013252400404013466 5ustar jobjobApache-ASP-2.63/make_httpd/build_httpds.sh0000755000175000017500000000254011721310311016507 0ustar jobjob#!/bin/bash getdir () { for file in $1* do if [ -d $file ] then GETDIR=$file echo "Found install for $1* at ./$file" return 0 fi done echo "exit build, no directory found for $1* at:" `pwd` exit } # FIND SOURCE IN LOCAL DIR echo "======================================================" getdir apache_ APACHE=$GETDIR getdir mod_ssl- MODSSL=$GETDIR getdir mod_perl- MODPERL=$GETDIR echo "======================================================" echo sleep 1 # SSL SSL_BASE=/usr/local/ssl export SSL_BASE cd $MODSSL echo echo "Configuring mod_ssl with OpenSSL at $SSL_BASE ==========================" echo sleep 1 ./configure \ --with-apache=../$APACHE # PERL cd ../$MODPERL echo echo "Building mod_perl ============================" echo sleep 1 perl Makefile.PL \ APACHE_SRC=../$APACHE/src \ NO_HTTPD=1 \ USE_APACI=1 \ PREP_HTTPD=1 \ EVERYTHING=1 make #make test make install # APACHE cd ../$APACHE echo echo "Building apache ==============================" echo sleep 1; ./configure \ --prefix=/usr/local/apache \ --activate-module=src/modules/perl/libperl.a \ --enable-module=ssl \ --enable-module=proxy \ --enable-module=so \ --enable-module=rewrite \ --disable-rule=EXPAT # --activate-module=src/modules/php4/libphp4.a \ #make certificate #make clean make make install Apache-ASP-2.63/README0000644000175000017500000104372213252377726012263 0ustar jobjobNAME Apache::ASP - Active Server Pages for Apache with mod_perl SYNOPSIS SetHandler perl-script PerlModule Apache::ASP PerlHandler Apache::ASP PerlSetVar Global /tmp/asp DESCRIPTION Apache::ASP provides an Active Server Pages port to the Apache Web Server with Perl scripting only, and enables developing of dynamic web applications with session management and embedded Perl code. There are also many powerful extensions, including XML taglibs, XSLT rendering, and new events not originally part of the ASP API! This module works under the Apache Web Server with the mod_perl module enabled. See http://www.apache.org and http://perl.apache.org for further information. This is a portable solution, similar to ActiveState's PerlScript for NT/IIS ASP. Work has been done and will continue to make ports to and from this implementation as smooth as possible. For Apache::ASP downloading and installation, please read the INSTALL section. For installation troubleshooting check the FAQ and the SUPPORT sections. For database access, ActiveX, scripting languages, and other miscellaneous issues please read the FAQ section. WEBSITE The Apache::ASP web site is at http://www.apache-asp.org/ which you can also find in the ./site directory of the source distribution. INSTALL The installation process for Apache::ASP is geared towards those with experience with Perl, Apache, and unix systems. For those without this experience, please understand that the learning curve can be significant. But what you have at the end will be a web site running on superior open source software. If installing onto a Windows operating system, please see the section titled Win32 Install. Need Help Often, installing the mod_perl part of the Apache server can be the hardest part. If this is the case for you, check out the FAQ and SUPPORT sections for further help, as well as the "Modern Linux Distributions" notes in this section. Please also see the mod_perl site at http://perl.apache.org/ which one ought to give a good read before undertaking a mod_perl project. Download and CPAN Install You may download the latest Apache::ASP from your nearest CPAN, and also: http://search.cpan.org/dist/Apache-ASP/ http://cpan.org/modules/by-module/Apache/ As a Perl developer, you should make yourself familiar with the CPAN.pm module, and how it may be used to install Apache::ASP, and other related modules. The easiest way to install Apache::ASP for the first time from Perl is to fire up the CPAN shell like: shell prompt> perl -MCPAN -e shell ... configure CPAN ... ... then upgrade to latest CPAN ... cpan> install CPAN ... cpan> install Bundle::Apache::ASP Installing the Apache::ASP bundle will automatically install all the modules Apache::ASP is dependent on as well as Apache::ASP itself. If you have trouble installing the bundle, then try installing the necessary modules one at a time: cpan> install MLDBM cpan> install MLDBM::Sync cpan> install Digest::MD5 *** may not be needed for perl 5.8+ *** cpan> install Apache::ASP For extra/optional functionality in Apache::ASP 2.31 or greater, like support for FormFill, XSLT, or SSI, you can install this bundle via CPAN: cpan> install Bundle::Apache::ASP::Extra Regular Perl Module Install If not doing the CPAN install, download Apache::ASP and install it using the make or nmake commands as shown below. Otherwise, just copy ASP.pm to $PERLLIB/site/Apache > perl Makefile.PL > make > make test > make install * use nmake for win32 Please note that you must first have the Apache Web Server & mod_perl installed before using this module in a web server environment. The offline mode for building static html at ./cgi/asp-perl may be used with just perl. Modern Linux Distributions If you have a modern Linux distribution like CentOS or Ubuntu, you will likely have the easiest path by using the repository tools to automatically install mod_perl and Apache before installing Apache::ASP via CPAN. For example for CentOS, this will install mod_perl into your apache httpd, the latter likely being installed already by default on your server: bash> sudo yum install mod_perl-devel.x86_64 For Ubuntu this would be done like this: bash> sudo apt-get install libapache2-mod-perl2 Quick Start Once you have successfully built the Apache Web Server with mod_perl, copy the ./site/eg/ directory from the Apache::ASP installation to your Apache document tree and try it out! You must put "AllowOverride All" in your httpd.conf config section to let the .htaccess file in the ./site/eg installation directory do its work. If you want a starter config file for Apache::ASP, just look at the .htaccess file in the ./site/eg/ directory. So, you might add this to your Apache httpd.conf file just to get the scripts in ./site/eg working, where $DOCUMENT_ROOT represents the DocumentRoot config for your apache server: Options FollowSymLinks AllowOverride All To copy the entire site, including the examples, you might do a raw directory copy as in: shell> cp -rpd ./site $DOCUMENT_ROOT/asp So you could then reference the Apache::ASP docs at /asp/ at your site, and the examples at /asp/eg/ . This is not a good production configuration, because it is insecure with the FollowSymLinks, and tells Apache to look for .htaccess which is bad for performance but it should be handy for getting started with development. You will know that Apache::ASP is working normally if you can run the scripts in ./site/eg/ without any errors. Common problems can be found in the FAQ section. Build static Apache and mod_perl for Apache 1.3.x For a quick build of apache, there is a script in the distribution at ./make_httpd/build_httpds.sh that can compile a statically linked Apache with mod_ssl and mod_perl. Just drop the sources into the make_httpd directory, configure the environments as appropriate, and execute the script like this: make_httpd> ./build_httpds.sh You might also find helpful a couple items: Stas's mod_perl guide install section http://perl.apache.org/guide/install.html Apache Toolbox http://www.apachetoolbox.com/ People have been using Apache Toolbox to automate their complex builds of Apache 1.3.x with great success. Win32 / Windows Install If you are on a Win32 platform, like WinNT or Windows 2000, you can download the win32 binaries linked to from: http://perl.apache.org/download/binaries.html#Win32 and install the latest perl-win32-bin-*.exe file. Randy Kobes has graciously provided these, which include compiled versions perl, mod_perl, apache, mod_ssl, as well as all the modules required by Apache::ASP and Apache::ASP itself. After installing this distribution, in Apache2\conf\perl.conf (pulled in via Apache2\conf\httpd.conf) there's directives that have Apache::ASP handle files placed under the Apache2\asp\ directory. There should be a sample Apache::ASP script there, printenv.html, accessed as http://127.0.0.1/asp/printenv.html which, if working, will print out your environment variables. WinME / 98 / 95 flock() workaround For those on desktop Windows operation systems, Apache::ASP v2.25 and later needs a special work around for the lack of flock() support on these systems. Please add this to your Apache httpd.conf to fix this problem after mod_perl is installed: *CORE::GLOBAL::flock = sub { 1 }; PerlModule Apache::ASP Please be sure to add this configuration before Apache::ASP is loaded via PerlModule, or a PerlRequire statement. CONFIG You may use a directive in your httpd.conf Apache configuration file to make Apache::ASP start ticking. Configure the optional settings if you want, the defaults are fine to get started. The settings are documented below. Make sure Global is set to where your web applications global.asa is if you have one! PerlModule Apache::ASP SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global . PerlSetVar StateDir /tmp/asp NOTE: do not use this for the examples in ./site/eg. To get the examples working, check out the Quick Start section of INSTALL You may use other Apache configuration tags like , , and , to separately define ASP configurations, but using the tag is natural for ASP application building because it lends itself naturally to mixed media per directory. For building many separate ASP sites, you might want to use separate .htaccess files, or tags in sections, the latter being better for performance. Core Global Global is the nerve center of an Apache::ASP application, in which the global.asa may reside defining the web application's event handlers. This directory is pushed onto @INC, so you will be able to "use" and "require" files in this directory, and perl modules developed for this application may be dropped into this directory, for easy use. Unless StateDir is configured, this directory must be some writeable directory by the web server. $Session and $Application object state files will be stored in this directory. If StateDir is configured, then ignore this paragraph, as it overrides the Global directory for this purpose. Includes, specified with or $Response->Include() syntax, may also be in this directory, please see section on includes for more information. PerlSetVar Global /tmp GlobalPackage Perl package namespace that all scripts, includes, & global.asa events are compiled into. By default, GlobalPackage is some obscure name that is uniquely generated from the file path of the Global directory, and global.asa file. The use of explicitly naming the GlobalPackage is to allow scripts access to globals and subs defined in a perl module that is included with commands like: in perl script: use Some::Package; in apache conf: PerlModule Some::Package PerlSetVar GlobalPackage Some::Package UniquePackages default 0. Set to 1 to compile each script into its own perl package, so that subroutines defined in one script will not collide with another. By default, ASP scripts in a web application are compiled into the *same* perl package, so these scripts, their includes, and the global.asa events all share common globals & subroutines defined by each other. The problem for some developers was that they would at times define a subroutine of the same name in 2+ scripts, and one subroutine definition would redefine the other one because of the namespace collision. PerlSetVar UniquePackages 0 DynamicIncludes default 0. SSI file includes are normally inlined in the calling script, and the text gets compiled with the script as a whole. With this option set to TRUE, file includes are compiled as a separate subroutine and called when the script is run. The advantage of having this turned on is that the code compiled from the include can be shared between scripts, which keeps the script sizes smaller in memory, and keeps compile times down. PerlSetVar DynamicIncludes 0 IncludesDir no defaults. If set, this directory will also be used to look for includes when compiling scripts. By default the directory the script is in, and the Global directory are checked for includes. This extension was added so that includes could be easily shared between ASP applications, whereas placing includes in the Global directory only allows sharing between scripts in an application. PerlSetVar IncludesDir . Also, multiple includes directories may be set by creating a directory list separated by a semicolon ';' as in PerlSetVar IncludesDir ../shared;/usr/local/asp/shared Using IncludesDir in this way creates an includes search path that would look like ., Global, ../shared, /usr/local/asp/shared The current directory of the executing script is checked first whenever an include is specified, then the Global directory in which the global.asa resides, and finally the IncludesDir setting. NoCache Default 0, if set to 1 will make it so that neither script nor include compilations are cached by the server. Using this configuration will save on memory but will slow down script execution. Please see the TUNING section for other strategies on improving site performance. PerlSetVar NoCache 0 State Management NoState default 0, if true, neither the $Application nor $Session objects will be created. Use this for a performance increase. Please note that this setting takes precedence over the AllowSessionState and AllowApplicationState settings. PerlSetVar NoState 0 AllowSessionState Set to 0 for no session tracking, 1 by default If Session tracking is turned off, performance improves, but the $Session object is inaccessible. PerlSetVar AllowSessionState 1 Note that if you want to dissallow session creation for certain non web browser user agents, like search engine spiders, you can use an init handler like: PerlInitHandler "sub { $_[0]->dir_config('AllowSessionState', 0) }" AllowApplicationState Default 1. If you want to leave $Application undefined, then set this to 0, for a performance increase of around 2-3%. Allowing use of $Application is less expensive than $Session, as there is more work for the StateManager associated with $Session garbage collection so this parameter should be only used for extreme tuning. PerlSetVar AllowApplicationState 1 StateDir default $Global/.state. State files for ASP application go to this directory. Where the state files go is the most important determinant in what makes a unique ASP application. Different configs pointing to the same StateDir are part of the same ASP application. The default has not changed since implementing this config directive. The reason for this config option is to allow operating systems with caching file systems like Solaris to specify a state directory separately from the Global directory, which contains more permanent files. This way one may point StateDir to /tmp/myaspapp, and make one's ASP application scream with speed. PerlSetVar StateDir ./.state StateManager default 10, this number specifies the numbers of times per SessionTimeout that timed out sessions are garbage collected. The bigger the number, the slower your system, but the more precise Session_OnEnd's will be run from global.asa, which occur when a timed out session is cleaned up, and the better able to withstand Session guessing hacking attempts. The lower the number, the faster a normal system will run. The defaults of 20 minutes for SessionTimeout and 10 times for StateManager, has dead Sessions being cleaned up every 2 minutes. PerlSetVar StateManager 10 StateDB default SDBM_File, this is the internal database used for state objects like $Application and $Session. Because an SDBM_File %hash has a limit on the size of a record key+value pair, usually 1024 bytes, you may want to use another tied database like DB_File or MLDBM::Sync::SDBM_File. With lightweight $Session and $Application use, you can get away with SDBM_File, but if you load it up with complex data like $Session{key} = { # very large complex object } you might max out the 1024 limit. Currently StateDB can be: SDBM_File, MLDBM::Sync::SDBM_File, DB_File, and GDBM_File. Please let me know if you would like to add any more to this list. As of version .18, you may change this setting in a live production environment, and new state databases created will be of this format. With a prior version if you switch to a new StateDB, you would want to delete the old StateDir, as there will likely be incompatibilities between the different database formats, including the way garbage collection is handled. PerlSetVar StateDB SDBM_File StateCache Deprecated as of 2.23. There is no equivalent config for the functionality this represented from that version on. The 2.23 release represented a significant rewrite of the state management, moving to MLDBM::Sync for its subsystem. StateSerializer default Data::Dumper, you may set this to Storable for faster serialization and storage of data into state objects. This is particularly useful when storing large objects in $Session and $Application, as the Storable.pm module has a faster implementation of freezing and thawing data from and to perl structures. Note that if you are storing this much data in your state databases, you may want to use DB_File since it does not have the default 1024 byte limit that SDBM_File has on key/value lengths. This configuration setting may be changed in production as the state database's serializer type is stored in the internal state manager which will always use Data::Dumper & SDBM_File to store data. PerlSetVar StateSerializer Data::Dumper Sessions CookiePath URL root that client responds to by sending the session cookie. If your asp application falls under the server url "/asp", then you would set this variable to /asp. This then allows you to run different applications on the same server, with different user sessions for each application. PerlSetVar CookiePath / CookieDomain Default 0, this NON-PORTABLE configuration will allow sessions to span multiple web sites that match the same domain root. This is useful if your web sites are hosted on the same machine and can share the same StateDir configuration, and you want to shared the $Session data across web sites. Whatever this is set to, that will add a ; domain=$CookieDomain part to the Set-Cookie: header set for the session-id cookie. PerlSetVar CookieDomain .your.global.domain SessionTimeout Default 20 minutes, when a user's session has been inactive for this period of time, the Session_OnEnd event is run, if defined, for that session, and the contents of that session are destroyed. PerlSetVar SessionTimeout 20 SecureSession default 0. Sets the secure tag for the session cookie, so that the cookie will only be transmitted by the browser under https transmissions. PerlSetVar SecureSession 1 HTTPOnlySession default 0. Sets HttpOnly flag to session cookie to mitigate XSS attacks. Supported by most modern browsers, it only allows access to the session cookie by the server (ie NOT Javascript) PerlSetVar HTTPOnlySession 1 ParanoidSession default 0. When true, stores the user-agent header of the browser that creates the session and validates this against the session cookie presented. If this check fails, the session is killed, with the rationale that there is a hacking attempt underway. This config option was implemented to be a smooth upgrade, as you can turn it off and on, without disrupting current sessions. Sessions must be created with this turned on for the security to take effect. This config option is to help prevent a brute force cookie search from being successful. The number of possible cookies is huge, 2^128, thus making such a hacking attempt VERY unlikely. However, on the off chance that such an attack is successful, the hacker must also present identical browser headers to authenticate the session, or the session will be destroyed. Thus the User-Agent acts as a backup to the real session id. The IP address of the browser cannot be used, since because of proxies, IP addresses may change between requests during a session. There are a few browsers that will not present a User-Agent header. These browsers are considered to be browsers of type "Unknown", and this method works the same way for them. Most people agree that this level of security is unnecessary, thus it is titled paranoid :) PerlSetVar ParanoidSession 0 SessionSerialize default 0, if true, locks $Session for duration of script, which serializes requests to the $Session object. Only one script at a time may run, per user $Session, with sessions allowed. Serialized requests to the session object is the Microsoft ASP way, but is dangerous in a production environment, where there is risk of long-running or run-away processes. If these things happen, a session may be locked for an indefinite period of time. A user STOP button should safely quit the session however. PerlSetVar SessionSerialize 0 SessionCount default 0, if true enables the $Application->SessionCount API which returns how many sessions are currently active in the application. This config was created because there is a performance hit associated with this count tracking, so it is disabled by default. PerlSetVar SessionCount 1 Cookieless Sessions SessionQueryParse default 0, if true, will automatically parse the $Session session id into the query string of each local URL found in the $Response buffer. For this setting to work therefore, buffering must be enabled. This parsing will only occur when a session cookie has not been sent by a browser, so the first script of a session enabled site, and scripts viewed by web browsers that have cookies disabled will trigger this behavior. Although this runtime parsing method is computationally expensive, this cost should be amortized across most users that will not need this URL parsing. This is a lazy programmer's dream. For something more efficient, look at the SessionQuery setting. For more information about this solution, please read the SESSIONS section. PerlSetVar SessionQueryParse 0 SessionQueryParseMatch default 0, set to a regexp pattern that matches all URLs that you want to have SessionQueryParse parse in session ids. By default SessionQueryParse only modifies local URLs, but if you name your URLs of your site with absolute URLs like http://localhost then you will need to use this setting. So to match http://localhost URLs, you might set this pattern to ^http://localhost. Note that by setting this config, you are also setting SessionQueryParse. PerlSetVar SessionQueryParseMatch ^https?://localhost SessionQuery default 0, if set, the session id will be initialized from the $Request->QueryString if not first found as a cookie. You can use this setting coupled with the $Server->URL($url, \%params) API extension to generate local URLs with session ids in their query strings, for efficient cookieless session support. Note that if a browser has cookies disabled, every URL to any page that needs access to $Session will need to be created by this method, unless you are using SessionQueryParse which will do this for you automatically. PerlSetVar SessionQuery 0 SessionQueryMatch default 0, set to a regexp pattern that will match URLs for $Server->URL() to add a session id to. SessionQuery normally allows $Server->URL() to add session ids just to local URLs, so if you use absolute URL references like http://localhost/ for your web site, then just like with SessionQueryParseMatch, you might set this pattern to ^http://localhost If this is set, then you don't need to set SessionQuery, as it will be set automatically. PerlSetVar SessionQueryMatch ^http://localhost SessionQueryForce default 0, set to 1 if you want to disallow the use of cookies for session id passing, and only allow session ids to be passed on the query string via SessionQuery and SessionQueryParse settings. PerlSetVar SessionQueryForce 1 Developer Environment UseStrict default 0, if set to 1, will compile all scripts, global.asa and includes with "use strict;" inserted at the head of the file, saving you from the painful process of strictifying code that was not strict to begin with. Because of how essential "use strict" programming is in a mod_perl environment, this default might be set to 1 one day, but this will be up for discussion before that decision is made. Note too that errors triggered by "use strict" are now captured as part of the normal Apache::ASP error handling when this configuration is set, otherwise "use strict" errors will not be handled properly, so using UseStrict is better than your own "use strict" statements. PerlSetVar UseStrict 1 Debug 1 for server log debugging, 2 for extra client html output, 3 for microtimes logged. Use 1 for production debugging, use 2 or 3 for development. Turn off if you are not debugging. These settings activate $Response->Debug(). PerlSetVar Debug 2 If Debug 3 is set and Time::HiRes is installed, microtimes will show up in the log, and also calculate the time between one $Response->Debug() and another, so good for a quick benchmark when you glance at the logs. PerlSetVar Debug 3 If you would like to enable system level debugging, set Debug to a negative value. So for system level debugging, but no output to browser: PerlSetVar Debug -1 DebugBufferLength Default 100, set this to the number of bytes of the buffered output's tail you want to see when an error occurs and Debug 2 or MailErrorsTo is set, and when BufferingOn is enabled. With buffering the script output will not naturally show up when the script errors, as it has been buffered by the $Response object. It helps to see where in the script output an error halted the script, so the last bytes of the buffered output are included with the rest of the debugging information. For a demo of this functionality, try the ./site/eg/syntax_error.asp script, and turn buffering on. PodComments default 1. With pod comments turned on, perl pod style comments and documentation are parsed out of scripts at compile time. This make for great documentation and a nice debugging tool, and it lets you comment out perl code and html in blocks. Specifically text like this: =pod text or perl code here =cut will get ripped out of the script before compiling. The =pod and =cut perl directives must be at the beginning of the line, and must be followed by the end of the line. PerlSetVar PodComments 1 CollectionItem Enables PerlScript syntax like: $Request->Form('var')->Item; $Request->Form('var')->Item(1); $Request->Form('var')->Count; Old PerlScript syntax, enabled with use Win32::OLE qw(in valof with OVERLOAD); is like native syntax $Request->Form('var'); Only in Apache::ASP, can the above be written as: $Request->{Form}{var}; which you would do if you _really_ needed the speed. XML / XSLT XMLSubsMatch default not defined, set to some regexp pattern that will match all XML and HTML tags that you want to have perl subroutines handle. The is Apache::ASP's custom tag technology, and can be used to create powerful extensions to your XML and HTML rendering. Please see XML/XSLT section for instructions on its use. PerlSetVar XMLSubsMatch my:[\w\-]+ XMLSubsStrict default 0, when set XMLSubs will only take arguments that are properly formed XML tag arguments like: By default, XMLSubs accept arbitrary perl code as argument values: which is not always wanted or expected. Set XMLSubsStrict to 1 if this is the case. PerlSetVar XMLSubsStrict 1 XMLSubsPerlArgs default 1, when set attribute values will be interpreted as raw perl code so that these all would execute as one would expect: With the 2.45 release, 0 may be set for this configuration or a more ASP style variable interpolation: This configuration is being introduced experimentally in version 2.45, as it will become the eventual default in the 3.0 release. PerlSetVar XMLSubsPerlArgs Off XSLT default not defined, if set to a file, ASP scripts will be regarded as XML output and transformed with the given XSL file with XML::XSLT. This XSL file will also be executed as an ASP script first, and its output will be the XSL data used for the transformation. This XSL file will be executed as a dynamic include, so may be located in the current directory, Global, or IncludesDir. Please see the XML/XSLT section for an explanation of its use. PerlSetVar XSLT template.xsl XSLTMatch default .*, if XSLT is set by default all ASP scripts will be XSL transformed by the specified XSL template. This regexp setting will tell XSLT which file names to match with doing XSL transformations, so that regular HTML ASP scripts and XML ASP scripts can be configured with the same configuration block. Please see ./site/eg/.htaccess for an example of its use. PerlSetVar XSLTMatch \.xml$ XSLTParser default XML::XSLT, determines which perl module to use for XSLT parsing. This is a new config as of 2.11. Also supported is XML::Sablotron which does not handle XSLT with the exact same output, but is about 10 times faster than XML::XSLT. XML::LibXSLT may also be used as of version 2.29, and seems to be about twice again as fast as XML::Sablotron, and a very complete XSLT implementation. PerlSetVar XSLTParser XML::XSLT PerlSetVar XSLTParser XML::Sablotron PerlSetVar XSLTParser XML::LibXSLT XSLTCache Activate XSLT file based caching through CacheDB, CacheDir, and CacheSize settings. This gives cached XSLT performance near AxKit and greater than Cocoon. XSLT caches transformations keyed uniquely by XML & XSLT inputs. PerlSetVar XSLTCache 1 XSLTCacheSize as of version 2.11, this config is no longer supported. Caching The output caching layer is a file dbm based output cache that runs on top of the MLDBM::Sync so inherits its performance characteristics. With CacheDB set to MLDBM::Sync::SDBM_File, the cache layer is very fast at caching entries up to 20K in size, but for greater cached items, you should set CacheDB to another dbm like DB_File or GDBM_File. In order for the cache layer to function properly, whether for $Response->Include() output caching, see OBJECTS, or XSLT caching, see XML/XSLT, then Apache::ASP must be loaded in the parent httpd like so: # httpd.conf PerlModule Apache::ASP -- or -- use Apache::ASP; The cache layer automatically expires entries upon server restart, but for this to work, a $ServerID must be computed when the Apache::ASP module gets loaded to store in each cached item. Without the above done, each child httpd process will get its own $ServerID, so caching will not work at all. This said, output caching will not work in raw CGI mode, just running under mod_perl. CacheDB Like StateDB, sets dbm format for caching. Since SDBM_File only support key/values pairs of around 1K max in length, the default for this is MLDBM::Sync::SDBM_File, which is very fast for < 20K output sizes. For caching larger data than 20K, DB_File or GDBM_File are probably better to use. PerlSetVar CacheDB MLDBM::Sync::SDBM_File For your own benchmarks to test the relative speeds of the various DBMs under MLDBM::Sync, which is used by CacheDB, you may run the ./bench/bench_sync.pl script from the MLDBM::Sync distribution on your system. CacheDir By default, the cache directory is at StateDir/cache, but CacheDir can be used to set the StateDir value for caching purposes. One may want the CacheDir separate from StateDir for example StateDir might be a centrally network mounted file system, while CacheDir might be a local file cache. PerlSetVar CacheDir /tmp/asp_demo On a system like Solaris where there is a RAM disk mounted on the system like /tmp, I could put the CacheDir there. On a system like Linux where files are cached pretty well by default, this is less important. CacheSize By default, this is 10M of data per cache. When any cache, like the XSLTCache, reaches this limit, the cache will be purged by deleting the cached dbm files entirely. This is better for long term running of dbms than deleting individual records, because dbm formats will often degrade in performance with lots of insert & deletes. Units of M, K, and B are supported for megabytes, kilobytes, and bytes, with the default unit being B, so the following configs all mean the same thing; PerlSetVar CacheSize 10M PerlSetVar CacheSize 10240K PerlSetVar CacheSize 10485760B PerlSetVar CacheSize 10485760 There are 2 caches currently, the XSLTCache, and the Response cache, the latter which is currently invoked for caching output from includes with special syntax. See $Response->Include() for more info on the Response cache. Miscellaneous AuthServerVariables default 0. If you are using basic auth and would like $Request->ServerVariables set like AUTH_TYPE, AUTH_USER, AUTH_NAME, REMOTE_USER, & AUTH_PASSWD, then set this and Apache::ASP will initialize these values from Apache->*auth* commands. Use of these environment variables keeps applications cross platform compatible as other servers set these too when performing basic 401 auth. PerlSetVar AuthServerVariables 0 BufferingOn default 1, if true, buffers output through the response object. $Response object will only send results to client browser if a $Response->Flush() is called, or if the asp script ends. Lots of output will need to be flushed incrementally. If false, 0, the output is immediately written to the client, CGI style. There will be a performance hit server side if output is flushed automatically to the client, but is probably small. I would leave this on, since error handling is poor, if your asp script errors after sending only some of the output. PerlSetVar BufferingOn 1 InodeNames Default 0. Set to 1 to uses a stat() call on scripts and includes to derive subroutine namespace based on device and inode numbers. In case of multiple symbolic links pointing to the same script this will result in the script being compiled only once. Use only on unix flavours which support the stat() call that know about device and inode numbers. PerlSetVar InodeNames 1 RequestParams Default 0, if set creates $Request->Params object with combined contents of $Request->QueryString and $Request->Form. This is for developer convenience simlar to CGI.pm's param() method. PerlSetVar RequestParams 1 RequestBinaryRead Default On, if set to Off will not read POST data into $Request->Form(). One potential reason for configuring this to Off might be to initialize the Apache::ASP object in an Apache handler phase earlier than the normal PerlRequestHandler phase, so that it does not interfere with normal reading of POST data later in the request. PerlSetVar RequestBinaryRead On StatINC default 0, if true, reloads perl libraries that have changed on disk automatically for ASP scripts. If false, the www server must be restarted for library changes to take effect. A known bug is that any functions that are exported, e.g. confess Carp qw(confess), will not be refreshed by StatINC. To refresh these, you must restart the www server. This setting should be used in development only because it is so slow. For a production version of StatINC, see StatINCMatch. PerlSetVar StatINC 1 StatINCMatch default undef, if defined, it will be used as a regular expression to reload modules that match as in StatINC. This is useful because StatINC has a very high performance penalty in production, so if you can narrow the modules that are checked for reloading each script execution to a handful, you will only suffer a mild performance penalty. The StatINCMatch setting should be a regular expression like: Struct|LWP which would match on reloading Class/Struct.pm, and all the LWP/.* libraries. If you define StatINCMatch, you do not need to define StatINC. PerlSetVar StatINCMatch .* StatScripts default 1, if set to 0, changed scripts, global.asa, and includes will not be reloaded. Coupled with Apache mod_perl startup and restart handlers executing Apache::ASP->Loader() for your application this allows your application to be frozen, and only reloaded on the next server restart or stop/start. There are a few advantages for not reloading scripts and modules in production. First there is a slight performance improvement by not having to stat() the script, its includes and the global.asa every request. From an application deployment standpoint, you also gain the ability to deploy your application as a snapshot taken when the server starts and restarts. This provides you with the reassurance that during a production server update from development sources, you do not have to worry with sources being used for the wrong libraries and such, while they are all being copied over. Finally, though you really should not do this, you can work on a live production application, with a test server reloading changes, but your production server does see the changes until you restart or stop/start it. This saves your public from syntax errors while you are just doing a quick bug fix. PerlSetVar StatScripts 1 SoftRedirect default 0, if true, a $Response->Redirect() does not end the script. Normally, when a Redirect() is called, the script is ended automatically. SoftRedirect 1, is a standard way of doing redirects, allowing for html output after the redirect is specified. PerlSetVar SoftRedirect 0 Filter On/Off, default Off. With filtering enabled, you can take advantage of full server side includes (SSI), implemented through Apache::SSI. SSI is implemented through this mechanism by using Apache::Filter. A sample configuration for full SSI with filtering is in the ./site/eg/.htaccess file, with a relevant example script ./site/eg/ssi_filter.ssi. You may only use this option with modperl v1.16 or greater installed and PERL_STACKED_HANDLERS enabled. Filtering may be used in conjunction with other handlers that are also "filter aware". If in doubt, try building your mod_perl with perl Makefile.PL EVERYTHING=1 With filtering through Apache::SSI, you should expect near a a 20% performance decrease. PerlSetVar Filter Off CgiHeaders default 0. When true, script output that looks like HTTP / CGI headers, will be added to the HTTP headers of the request. So you could add: Set-Cookie: test=message ... to the top of your script, and all the headers preceding a newline will be added as if with a call to $Response->AddHeader(). This functionality is here for compatibility with raw cgi scripts, and those used to this kind of coding. When set to 0, CgiHeaders style headers will not be parsed from the script response. PerlSetVar CgiHeaders 0 Clean default 0, may be set between 1 and 9. This setting determine how much text/html output should be compressed. A setting of 1 strips mostly white space saving usually 10% in output size, at a performance cost of less than 5%. A setting of 9 goes much further saving anywhere 25% to 50% typically, but with a performance hit of 50%. This config option is implemented via HTML::Clean. Per script configuration of this setting is available via the $Response->{Clean} property, which may also be set between 0 and 9. PerlSetVar Clean 0 CompressGzip default 0, if true will gzip compress HTML output on the fly if Compress::Zlib is installed, and the client browser supports it. Depending on the HTML being compressed, the client may see a 50% to 90% reduction in HTML output. I have seen 40K of HTML squeezed down to just under 6K. This will come at a 5%-20% hit to CPU usage per request compressed. Note there are some cases when a browser says it will accept gzip encoding, but then not render it correctly. This behavior has been seen with IE5 when set to use a proxy but not using a proxy, and the URL does not end with a .html or .htm. No work around has yet been found for this case so use at your own risk. PerlSetVar CompressGzip 1 FormFill default 0, if true will auto fill HTML forms with values from $Request->Form(). This functionality is provided by use of HTML::FillInForm. For more information please see "perldoc HTML::FillInForm", and the example ./site/eg/formfill.asp. This feature can be enabled on a per form basis at runtime with $Response->{FormFill} = 1 PerlSetVar FormFill 1 TimeHiRes default 0, if set and Time::HiRes is installed, will do sub second timing of the time it takes Apache::ASP to process a request. This will not include the time spent in the session manager, nor modperl or Apache, and is only a rough approximation at best. If Debug is set also, you will get a comment in your HTML output that indicates the time it took to process that script. If system debugging is set with Debug -1 or -2, you will also get this time in the Apache error log with the other system messages. Mail Administration Apache::ASP has some powerful administrative email extensions that let you sleep at night, knowing full well that if an error occurs at the web site, you will know about it immediately. With these features already enabled, it was also easy to provide the $Server->Mail(\%mail) API extension which you can read up about in the OBJECTS section. MailHost The mail host is the smtp server that the below Mail* config directives will use when sending their emails. By default Net::SMTP uses smtp mail hosts configured in Net::Config, which is set up at install time, but this setting can be used to override this config. The mail hosts specified in the Net::Config file will be used as backup smtp servers to the MailHost specified here, should this primary server not be working. PerlSetVar MailHost smtp.yourdomain.com.foobar MailFrom Default NONE, set this to specify the default mail address placed in the From: mail header for the $Server->Mail() API extension, as well as MailErrorsTo and MailAlertTo. PerlSetVar MailFrom youremail@yourdomain.com.foobar MailErrorsTo No default, if set, ASP server errors, error code 500, that result while compiling or running scripts under Apache::ASP will automatically be emailed to the email address set for this config. This allows an administrator to have a rapid response to user generated server errors resulting from bugs in production ASP scripts. Other errors, such as 404 not found will be handled by Apache directly. An easy way to see this config in action is to have an ASP script which calls a die(), which generates an internal ASP 500 server error. The Debug config of value 2 and this setting are mutually exclusive, as Debug 2 is a development setting where errors are displayed in the browser, and MailErrorsTo is a production setting so that errors are silently logged and sent via email to the web admin. PerlSetVar MailErrorsTo youremail@yourdomain.com MailAlertTo The address configured will have an email sent on any ASP server error 500, and the message will be short enough to fit on a text based pager. This config setting would be used to give an administrator a heads up that a www server error occurred, as opposed to MailErrorsTo would be used for debugging that server error. This config does not work when Debug 2 is set, as it is a setting for use in production only, where Debug 2 is for development use. PerlSetVar MailAlertTo youremail@yourdomain.com MailAlertPeriod Default 20 minutes, this config specifies the time in minutes over which there may be only one alert email generated by MailAlertTo. The purpose of MailAlertTo is to give the admin a heads up that there is an error at the www server. MailErrorsTo is for to aid in speedy debugging of the incident. PerlSetVar MailAlertPeriod 20 File Uploads FileUploadMax default 0, if set will limit file uploads to this size in bytes. This is currently implemented by setting $CGI::POST_MAX before handling the file upload. Prior to this, a developer would have to hardcode a value for $CGI::POST_MAX to get this to work. PerlSetVar 100000 FileUploadTemp default 0, if set will leave a temp file on disk during the request, which may be helpful for processing by other programs, but is also a security risk in that other users on the operating system could potentially read this file while the script is running. The path to the temp file will be available at $Request->{FileUpload}{$form_field}{TempFile}. The regular use of file uploads remains the same with the <$filehandle> to the upload at $Request->{Form}{$form_field}. Please see the CGI section for more information on file uploads, and the $Request section in OBJECTS. PerlSetVar FileUploadTemp 0 SYNTAX General ASP embedding syntax allows one to embed code in html in 2 simple ways. The first is the <% xxx %> tag in which xxx is any valid perl code. The second is <%= xxx %> where xxx is some scalar value that will be inserted into the html directly. An easy print. A simple asp page would look like: For loop incrementing font size:

<% for(1..5) { %> Size = <%=$_%>
<% } %> Notice that your perl code blocks can span any html. The for loop above iterates over the html without any special syntax. XMLSubs XMLSubs allows a developer to define custom handlers for HTML & XML tags, which can extend the natural syntax of the ASP environment. Configured like: PerlSetVar XMLSubsMatch site:\w+ A simple tag like: can be constructed that could translate into: sub site::header { my $args = shift; print "$args->{title}\n"; print "\n"; } Better yet, one can use this functionality to trap and post process embedded HTML & XML like: ... some HTML here ... and then: sub site::page { my($args, $html) = @_; &site::header($args); $main::Response->Write($html); $main::Response->Write(""); } Though this could be used to fully render XML documents, it was not built for this purpose, but to add powerful tag extensions to HTML development environments. For full XML rendering, you ought to try an XSLT approach, also supported by Apache::ASP. Editors As Apache::ASP supports a mixing of perl and HTML, any editor which supports development of one or the other would work well. The following editors are known to work well for developing Apache::ASP web sites: * Emacs, in perl or HTML modes. For a mmm-mode config that mixes HTML & perl modes in a single buffer, check out the editors/mmm-asp-perl.el file in distribution. * Vim, special syntax support with editors/aasp.vim file in distribution. * UltraEdit32 ( http://www.ultraedit.com/ ) has syntax highlighting, good macros and a configurable wordlist (so one can have syntax highlighting both for Perl and HTML). Please feel free to suggest your favorite development environment for this list. EVENTS Overview The ASP platform allows developers to create Web Applications. In fulfillment of real software requirements, ASP allows event-triggered actions to be taken, which are defined in a global.asa file. The global.asa file resides in the Global directory, defined as a config option, and may define the following actions: Action Event ------ ------ Script_OnStart * Beginning of Script execution Script_OnEnd * End of Script execution Script_OnFlush * Before $Response being flushed to client. Script_OnParse * Before script compilation Application_OnStart Beginning of Application Application_OnEnd End of Application Session_OnStart Beginning of user Session. Session_OnEnd End of user Session. * These are API extensions that are not portable, but were added because they are incredibly useful These actions must be defined in the $Global/global.asa file as subroutines, for example: sub Session_OnStart { $Application->{$Session->SessionID()} = started; } Sessions are easy to understand. When visiting a page in a web application, each user has one unique $Session. This session expires, after which the user will have a new $Session upon revisiting. A web application starts when the user visits a page in that application, and has a new $Session created. Right before the first $Session is created, the $Application is created. When the last user $Session expires, that $Application expires also. For some web applications that are always busy, the Application_OnEnd event may never occur. Script_OnStart & Script_OnEnd The script events are used to run any code for all scripts in an application defined by a global.asa. Often, you would like to run the same code for every script, which you would otherwise have to add by hand, or add with a file include, but with these events, just add your code to the global.asa, and it will be run. There is one caveat. Code in Script_OnEnd is not guaranteed to be run when $Response->End() is called, since the program execution ends immediately at this event. To always run critical code, use the API extension: $Server->RegisterCleanup() Session_OnStart Triggered by the beginning of a user's session, Session_OnStart gets run before the user's executing script, and if the same session recently timed out, after the session's triggered Session_OnEnd. The Session_OnStart is particularly useful for caching database data, and avoids having the caching handled by clumsy code inserted into each script being executed. Session_OnEnd Triggered by a user session ending, Session_OnEnd can be useful for cleaning up and analyzing user data accumulated during a session. Sessions end when the session timeout expires, and the StateManager performs session cleanup. The timing of the Session_OnEnd does not occur immediately after the session times out, but when the first script runs after the session expires, and the StateManager allows for that session to be cleaned up. So on a busy site with default SessionTimeout (20 minutes) and StateManager (10 times) settings, the Session_OnEnd for a particular session should be run near 22 minutes past the last activity that Session saw. A site infrequently visited will only have the Session_OnEnd run when a subsequent visit occurs, and theoretically the last session of an application ever run will never have its Session_OnEnd run. Thus I would not put anything mission-critical in the Session_OnEnd, just stuff that would be nice to run whenever it gets run. Script_OnFlush API extension. This event will be called prior to flushing the $Response buffer to the web client. At this time, the $Response->{BinaryRef} buffer reference may be used to modify the buffered output at runtime to apply global changes to scripts output without having to modify all the scripts. sub Script_OnFlush { my $ref = $Response->{BinaryRef}; $$ref =~ s/\s+/ /sg; # to strip extra white space } Check out the ./site/eg/global.asa for an example of its use. Script_OnParse This event allows one to set up a source filter on the script text, allowing one to change the script on the fly before the compilation stage occurs. The script text is available in the $Server->{ScriptRef} scalar reference, and can be accessed like so: sub Script_OnParse { my $code = $Server->{ScriptRef} $$code .= " ADDED SOMETHING "; } Application_OnStart This event marks the beginning of an ASP application, and is run just before the Session_OnStart of the first Session of an application. This event is useful to load up $Application with data that will be used in all user sessions. Application_OnEnd The end of the application is marked by this event, which is run after the last user session has timed out for a given ASP application. Server_OnStart ( pseudo-event ) Some might want something like a Server_OnStart event, where some code gets runs when the web server starts. In mod_perl, this is easy to achieve outside of the scope of an ASP application, by putting some initialization code into a section in the httpd.conf file. Initializations that you would like to be shared with the child httpds are particularly useful, one such being the Apache::ASP->Loader() routine which you can read more about in the TUNING section - Precompile Scripts subsection. It is could be called like: # httpd.conf Apache::ASP->Loader($path, $pattern, %config) So a section is your Server_OnStart routine! mod_perl handlers If one wants to extend one's environment with mod_perl handlers, Apache::ASP does not stop this. Basic use of Apache::ASP in fact only involves the content handler phase of mod_perl's PerlHandler, like SetHandler perl-script PerlModule Apache::ASP PerlHandler Apache::ASP But mod_perl allows for direct access to many more Apache event stages, for full list try "perldoc mod_perl" or buy the mod_perl Eagle book. Some commonly used ones are: PerlInitHandler PerlTransHandler PerlFixupHandler PerlHandler PerlLogHandler PerlCleanupHandler For straight Apache::ASP programming, there are some equivalents, say Script_OnStart event instead of Init/Fixup stages, or $Server->RegisterCleanup() for Log/Cleanup stages, but you can do things in the mod_perl handlers that you cannot do in Apache::ASP, especially if you want to handle all files globally, and not just ASP scripts. For many Apache::* modules for use with mod_perl, of which Apache::ASP is just one, check out http://perl.apache.org/src/apache-modlist.html To gain access to the ASP objects like $Session outside in a non-PerlHandler mod_perl handler, you may use this API: my $ASP = Apache::ASP->new($r); # $r is Apache->request object as in this possible Authen handler: use Apache::ASP; sub My::Auth::handler { my $r = shift; my $ASP = Apache::ASP->new($r) my $Session = $ASP->Session; } Here are some examples of do-it-yourself mod_perl handler programming... === Forbid Bad HSlide User Agent === # httpd.conf PerlAccessHandler My::Access sub My::Access::handler { my $r = shift; if($r->headers_in->{'USER_AGENT'} =~ /HSlide/) { 403; } else { 200; } } === Runtime Path Parsing === This example shows how one might take an arbitrary URL path /$path/$file.asp, and turn that into a runtime config for your site, so your scripts get executed always in your sites DocumentRoot. INPUT URL /SomeCategory/ OUTPUT Script: index.asp $Server->Config('PATH') eq '/SomeCategory' INPUT URL /SomeCategory/index.asp OUTPUT Script: index.asp $Server->Config('PATH') eq '/SomeCategory' INPUT URI /index.asp OUTPUT Script: index.asp $Server->Config('PATH') eq '' # httpd.conf PerlTransHandler My::Init use lib qw( $custom_perllib ); # $custom_perllib/My/Init.pm package My::Init; use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; my $uri = $r->uri || '/'; unless($uri =~ m|^(.*)(/([^/.]+\.[\w]+)?)$|i) { warn("can't parse uri $uri"); return DECLINED; } $uri = $2; my $PATH = $1 || ''; $r->dir_config('PATH', $PATH); if($uri eq '/') { $uri = '/index.asp'; } $r->uri($uri); $r->filename($r->document_root.$uri); DECLINED; } 1; OBJECTS The beauty of the ASP Object Model is that it takes the burden of CGI and Session Management off the developer, and puts them in objects accessible from any ASP script & include. For the perl programmer, treat these objects as globals accessible from anywhere in your ASP application. The Apache::ASP object model supports the following: Object Function ------ -------- $Session - user session state $Response - output to browser $Request - input from browser $Application - application state $Server - general methods These objects, and their methods are further defined in the following sections. If you would like to define your own global objects for use in your scripts and includes, you can initialize them in the global.asa Script_OnStart like: use vars qw( $Form $Site ); # declare globals sub Script_OnStart { $Site = My::Site->new; # init $Site object $Form = $Request->Form; # alias form data $Server->RegisterCleanup(sub { # garbage collection $Site->DESTROY; $Site = $Form = undef; }); } In this way you can create site wide application objects and simple aliases for common functions. $Session Object The $Session object keeps track of user and web client state, in a persistent manner, making it relatively easy to develop web applications. The $Session state is stored across HTTP connections, in database files in the Global or StateDir directories, and will persist across web server restarts. The user session is referenced by a 128 bit / 32 byte MD5 hex hashed cookie, and can be considered secure from session id guessing, or session hijacking. When a hacker fails to guess a session, the system times out for a second, and with 2**128 (3.4e38) keys to guess, a hacker will not be guessing an id any time soon. If an incoming cookie matches a timed out or non-existent session, a new session is created with the incoming id. If the id matches a currently active session, the session is tied to it and returned. This is also similar to the Microsoft ASP implementation. The $Session reference is a hash ref, and can be used as such to store data as in: $Session->{count}++; # increment count by one %{$Session} = (); # clear $Session data The $Session object state is implemented through MLDBM, and a user should be aware of the limitations of MLDBM. Basically, you can read complex structures, but not write them, directly: $data = $Session->{complex}{data}; # Read ok. $Session->{complex}{data} = $data; # Write NOT ok. $Session->{complex} = {data => $data}; # Write ok, all at once. Please see MLDBM for more information on this topic. $Session can also be used for the following methods and properties: $Session->{CodePage} Not implemented. May never be until someone needs it. $Session->{LCID} Not implemented. May never be until someone needs it. $Session->{SessionID} SessionID property, returns the id for the current session, which is exchanged between the client and the server as a cookie. $Session->{Timeout} [= $minutes] Timeout property, if minutes is being assigned, sets this default timeout for the user session, else returns the current session timeout. If a user session is inactive for the full timeout, the session is destroyed by the system. No one can access the session after it times out, and the system garbage collects it eventually. $Session->Abandon() The abandon method times out the session immediately. All Session data is cleared in the process, just as when any session times out. $Session->Lock() API extension. If you are about to use $Session for many consecutive reads or writes, you can improve performance by explicitly locking $Session, and then unlocking, like: $Session->Lock(); $Session->{count}++; $Session->{count}++; $Session->{count}++; $Session->UnLock(); This sequence causes $Session to be locked and unlocked only 1 time, instead of the 6 times that it would be locked otherwise, 2 for each increment with one to read and one to write. Because of flushing issues with SDBM_File and DB_File databases, each lock actually ties fresh to the database, so the performance savings here can be considerable. Note that if you have SessionSerialize set, $Session is already locked for each script invocation automatically, as if you had called $Session->Lock() in Script_OnStart. Thus you do not need to worry about $Session locking for performance. Please read the section on SessionSerialize for more info. $Session->UnLock() API Extension. Unlocks the $Session explicitly. If you do not call this, $Session will be unlocked automatically at the end of the script. $Response Object This object manages the output from the ASP Application and the client web browser. It does not store state information like the $Session object but does have a wide array of methods to call. $Response->{BinaryRef} API extension. This is a perl reference to the buffered output of the $Response object, and can be used in the Script_OnFlush global.asa event to modify the buffered output at runtime to apply global changes to scripts output without having to modify all the scripts. These changes take place before content is flushed to the client web browser. sub Script_OnFlush { my $ref = $Response->{BinaryRef}; $$ref =~ s/\s+/ /sg; # to strip extra white space } Check out the ./site/eg/global.asa for an example of its use. $Response->{Buffer} Default 1, when TRUE sends output from script to client only at the end of processing the script. When 0, response is not buffered, and client is sent output as output is generated by the script. $Response->{CacheControl} Default "private", when set to public allows proxy servers to cache the content. This setting controls the value set in the HTTP header Cache-Control $Response->{Charset} This member when set appends itself to the value of the Content-Type HTTP header. If $Response->{Charset} = 'ISO-LATIN-1' is set, the corresponding header would look like: Content-Type: text/html; charset=ISO-LATIN-1 $Response->{Clean} = 0-9; API extension. Set the Clean level, default 0, on a per script basis. Clean of 1-9 compresses text/html output. Please see the Clean config option for more information. This setting may also be useful even if using compression to obfuscate HTML. $Response->{ContentType} = "text/html" Sets the MIME type for the current response being sent to the client. Sent as an HTTP header. $Response->{Debug} = 1|0 API extension. Default set to value of Debug config. May be used to temporarily activate or inactivate $Response->Debug() behavior. Something like: { local $Response->{Debug} = 1; $Response->Debug($values); } maybe be used to always log something. The Debug() method can be better than AppendToLog() because it will log data in data structures one level deep, whereas AppendToLog prints just raw string/scalar values. $Response->{Expires} = $time Sends a response header to the client indicating the $time in SECONDS in which the document should expire. A time of 0 means immediate expiration. The header generated is a standard HTTP date like: "Wed, 09 Feb 1994 22:23:32 GMT". $Response->{ExpiresAbsolute} = $date Sends a response header to the client with $date being an absolute time to expire. Formats accepted are all those accepted by HTTP::Date::str2time(), e.g. "Wed, 09 Feb 1994 22:23:32 GMT" -- HTTP format "Tuesday, 08-Feb-94 14:15:29 GMT" -- old rfc850 HTTP format "08-Feb-94" -- old rfc850 HTTP format "09 Feb 1994" -- proposed new HTTP format "Feb 3 1994" -- Unix 'ls -l' format "Feb 3 17:03" -- Unix 'ls -l' format $Response->{FormFill} = 0|1 If true, HTML forms generated by the script output will be auto filled with data from $Request->Form. This feature requires HTML::FillInForm to be installed. Please see the FormFill CONFIG for more information. This setting overrides the FormFill config at runtime for the script execution only. $Response->{IsClientConnected} 1 if web client is connected, 0 if not. This value starts set to 1, and will be updated whenever a $Response->Flush() is called. If BufferingOn is set, by default $Response->Flush() will only be called at the end of the HTML output. As of version 2.23 this value is updated correctly before global.asa Script_OnStart is called, so global script termination may be correctly handled during that event, which one might want to do with excessive user STOP/RELOADS when the web server is very busy. An API extension $Response->IsClientConnected may be called for refreshed connection status without calling first a $Response->Flush $Response->{PICS} If this property has been set, a PICS-Label HTTP header will be sent with its value. For those that do not know, PICS is a header that is useful in rating the internet. It stands for Platform for Internet Content Selection, and you can find more info about it at: http://www.w3.org $Response->{Status} = $status Sets the status code returned by the server. Can be used to set messages like 500, internal server error $Response->AddHeader($name, $value) Adds a custom header to a web page. Headers are sent only before any text from the main page is sent, so if you want to set a header after some text on a page, you must turn BufferingOn. $Response->AppendToLog($message) Adds $message to the server log. Useful for debugging. $Response->BinaryWrite($data) Writes binary data to the client. The only difference from $Response->Write() is that $Response->Flush() is called internally first, so the data cannot be parsed as an html header. Flushing flushes the header if has not already been written. If you have set the $Response->{ContentType} to something other than text/html, cgi header parsing (see CGI notes), will be automatically be turned off, so you will not necessarily need to use BinaryWrite for writing binary data. For an example of BinaryWrite, see the binary_write.htm example in ./site/eg/binary_write.htm Please note that if you are on Win32, you will need to call binmode on a file handle before reading, if its data is binary. $Response->Clear() Erases buffered ASP output. $Response->Cookies($name, [$key,] $value) Sets the key or attribute of cookie with name $name to the value $value. If $key is not defined, the Value of the cookie is set. ASP CookiePath is assumed to be / in these examples. $Response->Cookies('name', 'value'); --> Set-Cookie: name=value; path=/ $Response->Cookies("Test", "data1", "test value"); $Response->Cookies("Test", "data2", "more test"); $Response->Cookies( "Test", "Expires", &HTTP::Date::time2str(time+86400) ); $Response->Cookies("Test", "Secure", 1); $Response->Cookies("Test", "Path", "/"); $Response->Cookies("Test", "Domain", "host.com"); --> Set-Cookie:Test=data1=test%20value&data2=more%20test; \ expires=Fri, 23 Apr 1999 07:19:52 GMT; \ path=/; domain=host.com; secure The latter use of $key in the cookies not only sets cookie attributes such as Expires, but also treats the cookie as a hash of key value pairs which can later be accesses by $Request->Cookies('Test', 'data1'); $Request->Cookies('Test', 'data2'); Because this is perl, you can (NOT PORTABLE) reference the cookies directly through hash notation. The same 5 commands above could be compressed to: $Response->{Cookies}{Test} = { Secure => 1, Value => { data1 => 'test value', data2 => 'more test' }, Expires => 86400, # not portable, see above Domain => 'host.com', Path => '/' }; and the first command would be: # you don't need to use hash notation when you are only setting # a simple value $Response->{Cookies}{'Test Name'} = 'Test Value'; I prefer the hash notation for cookies, as this looks nice, and is quite perlish. It is here to stay. The Cookie() routine is very complex and does its best to allow access to the underlying hash structure of the data. This is the best emulation I could write trying to match the Collections functionality of cookies in IIS ASP. For more information on Cookies, please go to the source at http://home.netscape.com/newsref/std/cookie_spec.html $Response->Debug(@args) API Extension. If the Debug config option is set greater than 0, this routine will write @args out to server error log. refs in @args will be expanded one level deep, so data in simple data structures like one-level hash refs and array refs will be displayed. CODE refs like $Response->Debug(sub { "some value" }); will be executed and their output added to the debug output. This extension allows the user to tie directly into the debugging capabilities of this module. While developing an app on a production server, it is often useful to have a separate error log for the application to catch debugging output separately. One way of implementing this is to use the Apache ErrorLog configuration directive to create a separate error log for a virtual host. If you want further debugging support, like stack traces in your code, consider doing things like: $Response->Debug( sub { Carp::longmess('debug trace') }; $SIG{__WARN__} = \&Carp::cluck; # then warn() will stack trace The only way at present to see exactly where in your script an error occurred is to set the Debug config directive to 2, and match the error line number to perl script generated from your ASP script. However, as of version 0.10, the perl script generated from the asp script should match almost exactly line by line, except in cases of inlined includes, which add to the text of the original script, pod comments which are entirely yanked out, and <% # comment %> style comments which have a \n added to them so they still work. If you would like to see the HTML preceding an error while developing, consider setting the BufferingOn config directive to 0. $Response->End() Sends result to client, and immediately exits script. Automatically called at end of script, if not already called. $Response->ErrorDocument($code, $uri) API extension that allows for the modification the Apache ErrorDocument at runtime. $uri may be a on site document, off site URL, or string containing the error message. This extension is useful if you want to have scripts set error codes with $Response->{Status} like 401 for authentication failure, and to then control from the script what the error message looks like. For more information on the Apache ErrorDocument mechanism, please see ErrorDocument in the CORE Apache settings, and the Apache->custom_response() API, for which this method is a wrapper. $Response->Flush() Sends buffered output to client and clears buffer. $Response->Include($filename, @args) This API extension calls the routine compiled from asp script in $filename with the args @args. This is a direct translation of the SSI tag Please see the SSI section for more on SSI in general. This API extension was created to allow greater modularization of code by allowing includes to be called with runtime arguments. Files included are compiled once, and the anonymous code ref from that compilation is cached, thus including a file in this manner is just like calling a perl subroutine. The @args can be found in @_ in the includes like: # include.inc <% my @args = @_; %> As of 2.23, multiple return values can be returned from an include like: my @rv = $Response->Include($filename, @args); $Response->Include(\%cache_args, @sub_args) *CACHE API* As of version 2.23, output from an include may be cached with this API and the CONFIG settings CacheDir & CacheDB. This can be used to execute expensive includes only rarely where applicable, drastically increasing performance in some cases. This API extension applies to the entire include family: my @rv = $Response->Include(\%cache_args, @include_args) my $html_ref = $Response->TrapInclude(\%cache_args, @include_args) $Server->Execute(\%cache_args, @include_args) For this output cache to work, you must load Apache::ASP in the Apache parent httpd like so: # httpd.conf PerlModule Apache::ASP The cache arguments are shown here $Response->Include({ File => 'file.inc', Cache => 1, # to activate cache layer Expires => 3600, # to expire in one hour LastModified => time() - 600, # to expire if cached before 10 minutes ago Key => $Request->Form, # to cache based on checksum of serialized form data, Clear => 1, # always executes include & cache output }, @include_args); File - include file to execute, can be file name or \$script script data passed in as a string reference. Cache - activate caching, will run like normal include without this Expires - only cache for this long in seconds LastModified - if cached before this time(), expire Key - The cache item identity. Can be $data, \$data, \%data, \@data, this data is serialized and combined with the filename & @include_args to create a MD5 checksum to fetch from the cache with. If you wanted to cache the results of a search page from form data POSTed, then this key could be { Key => $Request->Form } Clear - If set to 1, or boolean true, will always execute the include and update the cache entry for it. Motivation: If an include takes 1 second to execute because of complex SQL to a database, and you can cache the output of this include because it is not realtime data, and the cache layer runs at .01 seconds, then you have a 100 fold savings on that part of the script. Site scalability can be dramatically increased in this way by intelligently caching bottlenecks in the web application. Use Sparingly: If you have a fast include, then it may execute faster than the cache layer runs, in which case you may actually slow your site down by using this feature. Therefore try to use this sparingly, and only when sure you really need it. Apache::ASP scripts generally execute very quickly, so most developers will not need to use this feature at all. $Response->Include(\$script_text, @args) Added in Apache::ASP 2.11, this method allows for executing ASP scripts that are generated dynamically by passing in a reference to the script data instead of the file name. This works just like the normal $Response->Include() API, except a string reference is passed in instead of a filename. For example: <% my $script = "<\% print 'TEST'; %\>"; $Response->Include(\$script); %> This include would output TEST. Note that tokens like <% and %> must be escaped so Apache::ASP does not try to compile those code blocks directly when compiling the original script. If the $script data were fetched directly from some external resource like a database, then these tokens would not need to be escaped at all as in: <% my $script = $dbh->selectrow_array( "select script_text from scripts where script_id = ?", undef, $script_id ); $Response->Include(\$script); %> This method could also be used to render other types of dynamic scripts, like XML docs using XMLSubs for example, though for complex runtime XML rendering, one should use something better suited like XSLT. See the $Server->XSLT API for more on this topic. $Response->IsClientConnected() API Extension. 1 for web client still connected, 0 if disconnected which might happen if the user hits the stop button. The original API for this $Response->{IsClientConnected} is only updated after a $Response->Flush is called, so this method may be called for a refreshed status. Note $Response->Flush calls $Response->IsClientConnected to update $Response->{IsClientConnected} so to use this you are going straight to the source! But if you are doing a loop like: while(@data) { $Response->End if ! $Response->{IsClientConnected}; my $row = shift @data; %> <%= $row %> <% $Response->Flush; } Then its more efficient to use the member instead of the method since $Response->Flush() has already updated that value for you. $Response->Redirect($url) Sends the client a command to go to a different url $url. Script immediately ends. $Response->TrapInclude($file, @args) Calls $Response->Include() with same arguments as passed to it, but instead traps the include output buffer and returns it as as a perl string reference. This allows one to postprocess the output buffer before sending to the client. my $string_ref = $Response->TrapInclude('file.inc'); $$string_ref =~ s/\s+/ /sg; # squash whitespace like Clean 1 print $$string_ref; The data is returned as a referenece to save on what might be a large string copy. You may dereference the data with the $$string_ref notation. $Response->Write($data) Write output to the HTML page. <%=$data%> syntax is shorthand for a $Response->Write($data). All final output to the client must at some point go through this method. $Request Object The request object manages the input from the client browser, like posts, query strings, cookies, etc. Normal return results are values if an index is specified, or a collection / perl hash ref if no index is specified. WARNING, the latter property is not supported in ActiveState PerlScript, so if you use the hashes returned by such a technique, it will not be portable. A normal use of this feature would be to iterate through the form variables in the form hash... $form = $Request->Form(); for(keys %{$form}) { $Response->Write("$_: $form->{$_}
\n"); } Please see the ./site/eg/server_variables.htm asp file for this method in action. Note that if a form POST or query string contains duplicate values for a key, those values will be returned through normal use of the $Request object: @values = $Request->Form('key'); but you can also access the internal storage, which is an array reference like so: $array_ref = $Request->{Form}{'key'}; @values = @{$array_ref}; Please read the PERLSCRIPT section for more information on how things like $Request->QueryString() & $Request->Form() behave as collections. $Request->{Method} API extension. Returns the client HTTP request method, as in GET or POST. Added in version 2.31. $Request->{TotalBytes} The amount of data sent by the client in the body of the request, usually the length of the form data. This is the same value as $Request->ServerVariables('CONTENT_LENGTH') $Request->BinaryRead([$length]) Returns a string whose contents are the first $length bytes of the form data, or body, sent by the client request. If $length is not given, will return all of the form data. This data is the raw data sent by the client, without any parsing done on it by Apache::ASP. Note that BinaryRead will not return any data for file uploads. Please see the $Request->FileUpload() interface for access to this data. $Request->Form() data will also be available as normal. $Request->ClientCertificate() Not implemented. $Request->Cookies($name [,$key]) Returns the value of the Cookie with name $name. If a $key is specified, then a lookup will be done on the cookie as if it were a query string. So, a cookie set by: Set-Cookie: test=data1=1&data2=2 would have a value of 2 returned by $Request->Cookies('test','data2'). If no name is specified, a hash will be returned of cookie names as keys and cookie values as values. If the cookie value is a query string, it will automatically be parsed, and the value will be a hash reference to these values. When in doubt, try it out. Remember that unless you set the Expires attribute of a cookie with $Response->Cookies('cookie', 'Expires', $xyz), the cookies that you set will only last until you close your browser, so you may find your self opening & closing your browser a lot when debugging cookies. For more information on cookies in ASP, please read $Response->Cookies() $Request->FileUpload($form_field, $key) API extension. The FileUpload interface to file upload data is stabilized. The internal representation of the file uploads is a hash of hashes, one hash per file upload found in the $Request->Form() collection. This collection of collections may be queried through the normal interface like so: $Request->FileUpload('upload_file', 'ContentType'); $Request->FileUpload('upload_file', 'FileHandle'); $Request->FileUpload('upload_file', 'BrowserFile'); $Request->FileUpload('upload_file', 'Mime-Header'); $Request->FileUpload('upload_file', 'TempFile'); * note that TempFile must be use with the UploadTempFile configuration setting. The above represents the old slow collection interface, but like all collections in Apache::ASP, you can reference the internal hash representation more easily. my $fileup = $Request->{FileUpload}{upload_file}; $fileup->{ContentType}; $fileup->{BrowserFile}; $fileup->{FileHandle}; $fileup->{Mime-Header}; $fileup->{TempFile}; $Request->Form($name) Returns the value of the input of name $name used in a form with POST method. If $name is not specified, returns a ref to a hash of all the form data. One can use this hash to create a nice alias to the form data like: # in global.asa use vars qw( $Form ); sub Script_OnStart { $Form = $Request->Form; } # then in ASP scripts <%= $Form->{var} %> File upload data will be loaded into $Request->Form('file_field'), where the value is the actual file name of the file uploaded, and the contents of the file can be found by reading from the file name as a file handle as in: while(read($Request->Form('file_field_name'), $data, 1024)) {}; For more information, please see the CGI / File Upload section, as file uploads are implemented via the CGI.pm module. An example can be found in the installation samples ./site/eg/file_upload.asp $Request->Params($name) API extension. If RequestParams CONFIG is set, the $Request->Params object is created with combined contents of $Request->QueryString and $Request->Form. This is for developer convenience simlar to CGI.pm's param() method. Just like for $Response->Form, one could create a nice alias like: # in global.asa use vars qw( $Params ); sub Script_OnStart { $Params = $Request->Params; } $Request->QueryString($name) Returns the value of the input of name $name used in a form with GET method, or passed by appending a query string to the end of a url as in http://localhost/?data=value. If $name is not specified, returns a ref to a hash of all the query string data. $Request->ServerVariables($name) Returns the value of the server variable / environment variable with name $name. If $name is not specified, returns a ref to a hash of all the server / environment variables data. The following would be a common use of this method: $env = $Request->ServerVariables(); # %{$env} here would be equivalent to the cgi %ENV in perl. $Application Object Like the $Session object, you may use the $Application object to store data across the entire life of the application. Every page in the ASP application always has access to this object. So if you wanted to keep track of how many visitors there where to the application during its lifetime, you might have a line like this: $Application->{num_users}++ The Lock and Unlock methods are used to prevent simultaneous access to the $Application object. $Application->Lock() Locks the Application object for the life of the script, or until UnLock() unlocks it, whichever comes first. When $Application is locked, this guarantees that data being read and written to it will not suddenly change on you between the reads and the writes. This and the $Session object both lock automatically upon every read and every write to ensure data integrity. This lock is useful for concurrent access control purposes. Be careful to not be too liberal with this, as you can quickly create application bottlenecks with its improper use. $Application->UnLock() Unlocks the $Application object. If already unlocked, does nothing. $Application->GetSession($sess_id) This NON-PORTABLE API extension returns a user $Session given a session id. This allows one to easily write a session manager if session ids are stored in $Application during Session_OnStart, with full access to these sessions for administrative purposes. Be careful not to expose full session ids over the net, as they could be used by a hacker to impersonate another user. So when creating a session manager, for example, you could create some other id to reference the SessionID internally, which would allow you to control the sessions. This kind of application would best be served under a secure web server. The ./site/eg/global_asa_demo.asp script makes use of this routine to display all the data in current user sessions. $Application->SessionCount() This NON-PORTABLE method returns the current number of active sessions in the application, and is enabled by the SessionCount configuration setting. This method is not implemented as part of the original ASP object model, but is implemented here because it is useful. In particular, when accessing databases with license requirements, one can monitor usage effectively through accessing this value. $Server Object The server object is that object that handles everything the other objects do not. The best part of the server object for Win32 users is the CreateObject method which allows developers to create instances of ActiveX components, like the ADO component. $Server->{ScriptTimeout} = $seconds Not implemented. May never be. Please see the Apache Timeout configuration option, normally in httpd.conf. $Server->Config($setting) API extension. Allows a developer to read the CONFIG settings, like Global, GlobalPackage, StateDir, etc. Currently implemented as a wrapper around Apache->dir_config($setting) May also be invoked as $Server->Config(), which will return a hash ref of all the PerlSetVar settings. $Server->CreateObject($program_id) Allows use of ActiveX objects on Win32. This routine returns a reference to an Win32::OLE object upon success, and nothing upon failure. It is through this mechanism that a developer can utilize ADO. The equivalent syntax in VBScript is Set object = Server.CreateObject(program_id) For further information, try 'perldoc Win32::OLE' from your favorite command line. $Server->Execute($file, @args) New method from ASP 3.0, this does the same thing as $Response->Include($file, @args) and internally is just a wrapper for such. Seems like we had this important functionality before the IIS/ASP camp! $Server->File() Returns the absolute file path to current executing script. Same as Apache->request->filename when running under mod_perl. ASP API extension. $Server->GetLastError() Not implemented, will likely not ever be because this is dependent on how IIS handles errors and is not relevant in Apache. $Server->HTMLEncode( $string || \$string ) Returns an HTML escapes version of $string. &, ", >, <, are each escapes with their HTML equivalents. Strings encoded in this nature should be raw text displayed to an end user, as HTML tags become escaped with this method. As of version 2.23, $Server->HTMLEncode() may take a string reference for an optmization when encoding a large buffer as an API extension. Here is how one might use one over the other: my $buffer = '&' x 100000; $buffer = $Server->HTMLEncode($buffer); print $buffer; - or - my $buffer = '&' x 100000; $Server->HTMLEncode(\$buffer); print $buffer; Using the reference passing method in benchmarks on 100K of data was 5% more efficient, but maybe useful for some. It saves on copying the 100K buffer twice. $Server->MapInclude($include) API extension. Given the include $include, as an absolute or relative file name to the current executing script, this method returns the file path that the include would be found from the include search path. The include search path is the current script directory, Global, and IncludesDir directories. If the include is not found in the includes search path, then undef, or bool false, is returned. So one may do something like this: if($Server->MapInclude('include.inc')) { $Response->Include('include.inc'); } This code demonstrates how one might only try to execute an include if it exists, which is useful since a script will error if it tries to execute an include that does not exist. $Server->MapPath($url); Given the url $url, absolute, or relative to the current executing script, this method returns the equivalent filename that the server would translate the request to, regardless or whether the request would be valid. Only a $url that is relative to the host is valid. Urls like "." and "/" are fine arguments to MapPath, but http://localhost would not be. To see this method call in action, check out the sample ./site/eg/server.htm script. $Server->Mail(\%mail, %smtp_args); With the Net::SMTP and Net::Config modules installed, which are part of the perl libnet package, you may use this API extension to send email. The \%mail hash reference that you pass in must have values for at least the To, From, and Subject headers, and the Body of the mail message. The return value of this routine is 1 for success, 0 for failure. If the MailHost SMTP server is not available, this will have a return value of 0. You could send an email like so: $Server->Mail({ To => 'somebody@yourdomain.com.foobar', From => 'youremail@yourdomain.com.foobar', Subject => 'Subject of Email', Body => 'Body of message. '. 'You might have a lot to say here!', Organization => 'Your Organization', CC => 'youremailcc@yourdomain.com.foobar', BCC => 'youremailbcc@yourdomain.com.foobar', Debug => 0 || 1, }); Any extra fields specified for the email will be interpreted as headers for the email, so to send an HTML email, you could set 'Content-Type' => 'text/html' in the above example. If you have MailFrom configured, this will be the default for the From header in your email. For more configuration options like the MailHost setting, check out the CONFIG section. The return value of this method call will be boolean for success of the mail being sent. If you would like to specially configure the Net::SMTP object used internally, you may set %smtp_args and they will be passed on when that object is initialized. "perldoc Net::SMTP" for more into on this topic. If you would like to include the output of an ASP page as the body of the mail message, you might do something like: my $mail_body = $Response->TrapInclude('mail_body.inc'); $Server->Mail({ %mail, Body => $$mail_body }); $Server->RegisterCleanup($sub) non-portable extension Sets a subroutine reference to be executed after the script ends, whether normally or abnormally, the latter occurring possibly by the user hitting the STOP button, or the web server being killed. This subroutine must be a code reference created like: $Server->RegisterCleanup(sub { $main::Session->{served}++; }); or sub served { $main::Session->{served}++; } $Server->RegisterCleanup(\&served); The reference to the subroutine passed in will be executed. Though the subroutine will be executed in anonymous context, instead of the script, all objects will still be defined in main::*, that you would reference normally in your script. Output written to $main::Response will have no affect at this stage, as the request to the www client has already completed. Check out the ./site/eg/register_cleanup.asp script for an example of this routine in action. $Server->Transfer($file, @args) New method from ASP 3.0. Transfers control to another script. The Response buffer will not be cleared automatically, so if you want this to serve as a faster $Response->Redirect(), you will need to call $Response->Clear() before calling this method. This new script will take over current execution and the current script will not continue to be executed afterwards. It differs from Execute() because the original script will not pick up where it left off. As of Apache::ASP 2.31, this method now accepts optional arguments like $Response->Include & $Server->Execute. $Server->Transfer is now just a wrapper for: $Response->Include($file, @args); $Response->End; $Server->URLEncode($string) Returns the URL-escaped version of the string $string. +'s are substituted in for spaces and special characters are escaped to the ascii equivalents. Strings encoded in this manner are safe to put in urls... they are especially useful for encoding data used in a query string as in: $data = $Server->URLEncode("test data"); $url = "http://localhost?data=$data"; $url evaluates to http://localhost?data=test+data, and is a valid URL for use in anchor tags and redirects, etc. $Server->URL($url, \%params) Will return a URL with %params serialized into a query string like: $url = $Server->URL('test.asp', { test => value }); which would give you a URL of test.asp?test=value Used in conjunction with the SessionQuery* settings, the returned URL will also have the session id inserted into the query string, making this a critical part of that method of implementing cookieless sessions. For more information on that topic please read on the setting in the CONFIG section, and the SESSIONS section too. $Server->XSLT(\$xsl_data, \$xml_data) * NON-PORTABLE API EXTENSION * This method takes string references for XSL and XML data and returns the XSLT output as a string reference like: my $xslt_data_ref = $Server->XSLT(\$xsl_data, \$xml_data) print $$xslt_data_ref; The XSLT parser defaults to XML::XSLT, and is configured with the XSLTParser setting, which can also use XML::Sablotron ( support added in 2.11 ), and XML::LibXSLT ( support added in 2.29 ). Please see the CONFIG section for more information on the XSLT* settings that drive this API. The XSLT setting itself uses this API internally to do its rendering. This API was created to allow developers easy XSLT component rendering without having to render the entire ASP scripts via XSLT. This will make an easy plugin architecture for those looking to integrate XML into their existing ASP application frameworks. At some point, the API will likely take files as arguments, but not as of the 2.11 release. SSI SSI is great! One of the main features of server side includes is to include other files in the script being requested. In Apache::ASP, this is implemented in a couple ways, the most crucial of which is implemented in the file include. Formatted as ,the .inc being merely a convention, text from the included file will be inserted directly into the script being executed and the script will be compiled as a whole. Whenever the script or any of its includes change, the script will be recompiled. Includes go a great length to promote good decomposition and code sharing in ASP scripts, but they are still fairly static. As of version .09, includes may have dynamic runtime execution, as subroutines compiled into the global.asa namespace. The first way to invoke includes dynamically is If @args is specified, Apache::ASP knows to execute the include at runtime instead of inlining it directly into the compiled code of the script. It does this by compiling the script at runtime as a subroutine, and caching it for future invocations. Then the compiled subroutine is executed and has @args passed into its as arguments. This is still might be too static for some, as @args is still hardcoded into the ASP script, so finally, one may execute an include at runtime by utilizing this API extension $Response->Include("filename.inc", @args); which is a direct translation of the dynamic include above. Although inline includes should be a little faster, runtime dynamic includes represent great potential savings in httpd memory, as includes are shared between scripts keeping the size of each script to a minimum. This can often be significant saving if much of the formatting occurs in an included header of a www page. By default, all includes will be inlined unless called with an args parameter. However, if you want all your includes to be compiled as subs and dynamically executed at runtime, turn the DynamicIncludes config option on as documented above. Apache::SSI for mod_perl 1.3.x only One of the things missing above is the tag. This and many other SSI code extensions are available by filtering Apache::ASP output through Apache::SSI via the Apache::Filter and the Filter config options, available in mod_perl 1.3.x / Apache 1.3.x. Unfortunately this functionality is not available with mod_perl 2 / Apache 2. For more information on how to wire Apache::ASP and Apache::SSI together, please see the Filter config option documented above. Also please see Apache::SSI for further information on the capabilities it offers. SSI with mod_filter in Apache 2 Apache 2 offers chained filters. It may be possible to chain filters to Apache::ASP output through mod_filter for SSI processing: http://httpd.apache.org/docs/2.1/mod/mod_filter.html EXAMPLES Use with Apache. Copy the ./site/eg directory from the ASP installation to your Apache document tree and try it out! You have to put "AllowOverride All" in your config section to let the .htaccess file in the ./site/eg installation directory do its work. IMPORTANT (FAQ): Make sure that the web server has write access to that directory. Usually a chmod -R 0777 eg will do the trick :) SESSIONS Cookies are used by default for user $Session support ( see OBJECTS ). In order to track a web user and associate server side data with that client, the web server sets, and the web client returns a 32 byte session id identifier cookie. This implementation is very secure and may be used in secure HTTPS transactions, and made stronger with SecureSession, HTTPOnlySession and ParanoidSession settings (see CONFIG ). However good cookies are for this kind of persistent state management between HTTP requests, they have long been under fire for security risks associated with JavaScript security exploits and privacy abuse by large data tracking companies. Because of these reasons, web users will sometimes turn off their cookies, rendering normal ASP session implementations powerless, resulting in a new $Session generated every request. This is not good for ASP style sessions. Cookieless Sessions *** See WARNING Below *** So we now have more ways to track sessions with the SessionQuery* CONFIG settings, that allow a web developer to embed the session id in URL query strings when use of cookies is denied. The implementations work such that if a user has cookies turned on, then cookies will be used, but for those users with cookies turned off, the session ids will be parsed into document URLs. The first and easiest method that a web developer may use to implement cookieless sessions are with SessionQueryParse* directives which enable Apache::ASP to the parse the session id into document URLs on the fly. Because this is resource inefficient, there is also the SessionQuery* directives that may be used with the $Server->URL($url,\%params) method to generate custom URLs with the session id in its query string. To see an example of these cookieless sessions in action, check out the ./site/eg/session_query_parse.asp example. *** WARNING *** If you do use these methods, then be VERY CAREFUL of linking offsite from a page that was accessed with a session id in a query string. This is because this session id will show up in the HTTP_REFERER logs of the linked to site, and a malicious hacker could use this information to compromise the security of your site's $Sessions, even if these are run under a secure web server. In order to shake a session id off an HTTP_REFERER for a link taking a user offsite, you must point that link to a redirect page that will redirect a user, like so: <% # "cross site scripting bug" prevention my $sanitized_url = $Server->HTMLEncode($Response->QueryString('OffSiteUrl')); %> Redirecting you offsite to >here... Because the web browser visits a real page before being redirected with the tag, the HTTP_REFERER will be set to this page. Just be sure to not link to this page with a session id in its query string. Unfortunately a simple $Response->Redirect() will not work here, because the web browser will keep the HTTP_REFERER of the original web page if only a normal redirect is used. XML/XSLT Custom Tags with XMLSubsMatch Before XML, there was the need to make HTML markup smarter. Apache::ASP gives you the ability to have a perl subroutine handle the execution of any predefined tag, taking the tag descriptors, and the text contained between, as arguments of the subroutine. This custom tag technology can be used to extend a web developer's abilities to add dynamic pieces without having to visibly use <% %> style code entries. So, lets say that you have a table that you want to insert for an employee with contact info and the like, you could set up a tag like: Jane Doe has been here since 1998. To render it with a custom tag, you would tell the Apache::ASP parser to render the tag with a subroutine: PerlSetVar XMLSubsMatch my:new-employee Any colons, ':', in the XML custom tag will turn into '::', a perl package separator, so the my:employee tag would translate to the my::employee subroutine, or the employee subroutine in the my package. Any dash "-" will also be translated to an underscore "_", as dash is not valid in the names of perl subroutines. Then you would create the my::employee subroutine in the my perl package or whereever like so: package my; sub new_employee { my($attributes, $body) = @_; $main::Response->Include('new_employee.inc', $attributes, $body); } 1; <% my($attributes, $body) = @_; %> <% for('name', 'last', 'phone') { %> <% } %>
<%=ucfirst $_ %>: <%= $attributes->{$_} %>
<%= $body %>
The $main::Response->Include() would then delegate the rendering of the new-employee to the new_employee.inc ASP script include. Though XML purists would not like this custom tag technology to be related to XML, the reality is that a careful site engineer could render full XML documents with this technology, applying all the correct styles that one might otherwise do with XSLT. Custom tags defined in this way can be used as XML tags are defined with both a body and without as it ... and just These tags are very powerful in that they can also enclose normal ASP logic, like: <% my $birthday = &HTTP::Date::time2str(time - 25 * 86400 * 365); %> This employee has been online for <%= int(rand()*600)+1 %> seconds, and was born near <%= $birthday %>. For an example of this custom XML tagging in action, please check out the ./site/eg/xml_subs.asp script. XSLT Tranformations XML is good stuff, but what can you use it for? The principle is that by having data and style separated in XML and XSL files, you can reformat your data more easily in the future, and you can render your data in multiple formats, just as easily as for your web site, so you might render your site to a PDA, or a cell phone just as easily as to a browser, and all you have to do is set up the right XSL stylesheets to do the transformation (XSLT). With native XML/XSLT support, Apache::ASP scripts may be the source of XML data that the XSL file transforms, and the XSL file itself will be first executed as an ASP script also. The XSLT transformation is handled by XML::XSLT or XML::Sablotron and you can see an example of it in action at the ./site/eg/xslt.xml XML script. To specify a XSL stylesheet, use the setting: PerlSetVar XSLT template.xsl where template.xsl could be any file. By default this will XSLT transform all ASP scripts so configured, but you can separate xml scripts from the rest with the setting: PerlSetVar XSLTMatch xml$ where all files with the ending xml would undergo a XSLT transformation. Note that XSLT depends on the installation of XML::XSLT, which in turn depends on XML::DOM, and XML::Parser. As of version 2.11, XML::Sablotron may also be used by setting: PerlSetVar XSLTParser XML::Sablotron and XML::LibXSLT may be used, as of 2.29, by setting PerlSetVar XSLTParser XML::LibXSLT If you would like to install XML::Sablotron or XML::LibXSLT, you will first have to install the libraries that these perl modules use, which you can get at: libxslt - The XSLT C Library for Gnome http://xmlsoft.org/XSLT/ Sablotron - Ginger Alliance http://www.gingerall.com For more on XML::XSLT, the default XSLT engine that Apache::ASP will use, please see: XML::XSLT http://xmlxslt.sourceforge.net/ XML:XSLT was the first supported XSLT engine as has the benefit of being written in pure perl so that though while it is slower than the other solutions, it is easier to port. If you would like to cache XSLT tranformations, which is highly recommended, just set: PerlSetVar XSLTCache 1 Please see the Cache settings in the CONFIG section for more about how to configure the XSLTCache. References For more information about XSLT, please see the standard at: http://www.w3.org/TR/xslt For their huge ground breaking XML efforts, these other XML OSS projects need mention: Cocoon - XML-based web publishing, in Java http://cocoon.apache.org/ AxKit - XML web publishing with Apache & mod_perl http://www.axkit.org/ CGI CGI has been the standard way of deploying web applications long before ASP came along. In the CGI gateway world, CGI.pm has been a widely used module in building CGI applications, and Apache::ASP is compatible with scripts written with CGI.pm. Also, as of version 2.19, Apache::ASP can run in standalone CGI mode for the Apache web server without mod_perl being available. See "Standalone CGI Mode" section below. Following are some special notes with respect to compatibility with CGI and CGI.pm. Use of CGI.pm in any of these ways was made possible through a great amount of work, and is not guaranteed to be portable with other perl ASP implementations, as other ASP implementations will likely be more limited. Standalone CGI Mode, without mod_perl As of version 2.19, Apache::ASP scripts may be run as standalone CGI scripts without mod_perl being loaded into Apache. Work to date has only been done with mod_cgi scripts under Apache on a Unix platform, and it is unlikely to work under other web servers or Win32 operating systems without further development. To run the ./site/eg scripts as CGI scripts, you copy the ./site directory to some location accessible by your web server, in this example its /usr/local/apache/htdocs/aspcgi, then in your httpd.conf activate Apache::ASP cgi scripts like so: Alias /aspcgi/ /usr/local/apache/htdocs/aspcgi/ AddType application/x-httpd-cgi .htm AddType application/x-httpd-cgi .html AddType application/x-httpd-cgi .asp AddType application/x-httpd-cgi .xml AddType application/x-httpd-cgi .ssi AllowOverride None Options +ExecCGI +Indexes Then install the asp-perl script from the distribution into /usr/bin, or some other directory. This is so the CGI execution line at the top of those scripts will invoke the asp-perl wrapper like so: #!/usr/bin/perl /usr/bin/asp-perl The asp-perl script is a cgi wrapper that sets up the Apache::ASP environment in lieu of the normal mod_perl handler request. Because there is no Apache->dir_config() data available under mod_cgi, the asp-perl script will load a asp.conf file that may define a hash %Config of data for populating the dir_config() data. An example of a complex asp.conf file is at ./site/eg/asp.conf So, a trivial asp.conf file might look like: # asp.conf %Config = ( 'Global' => '.', 'StateDir' => '/tmp/aspstate', 'NoState' => 0, 'Debug' => 3, ); The default for NoState is 1 in CGI mode, so one must set NoState to 0 for objects like $Session & $Application to be defined. CGI.pm CGI.pm is a very useful module that aids developers in the building of these applications, and Apache::ASP has been made to be compatible with function calls in CGI.pm. Please see cgi.htm in the ./site/eg directory for a sample ASP script written almost entirely in CGI. As of version 0.09, use of CGI.pm for both input and output is seamless when working under Apache::ASP. Thus if you would like to port existing cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around the script to get going. This functionality has been implemented so that developers may have the best of both worlds when building their web applications. For more information about CGI.pm, please see the web site http://search.cpan.org/dist/CGI/ Query Object Initialization You may create a CGI.pm $query object like so: use CGI; my $query = new CGI; As of Apache::ASP version 0.09, form input may be read in by CGI.pm upon initialization. Before, Apache::ASP would consume the form input when reading into $Request->Form(), but now form input is cached, and may be used by CGI.pm input routines. CGI headers Not only can you use the CGI.pm $query->header() method to put out headers, but with the CgiHeaders config option set to true, you can also print "Header: value\n", and add similar lines to the top of your script, like: Some-Header: Value Some-Other: OtherValue Script body starts here. Once there are no longer any cgi style headers, or the there is a newline, the body of the script begins. So if you just had an asp script like: print join(":", %{$Request->QueryString}); You would likely end up with no output, as that line is interpreted as a header because of the semicolon. When doing basic debugging, as long as you start the page with you will avoid this problem. print()ing CGI CGI is notorious for its print() statements, and the functions in CGI.pm usually return strings to print(). You can do this under Apache::ASP, since print just aliases to $Response->Write(). Note that $| has no affect. print $query->header(); print $query->start_form(); File Upload CGI.pm is used for implementing reading the input from file upload. You may create the file upload form however you wish, and then the data may be recovered from the file upload by using $Request->Form(). Data from a file upload gets written to a file handle, that may in turn be read from. The original file name that was uploaded is the name of the file handle. my $filehandle = $Request->Form('file_upload_field_name'); print $filehandle; # will get you the file name my $data; while(read($filehandle, $data, 1024)) { # data from the uploaded file read into $data }; Please see the docs on CGI.pm (try perldoc CGI) for more information on this topic, and ./site/eg/file_upload.asp for an example of its use. Also, for more details about CGI.pm itself, please see the web site: http://search.cpan.org/dist/CGI/ Occasionally, a newer version of CGI.pm will be released which breaks file upload compatibility with Apache::ASP. If you find this to occur, then you might consider downgrading to a version that works. For example, one can install a working CGI.pm v2.78 for a working version, and to get old versions of this module, one can go to BACKPAN at: http://backpan.cpan.org/modules/by-authors/id/L/LD/LDS/ There is also $Request->FileUpload() API extension that you can use to get more data about a file upload, so that the following properties are available for querying: my $file_upload = $Request->{FileUpload}{upload_field}; $file_upload->{BrowserFile} $file_upload->{FileHandle} $file_upload->{ContentType} # only if FileUploadTemp is set $file_upload->{TempFile} # whatever mime headers are sent with the file upload # just "keys %$file_upload" to find out $file_upload->{?Mime-Header?} Please see the $Request section in OBJECTS for more information. PERLSCRIPT Much work has been done to bring compatibility with ASP applications written in PerlScript under IIS. Most of that work revolved around bringing a Win32::OLE Collection interface to many of the objects in Apache::ASP, which are natively written as perl hashes. New as of version 2.05 is new functionality enabled with the CollectionItem setting, to giver better support to more recent PerlScript syntax. This seems helpful when porting from an IIS/PerlScript code base. Please see the CONFIG section for more info. The following objects in Apache::ASP respond as Collections: $Application $Session $Request->FileUpload * $Request->FileUpload('upload_file') * $Request->Form $Request->QueryString $Request->Cookies $Response->Cookies $Response->Cookies('some_cookie') * FileUpload API Extensions And as such may be used with the following syntax, as compared with the Apache::ASP native calls. Please note the native Apache::ASP interface is compatible with the deprecated PerlScript interface. C = PerlScript Compatibility N = Native Apache::ASP ## Collection->Contents($name) [C] $Application->Contents('XYZ') [N] $Application->{XYZ} ## Collection->SetProperty($property, $name, $value) [C] $Application->Contents->SetProperty('Item', 'XYZ', "Fred"); [N] $Application->{XYZ} = "Fred" ## Collection->GetProperty($property, $name) [C] $Application->Contents->GetProperty('Item', 'XYZ') [N] $Application->{XYZ} ## Collection->Item($name) [C] print $Request->QueryString->Item('message'), "
\n\n"; [N] print $Request->{QueryString}{'message'}, "
\n\n"; ## Working with Cookies [C] $Response->SetProperty('Cookies', 'Testing', 'Extra'); [C] $Response->SetProperty('Cookies', 'Testing', {'Path' => '/'}); [C] print $Request->Cookies(Testing) . "
\n"; [N] $Response->{Cookies}{Testing} = {Value => Extra, Path => '/'}; [N] print $Request->{Cookies}{Testing} . "
\n"; Several incompatibilities exist between PerlScript and Apache::ASP: > Collection->{Count} property has not been implemented. > VBScript dates may not be used for Expires property of cookies. > Win32::OLE::in may not be used. Use keys() to iterate over. > The ->{Item} property does not work, use the ->Item() method. STYLE GUIDE Here are some general style guidelines. Treat these as tips for best practices on Apache::ASP development if you will. UseStrict One of perl's blessings is also its bane, variables do not need to be declared, and are by default globally scoped. The problem with this in mod_perl is that global variables persist from one request to another even if a different web browser is viewing a page. To avoid this problem, perl programmers have often been advised to add to the top of their perl scripts: use strict; In Apache::ASP, you can do this better by setting: PerlSetVar UseStrict 1 which will cover both script & global.asa compilation and will catch "use strict" errors correctly. For perl modules, please continue to add "use strict" to the top of them. Because its so essential in catching hard to find errors, this configuration will likely become the default in some future release. For now, keep setting it. Do not define subroutines in scripts. DO NOT add subroutine declarations in scripts. Apache::ASP is optimized by compiling a script into a subroutine for faster future invocation. Adding a subroutine definition to a script then looks like this to the compiler: sub page_script_sub { ... ... some HTML ... ... sub your_sub { ... } ... } The biggest problem with subroutines defined in subroutines is the side effect of creating closures, which will not behave as usually desired in a mod_perl environment. To understand more about closures, please read up on them & "Nested Subroutines" at: http://perl.apache.org/docs/general/perl_reference/perl_reference.html Instead of defining subroutines in scripts, you may add them to your sites global.asa, or you may create a perl package or module to share with your scripts. For more on perl objects & modules, please see: http://perldoc.perl.org/perlobj.html Use global.asa's Script_On* Events Chances are that you will find yourself doing the same thing repeatedly in each of your web application's scripts. You can use Script_OnStart and Script_OnEnd to automate these routine tasks. These events are called before and after each script request. For example, let's say you have a header & footer you would like to include in the output of every page, then you might: # global.asa sub Script_OnStart { $Response->Include('header.inc'); } sub Script_OnEnd { $Response->Include('footer.inc'); } Or let's say you want to initialize a global database connection for use in your scripts: # global.asa use Apache::DBI; # automatic persistent database connections use DBI; use vars qw($dbh); # declare global $dbh sub Script_OnStart { # initialize $dbh $dbh = DBI->connect(...); # force you to explicitly commit when you want to save data $Server->RegisterCleanup(sub { $dbh->rollback; }); } sub Script_OnEnd { # not really necessary when using persistent connections, but # will free this one object reference at least $dbh = undef; } FAQ The following are some frequently asked questions about Apache::ASP. Installation Examples don't work, I see the ASP script in the browser? This is most likely that Apache is not configured to execute the Apache::ASP scripts properly. Check the INSTALL QuickStart section for more info on how to quickly set up Apache to execute your ASP scripts. Apache Expat vs. XML perl parsing causing segfaults, what do I do? Make sure to compile apache with expat disabled. The ./make_httpd/build_httpds.sh in the distribution will do this for you, with the --disable-rule=EXPAT in particular: cd ../$APACHE echo "Building apache ==============================" ./configure \ --prefix=/usr/local/apache \ --activate-module=src/modules/perl/libperl.a \ --enable-module=ssl \ --enable-module=proxy \ --enable-module=so \ --disable-rule=EXPAT ^^^^^ keywords: segmentation fault, segfault seg fault Why do variables retain their values between requests? Unless scoped by my() or local(), perl variables in mod_perl are treated as globals, and values set may persist from one request to another. This can be seen in as simple a script as this: $counter++; $Response->Write("
Counter: $counter"); The value for $counter++ will remain between requests. Generally use of globals in this way is a BAD IDEA, and you can spare yourself many headaches if do "use strict" perl programming which forces you to explicity declare globals like: use vars qw($counter); You can make all your Apache::ASP scripts strict by default by setting: PerlSetVar UseStrict 1 Apache errors on the PerlHandler or PerlModule directives ? You get an error message like this: Invalid command 'PerlModule', perhaps mis-spelled or defined by a module not included in the server configuration. You do not have mod_perl correctly installed for Apache. The PerlHandler and PerlModule directives in Apache *.conf files are extensions enabled by mod_perl and will not work if mod_perl is not correctly installed. Common user errors are not doing a 'make install' for mod_perl, which installs the perl side of mod_perl, and not starting the right httpd after building it. The latter often occurs when you have an old apache server without mod_perl, and you have built a new one without copying over to its proper location. To get mod_perl, go to http://perl.apache.org Error: no request object (Apache=SCALAR(0x???????):) Your Apache + mod_perl build is not working properly, and is likely a RedHat Linux RPM DSO build. Make sure you statically build your Apache + mod_perl httpd, recompiled fresh from the sources. I am getting a tie or MLDBM / state error message, what do I do? Make sure the web server or you have write access to the eg directory, or to the directory specified as Global in the config you are using. Default for Global is the directory the script is in (e.g. '.'), but should be set to some directory not under the www server document root, for security reasons, on a production site. Usually a chmod -R -0777 eg will take care of the write access issue for initial testing purposes. Failing write access being the problem, try upgrading your version of Data::Dumper and MLDBM, which are the modules used to write the state files. Sessions How can I use $Session to store complex data structures. Very carefully. Please read the $Session documentation in the OBJECTS section. You can store very complex objects in $Session, but you have to understand the limits, and the syntax that must be used to make this happen. In particular, stay away from statements that that have more than one level of indirection on the left side of an assignment like: BAD: $Session->{complex}{object} = $data; How can I keep search engine spiders from killing the session manager? If you want to disallow session creation for certain non web browser user agents, like search engine spiders, you can use a mod_perl PerlInitHandler like this to set configuration variables at runtime: # put the following code into httpd.conf and stop/start apache server PerlInitHandler My::InitHandler package My::InitHandler; use Apache; sub handler { my $r = shift; # get the Apache request object # if not a Mozilla User Agent, then disable sessions explicitly unless($r->headers_in('User-Agent') =~ /^Mozilla/) { $r->dir_config('AllowSessionState', 'Off'); } return 200; # return OK mod_perl status code } 1; This will configure your environment before Apache::ASP executes and sees the configuration settings. You can use the mod_perl API in this way to configure Apache::ASP at runtime. Note that the Session Manager is very robust on its own, and denial of service attacks of the types that spiders and other web bots normally execute are not likely to affect the Session Manager significantly. How can I use $Session to store a $dbh database handle ? You cannot use $Session to store a $dbh handle. This can be awkward for those coming from the IIS/NT world, where you could store just about anything in $Session, but this boils down to a difference between threads vs. processes. Database handles often have per process file handles open, which cannot be shared between requests, so though you have stored the $dbh data in $Session, all the other initializations are not relevant in another httpd process. All is not lost! Apache::DBI can be used to cache database connections on a per process basis, and will work for most cases. Development VBScript or JScript supported? Only Perl scripting is supported with this module. How is database connectivity handled? Database connectivity is handled through perl's DBI & DBD interfaces. In the UNIX world, it seems most databases have cross platform support in perl. You can find the book on DBI programming at http://www.oreilly.com/catalog/perldbi/ DBD::ODBC is often your ticket on Win32. On UNIX, commercial vendors like OpenLink Software (http://www.openlinksw.com/) provide the nuts and bolts for ODBC. Database connections can be cached per process with Apache::DBI. What is the best way to debug an ASP application ? There are lots of perl-ish tricks to make your life developing and debugging an ASP application easier. For starters, you will find some helpful hints by reading the $Response->Debug() API extension, and the Debug configuration directive. How are file uploads handled? Please see the CGI section. File uploads are implemented through CGI.pm which is loaded at runtime only for this purpose. This is the only time that CGI.pm will be loaded by Apache::ASP, which implements all other cgi-ish functionality natively. The rationale for not implementing file uploads natively is that the extra 100K in memory for CGI.pm shouldn't be a big deal if you are working with bulky file uploads. How do I access the ASP Objects in general? All the ASP objects can be referenced through the main package with the following notation: $main::Response->Write("html output"); This notation can be used from anywhere in perl, including routines registered with $Server->RegisterCleanup(). You use the normal notation in your scripts, includes, and global.asa: $Response->Write("html output"); Can I print() in ASP? Yes. You can print() from anywhere in an ASP script as it aliases to the $Response->Write() method. Using print() is portable with PerlScript when using Win32::ASP in that environment. Do I have access to ActiveX objects? Only under Win32 will developers have access to ActiveX objects through the perl Win32::OLE interface. This will remain true until there are free COM ports to the UNIX world. At this time, there is no ActiveX for the UNIX world. Support and Production How do I get things I want done?! If you find a problem with the module, or would like a feature added, please mail support, as listed in the SUPPORT section, and your needs will be promptly and seriously considered, then implemented. What is the state of Apache::ASP? Can I publish a web site on it? Apache::ASP has been production ready since v.02. Work being done on the module is on a per need basis, with the goal being to eventually have the ASP API completed, with full portability to ActiveState PerlScript and MKS PScript. If you can suggest any changes to facilitate these goals, your comments are welcome. TUNING A little tuning can go a long way, and can make the difference between a web site that gets by, and a site that screams with speed. With Apache::ASP, you can easily take a poorly tuned site running at 10 hits/second to 50+ hits/second just with the right configuration. Documented below are some simple things you can do to make the most of your site. Online Resources For more tips & tricks on tuning Apache and mod_perl, please see the tuning documents at: Stas Bekman's mod_perl guide http://perl.apache.org/guide/ Written in late 1999 this article provides an early look at how to tune your Apache::ASP web site. It has since been updated to remain current with Apache::ASP v2.29+ Apache::ASP Site Tuning http://www.apache-asp.org/articles/perlmonth3_tune.html Tuning & Benchmarking When performance tuning, it is important to have a tool to measure the impact of your tuning change by change. The program ab, or Apache Bench, provides this functionality well, and is freely included in the apache distribution. Because performance tuning can be a neverending affair, it is a good idea to establish a threshold where performance is "good enough", that once reached, tuning stops. $Application & $Session State Use NoState 1 setting if you don't need the $Application or $Session objects. State objects such as these tie to files on disk and will incur a performance penalty. If you need the state objects $Application and $Session, and if running an OS that caches files in memory, set your "StateDir" directory to a cached file system. On WinNT, all files may be cached, and you have no control of this. On Solaris, /tmp is a RAM disk and would be a good place to set the "StateDir" config setting to. When cached file systems are used there is little performance penalty for using state files. Linux tends to do a good job caching its file systems, so pick a StateDir for ease of system administration. On Win32 systems, where mod_perl requests are serialized, you can freely use SessionSerialize to make your $Session requests faster, and you can achieve similar performance benefits for $Application if you call $Application->Lock() in your global.asa's Script_OnStart. Low MaxClients Set your MaxClients low, such that if you have that many httpd servers running, which will happen on busy site, your system will not start swapping to disk because of excessive RAM usage. Typical settings are less than 100 even with 1 gig RAM! To handle more client connections, look into a dual server, mod_proxy front end. High MaxRequestsPerChild Set your max requests per child thread or process (in httpd.conf) high, so that ASP scripts have a better chance being cached, which happens after they are first compiled. You will also avoid the process fork penalty on UNIX systems. Somewhere between 50 - 500 is probably pretty good. You do not want to set this too high though or you will risk having your web processes use too much RAM. One may use Apache::SizeLimit or Apache::GTopLimit to optimally tune MaxRequestsPerChild at runtime. Precompile Modules For those modules that your Apache::ASP application uses, make sure that they are loaded in your sites startup.pl file, or loaded with PerlModule in your httpd.conf, so that your modules are compiled pre-fork in the parent httpd. Precompile Scripts Precompile your scripts by using the Apache::ASP->Loader() routine documented below. This will at least save the first user hitting a script from suffering compile time lag. On UNIX, precompiling scripts upon server startup allows this code to be shared with forked child www servers, so you reduce overall memory usage, and use less CPU compiling scripts for each separate www server process. These savings could be significant. On a PII300 Solaris x86, it takes a couple seconds to compile 28 scripts upon server startup, with an average of 50K RAM per compiled script, and this savings is passed on to the ALL child httpd servers, so total savings would be 50Kx28x20(MaxClients)=28M! Apache::ASP->Loader() can be called to precompile scripts and even entire ASP applications at server startup. Note also that in modperl, you can precompile modules with the PerlModule config directive, which is highly recommended. Apache::ASP->Loader($path, $pattern, %config) This routine takes a file or directory as its first argument. If a file, that file will be compiled. If a directory, that directory will be recursed, and all files in it whose file name matches $pattern will be compiled. $pattern defaults to .*, which says that all scripts in a directory will be compiled by default. The %config args, are the config options that you may want set that affect compilation. These options include: Debug, Global, GlobalPackage, DynamicIncludes, IncludesDir, InodeNames, PodComments, StatINC, StatINCMatch, UseStrict, XMLSubsPerlArgs, XMLSubsMatch, and XMLSubsStrict. If your scripts are later run with different config options, your scripts may have to be recompiled. Here is an example of use in a *.conf file: Apache::ASP->Loader( '/usr/local/proj/site', "(asp|htm)\$", 'Global' => '/proj/perllib', 'Debug' => -3, # see system output when starting apache # OPTIONAL configs if you use them in your apache configuration # these settings affect how the scripts are compiled and loaded 'GlobalPackage' => 'SomePackageName', 'DynamicIncludes' => 1, 'StatINC' => 1, 'StatINCMatch' => 'My', 'UseStrict' => 1, 'XMLSubsMatch' => 'my:\w+', 'XMLSubsStrict' => 0 || 1, ); This config section tells the server to compile all scripts in c:/proj/site that end in asp or htm, and print debugging output so you can see it work. It also sets the Global directory to be /proj/perllib, which needs to be the same as your real config since scripts are cached uniquely by their Global directory. You will probably want to use this on a production server, unless you cannot afford the extra startup time. To see precompiling in action, set Debug to 1 for the Loader() and for your application in general and watch your error_log for messages indicating scripts being cached. No .htaccess or StatINC Don't use .htaccess files or the StatINC setting in a production system as there are many more files touched per request using these features. I've seen performance slow down by half because of using these. For eliminating the .htaccess file, move settings into *.conf Apache files. Instead of StatINC, try using the StatINCMatch config, which will check a small subset of perl libraries for changes. This config is fine for a production environment, and if used well might only incur a 10-20% performance penalty, depending on the number of modules your system loads in all, as each module needs to be checked for changes on a per request basis. Turn off Debugging Turn off system debugging by setting Debug to 0-3. Having the system debug config option on slows things down immensely, but can be useful when troubleshooting your application. System level debugging is settings -3 through -1, where user level debugging is 1 to 3. User level debugging is much more light weight depending on how many $Reponse->Debug() statements you use in your program, and you may want to leave it on. Memory Sparing, NoCache If you have a lot (1000's+) of scripts, and limited memory, set NoCache to 1, so that compiled scripts are not cached in memory. You lose about 10-15% in speed for small scripts, but save at least 10K RAM per cached script. These numbers are very rough and will largely depend on the size of your scripts and includes. Resource Limits Make sure your web processes do not use too many resources like CPU or RAM with the handy Apache::Resource module. Such a config might look like: PerlModule Apache::Resource PerlSetEnv PERL_RLIMIT_CPU 1000 PerlSetEnv PERL_RLIMIT_DATA 60:60 If ever a web process should begin to take more than 60M ram or use more than 1000 CPU seconds, it will be killed by the OS this way. You only want to use this configuration to protect against runaway processes and web program errors, not for terminating a normally functioning system, so set these limits HIGH! SEE ALSO perl(1), mod_perl(3), Apache(3), MLDBM(3), HTTP::Date(3), CGI(3), Win32::OLE(3) NOTES Many thanks to those who helped me make this module a reality. With Apache + ASP + Perl, web development could not be better! Special thanks go to my father Kevin & wife Lina for their love and support through it all, and without whom none of it would have been possible. Other honorable mentions include: !! Gregory Youngblood, Thanos Chatziathanassiou, & Tsirkin Evgeny for keeping the flame alive! :) Doug MacEachern, for moral support and of course mod_perl :) Helmut Zeilinger, Skylos, John Drago, and Warren Young for their help in the community :) Randy Kobes, for the win32 binaries, and for always being the epitome of helpfulness :) Francesco Pasqualini, for bug fixes with stand alone CGI mode on Win32 :) Szymon Juraszczyk, for better ContentType handling for settings like Clean. :) Oleg Kobyakovskiy, for identifying the double Session_OnEnd cleanup bug. :) Peter Galbavy, for reporting numerous bugs and maintaining the OpenBSD port. :) Richard Curtis, for reporting and working through interesting module loading issues under mod_perl2 & apache2, and pushing on the file upload API. :) Rune Henssel, for catching a major bug shortly after 2.47 release, and going to great lengths to get me reproducing the bug quickly. :) Broc, for keeping things filter aware, which broke in 2.45, & much help on the list. :) Manabu Higashida, for fixes to work under perl 5.8.0 :) Slaven Rezic, for suggestions on smoother CPAN installation :) Mitsunobu Ozato, for working on a japanese translation of the site & docs. :) Eamon Daly for persistence in resolving a MailErrors bug. :) Gert, for help on the mailing list, and pushing the limits of use on Win32 in addition to XSLT. :) Maurice Aubrey, for one of the early fixes to the long file name problem. :) Tom Lancaster, for pushing the $Server->Mail API and general API discussion. :) Ross Thomas, for pushing into areas so far unexplored. :) Harald Kreuzer, for bug discovery & subsequent testing in the 2.25 era. :) Michael Buschauer for his extreme work with XSLT. :) Dariusz Pietrzak for a nice parser optimization. :) Ime Smits, for his inode patch facilitating cross site code reuse, and some nice performance enhancements adding another 1-2% speed. :) Michael Davis, for easier CPAN installation. :) Brian Wheeler, for keeping up with the Apache::Filter times, and pulling off filtering ASP->AxKit. :) Ged Haywood, for his great help on the list & professionally. :) Vee McMillen, for OSS patience & understanding. :) Craig Samuel, at LRN, for his faith in open source for his LCEC. :) Geert Josten, for his wonderful work on XML::XSLT :) Gerald Richter, for his Embperl, collaboration and competition! :) Stas Bekman, for his beloved guide, and keeping us all worldly. :) Matt Sergeant, again, for ever the excellent XML critique. :) Remi Fasol + Serge Sozonoff who inspired cookieless sessions. :) Matt Arnold, for the excellent graphics ! :) Adi, who thought to have full admin control over sessions :) Dmitry Beransky, for sharable web application includes, ASP on the big. :) Russell Weiss again, for finding the internal session garbage collection behaving badly with DB_File sensitive i/o flushing requirements. :) Tony Merc Mobily, inspiring tweaks to compile scripts 10 times faster :) Paul Linder, who is Mr. Clean... not just the code, its faster too ! Boy was that just the beginning. Work with him later facilitated better session management and XMLSubsMatch custom tag technology. :) Russell Weiss, for being every so "strict" about his code. :) Bill McKinnon, who understands the finer points of running a web site. :) Richard Rossi, for his need for speed & boldly testing dynamic includes. :) Greg Stark, for endless enthusiasm, pushing the module to its limits. :) Marc Spencer, who brainstormed dynamic includes. :) Doug Silver, for finding most of the bugs. :) Darren Gibbons, the biggest cookie-monster I have ever known. :) Ken Williams, for great teamwork bringing full SSI to the table :) Matt Sergeant, for his great tutorial on PerlScript and love of ASP :) Jeff Groves, who put a STOP to user stop button woes :) Alan Sparks, for knowing when size is more important than speed :) Lincoln Stein, for his blessed CGI.pm module :) Michael Rothwell, for his love of Session hacking :) Francesco Pasqualini, for bringing ASP to CGI :) Bryan Murphy, for being a PerlScript wiz :) Lupe Christoph, for his immaculate and stubborn testing skills :) Ryan Whelan, for boldly testing on Unix in the early infancy of ASP SUPPORT COMMUNITY Mailing List Archives Try the Apache::ASP mailing list archive first when working through an issue as others may have had the same question as you, then try the mod_perl list archives since often problems working with Apache::ASP are really mod_perl ones. The Apache::ASP mailing list archives are located at: http://groups.yahoo.com/group/apache-asp/ http://www.mail-archive.com/asp%40perl.apache.org/ The mod_perl mailing list archives are located at: http://mail-archives.apache.org/mod_mbox/perl-modperl/ Mailing List Please subscribe to the Apache::ASP mailing list by sending an email to asp-subscribe[at]perl.apache.org and send your questions or comments to the list after your subscription is confirmed. To unsubscribe from the Apache::ASP mailing list, just send an email to asp-unsubscribe[at]perl.apache.org If you think this is a mod_perl specific issue, you can send your question to modperl[at]apache.org Donations Apache::ASP is freely distributed under the terms of the Perl artistic license ( see the LICENSE section ). If you would like to donate time to the project, please get involved on the Apache::ASP Mailing List, and submit ideas, bug fixes and patches for the core system, and perhaps most importantly to simply support others in learning the ins and outs of the software. COMMERCIAL If you would like commercial support for Apache::ASP, please check out any of the following listed companies. Note that this is not an endorsement, and if you would like your company listed here, please email asp[at]perl.apache.org with your information. AlterCom We use, host and support mod_perl. We would love to be able to help anyone with their mod_perl Apache::ASP needs. Our mod_perl hosting is $24.95 mo. http://altercom.com/home.html The Cyberchute Connection Our hosting services support Apache:ASP along with Mod_Perl, PHP and MySQL. http://www.Cyberchute.com OmniTI OmniTI supports Apache and mod_perl (including Apache::ASP) and offers competitive pricing for both hourly and project-based jobs. OmniTI has extensive experience managing and maintaining both large and small projects. Our services range from short-term consulting to project-based development, and include ongoing maintenance and hosting. http://www.omniti.com TUX IT AG Main business is implementing and maintaining infrastructure for big websites and portals, as well as developing web applications for our customers (Apache, Apache::ASP, PHP, Perl, MySQL, etc.) The prices for our service are about 900 EUR per day which is negotiable (for longer projects, etc.). http://www.tuxit.de SITES USING What follows is a list of public sites that are using Apache::ASP. If you use the software for your site, and would like to show your support of the software by being listed, please send your link to asp[at]perl.apache.org For a list of testimonials of those using Apache::ASP, please see the TESTIMONIALS section. PERSONiO Match http://www.personio.com/home.asp gutscheinwurst.de - a German voucher community http://www.gutscheinwurst.de SalesJobs.com http://www.salesjobs.com hanschur.de http://www.hanschur.de Webtist http://www.webtist.de FreeLotto http://www.freelotto.com Hungarian TOP1000 http://www.hungariantop1000.com Hungarian Registry http://www.hunreg.com Kepeslap.com http://www.kepeslap.com yourpostcardsite.com http://www.yourpostcardsite.com WebTime http://webtime-project.net AlterCom, Advanced Web Hosting http://altercom.com/ AmericanGamers.com http://www.AmericanGamers.com/ ESSTECwebservices http://www.esstec.be/ Alumni.NET http://www.alumni.net Anime Wallpapers dot com http://www.animewallpapers.com/ Cine.gr http://www.cine.gr Condo-Mart Web Service http://www.condo-mart.com Discountclick.com http://www.discountclick.com/ HCST http://www.hcst.net International Telecommunication Union http://www.itu.int Integra http://www.integra.ru/ Money FM http://www.moneyfm.gr Motorsport.com http://www.motorsport.com MLS of Greater Cincinnati http://www.cincymls.com NodeWorks Link Checker http://www.nodeworks.com OnTheWeb Services http://www.ontheweb.nu Prices for Antiques http://www.p4a.com redhat.com | support http://www.redhat.com/apps/support/ Spotlight http://www.spotlight.com.au USCD Electrical & Computer Engineering http://ece-local.ucsd.edu TESTIMONIALS Here are testimonials from those using Apache::ASP. If you use this software and would like to show your support please send your testimonial to Apache::ASP mailing list at asp[at]perl.apache.org and indicate that we can post it to the web site. For a list of sites using Apache::ASP, please see the SITES USING section. Red Hat We're using Apache::ASP on www.redhat.com. We find Apache::ASP very easy to use, and it's quick for new developers to get up to speed with it, given that many people have already been exposed to the ASP object model that Apache::ASP is based on. The documentation is comprehensive and easy to understand, and the community and maintainer have been very helpful whenever we've had questions. -- Tom Lancaster, Red Hat Anime Wallpaper at Anime Cubed Your suite has got our old CGI implementation beat, hands down. Our site is divided into two main areas, each run by a separate developer, and the Apache::ASP section runs head and shoulders above the other side. Anyone who is still using anything but your product to implement their webpages seriously needs to take a look at how versatile and powerful Apache::ASP is. Thanks again for such great work! -- Al from 'Anime Wallpaper at Anime Cubed', http://www.animecubed.com/wallpapers/ gutscheinwurst.de I am the web master of http://www.gutscheinwurst.de , a German voucher community. We use Apache::Asp to run our backend & administration servers for the system. We started using Apache::ASP to see whether it is a valid alternative to IIS legacy systems. So far all expectations in regard of performance, ease of development and integration have been fulfilled or exceeded. Thank's for such a great product :) -- Johnannes Leimbach D. L. Fox I had programmed in Perl for some time ... but, since I also knew VB, I had switched to VB in IIS-ASP for web stuff because of its ease of use in embedding code with HTML ... When I discovered Apache-ASP, it was like a dream come true. I would much rather code in Perl than any other language. Thanks for such a fine product! HOSTING 321, LLC. After discontinuing Windows-based hosting due to the high cost of software, our clients are thrilled with Apache::ASP and they swear ASP it's faster than before. Installation was a snap on our 25-server web farm with a small shell script and everything is running perfectly! The documentation is very comprehensive and everyone has been very helpful during this migration. Thank you! -- Richard Ward, HOSTING 321, LLC. Concept Online Ltd. I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not "forced" to use JSP, we chose ASP. It is fast, reliable, versatile, documented in a way that is the best for professionals - so thank you for writting and maintaining it! -- Csongor Fagyal, Concept Online Ltd. WebTime As we have seen with WebTime, Apache::ASP is not only good for the development of website, but also for the development of webtools. Since I first discoverd it, I made it a must-have in my society by taking traditional PHP users to the world of perl afficionados. Having the possibility to use Apache::ASP with mod_perl or mod_cgi make it constraintless to use because of CGI's universality and perl's portability. -- Grégoire Lejeune David Kulp First, I just want to say that I am very very impressed with Apache::ASP. I just want to gush with praise after looking at many other implementations of perl embedded code and being very underwhelmed. This is so damn slick and clean. Kudos! ... ... I'm very pleased how quickly I've been able to mock up the application. I've been writing Perl CGI off and on since 1993(!) and I can tell you that Apache::ASP is a pleasure. (Last year I tried Zope and just about threw my computer out the window.) -- David Kulp MFM Commmunication Software, Inc. Working in a team environment where you have HTML coders and perl coders, Apache::ASP makes it easy for the HTML folks to change the look of the page without knowing perl. Using Apache::ASP (instead of another embedded perl solution) allows the HTML jockeys to use a variety of HTML tools that understand ASP, which reduces the amount of code they break when editing the HTML. Using Apache::ASP instead of M$ ASP allows us to use perl (far superior to VBScript) and Apache (far superior to IIS). We've been very pleased with Apache::ASP and its support. Planet of Music Apache::ASP has been a great tool. Just a little background.... the whole site had been in cgi flat files when I started here. I was looking for a technology that would allow me to write the objects and NEVER invoke CGI.pm... I found it and hopefuly I will be able to implement this every site I go to. When I got here there was a huge argument about needing a game engine and I belive this has been the key... Games are approx. 10 time faster than before. The games don't break anylonger. All in all a great tool for advancement. -- JC Fant IV Cine.gr ...we ported our biggest yet ASP site from IIS (well, actually rewrote), Cine.gr and it is a killer site. In some cases, the whole thing got almost 25 (no typo) times faster... None of this would ever be possible without Apache::ASP (I do not ever want to write ``print "\n";'' again). RESOURCES Here are some important resources listed related to the use of Apache::ASP for publishing web applications. If you have any more to suggest, please email the Apache::ASP list at asp[at]perl.apache.org Articles Apache::ASP Introduction ( #1 in 3 part series ) http://www.apache-asp.org/articles/perlmonth1_intro.html Apache::ASP Site Building ( #2 in 3 part series ) http://www.apache-asp.org/articles/perlmonth2_build.html Apache::ASP Site Tuning ( #3 in 3 part series ) http://www.apache-asp.org/articles/perlmonth3_tune.html Embedded Perl ( part of a series on Perl ) http://www.wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/index15.html Books mod_perl "Eagle" Book http://www.modperl.com mod_perl Developer's Cookbook http://www.modperlcookbook.org Programming the Perl DBI http://www.oreilly.com/catalog/perldbi/ Reference Cards Apache & mod_perl Reference Cards http://www.refcards.com/ Web Sites mod_perl Apache web module http://perl.apache.org mod_perl 1.x Guide http://perl.apache.org/guide/ Perl Programming Language http://www.perl.com Apache Web Server http://www.apache.org TODO There is no specific time frame in which these things will be implemented. Please let me know if any of these is of particular interest to you, and I will give it higher priority. WILL BE DONE + Database storage of $Session & $Application, so web clusters may scale better than the current NFS/CIFS StateDir implementation allows, maybe via Apache::Session. CHANGES Apache::ASP has been in development since 1998, and was production ready since its .02 release. Releases are always used in a production setting before being made publically available. In July 2000, the version numbers of releases went from .19 to 1.9 which is more relevant to software development outside the perl community. Where a .10 perl module usually means first production ready release, this would be the equivalent of a 1.0 release for other kinds of software. + = improvement - = bug fix (d) = documentations $VERSION = 2.63; $DATE="03/14/2018" + Added section ``raw'' to MailErrors.inc to debug POSTs without form fields - MailErrorsHTML now uses monospaced fonts for errors. Easier on the eyes and more informative $VERSION = 2.62; $DATE="08/16/2011" - Fixed 'application/x-www-form-urlencoded' for AJAX POSTs post Firefox 3.x + First sourceforge.net hosted version + Incremented version number to actually match SVN branch tag $VERSION = 2.61; $DATE="05/24/2008" - updated for more recent mod_perl 2 environment to trigger correct loading of modules + loads modules in a backwards compatible way for older versions of mod_perl 1.99_07 to 1.99_09 + license changes from GPL to Perl Artistic License $VERSION = 2.59; $DATE="05/23/2005" + added "use bytes" to Response object to calculate Content-Length correctly for UTF8 data, which should require therefore at least perl version 5.6 installed + updated to work with latest mod_perl 2.0 module naming convention, thanks to Randy Kobes for patch + examples now exclude usage of Apache::Filter & Apache::SSI under mod_perl 2.0 $VERSION = 2.57; $DATE="01/29/2004" - $Server->Transfer will update $0 correctly - return 0 for mod_perl handler to work with latest mod_perl 2 release when we were returning 200 ( HTTP_OK ) before - fixed bug in $Server->URL when called like $Server->URL($url) without parameters. Its not clear which perl versions this bug affected. $VERSION = 2.55; $DATE="08/09/2003" - Bug fixes for running on standalone CGI mode on Win32 submitted by Francesco Pasqualini + Added Apache::ASP::Request::BINMODE for binmode() being called on STDIN after STDIN is tied to $Request object + New RequestBinaryRead configuration created, may be turned off to prevent $Request object from reading POST data ++ mod_perl 2 optmizations, there was a large code impact on this, as much code was restructured to reduce the differences between mod_perl 1 and mod_perl 2, most importantly, Apache::compat is no longer used + preloaded CGI for file uploads in the mod_perl environment - When XSLT config is set, $Response->Redirect() should work now Thanks to Marcus Zoller for pointing problem out + Added CookieDomain setting, documented, and added test to cover it in t/cookies.t . Setting suggested by Uwe Riehm, who nicely submitted some code for this. $VERSION = 2.53; $DATE="04/10/2003" + XMLSubs tags with "-" in them will have "-" replaced with "_" or underscore, so a tag like will be translated to &my::render_table() ... tags with - in them are common in extended XML syntaxes, but perl subs cannot have - in them only. + Clean setting now works on output when $Response->{ContentType} begins with text/html; like "text/html; charset=iso-8859-2" ... before Clean would only work on output marked with ContentType text/html. Thanks to Szymon Juraszczyk for recommending fix. --Fixed a bug which would cause Session_OnEnd to be called twice on sessions in a certain case, particularly when an old expired session gets reused by and web browser... this bug was a result of a incomplete session cleanup method in this case. Thanks to Oleg Kobyakovskiy for reporting this bug. Added test in t/session_events.t to cover this problem going forward. - Compile errors from Apache::ASP->Loader() were not being reported. They will be reported again now. Thanks to Thanos Chatziathanassiou for discovering and documenting this bug. Added test in t/load.t to cover this problem going forward. + use of chr(hex($1)) to decode URI encoded parameters instead of pack("c",hex($1)) faster & more correct, thanks to Nikolay Melekhin for pointing out this need. (d) Added old perlmonth.com articles to ./site/articles in distribution and linked to them from the docs RESOURCES section (d) Updated documention for the $Application->SessionCount API + Scripts with named subroutines, which is warned against in the style guide, will not be cached to help prevent my closure problems that often hurt new developers working in mod_perl environments. The downside is that these script will have a performance penalty having to be recompiled each invocation, but this will kill many closure caching bugs that are hard to detect. - $Request->FileUpload('upload_file', 'BrowserFile') would return a glob before that would be the file name in scalar form. However this would be interpreted as a reference incorrectly. The fix is to make sure this is always a scalar by stringifying this data internally. Thanks to Richard Curtis for pointing out this bug. $VERSION = 2.51; $DATE="02/10/2003" + added t/session_query_parse.t test to cover use of SessionQueryParse and $Server->URL APIs - Fixed duplicate "&" bug associated with using $Server->URL and SessionQueryParse together + Patch to allow $Server->URL() to be called multiple times on the same URL as in $Server->URL($Server->URL($url, \%params), \%more_params) (d) Added new testimonials & sites & created a separate testimonials page. - SessionQueryParse will now add to & to the query strings embedded in the HTML, instead of & for proper HTML generation. Thanks to Peter Galbavy for pointing out and Thanos Chatziathanassiou for suggesting the fix. - $Response->{ContentType} set to text/html for developer error reporting, in case this was set to something else before the error occured. Thanks to Philip Mak for reporting. - Couple of minor bug fixes under PerlWarn use, thanks Peter Galbavy for reporting. + Added automatic load of "use Apache2" for compat with mod_perl2 request objects when Apache::ASP is loaded via "PerlModule Apache::ASP" Thanks to Richard Curtis for reporting bug & subsequent testing. - When GlobalPackage config changes, but global.asa has not, global.asa will be recompiled anyway to update the GlobalPackage correctly. Changing GlobalPackage before would cause errors if global.asa was already compiled. ++ For ANY PerlSetVar type config, OFF/Off/off will be assumed to have value of 0 for that setting. Before, only a couple settings had this semantics, but they all do now for consistency. - Fix for InodeNames config on OpenBSD, or any OS that might have a device # of 0 for the file being stat()'d, thanks to Peter Galbavy for bug report. ++ Total XSLT speedups, 5-10% on large XSLT, 10-15% on small XSLT + bypass meta data check like expires for XSLT Cache() API use because XSLT tranformations don't expire, saves hit to cache dbm for meta data + use of direct Apache::ASP::State methods like FETCH/STORE in Cache() layer so we don't have to go through slower tied interface. This will speed up XSLT & and include output caching mostly. + minor optimizations for speed & memory usage $VERSION = 2.49; $DATE="11/10/2002" -- bug introduced in 2.47 cached script compilations for executing scripts ( not includes ) of the same name in different directories for the same Global/GlobalPackage config for an application. Fix was to remove optimization that caused problem, and created test case t/same_name.t to cover bug. $VERSION = 2.47; $DATE="11/06/2002" ++ Runtime speed enhancements for 15-20% improvement including: + INTERNAL API ReadFile() now returns scalar ref as memory optimization + cache InodeNames config setting in ASP object now for common lookups + removed CompileChecksum() INTERNAL API, since it was an unnecesary method decomposition along a common code path + removed IsChanged() INTERNAL API since compiling of scripts is now handled by CompileInclude() which does this functionality already + removed unnecessary decomp of IncludesChanged() INTERNAL API, which was along critical code path + do not call INTERNAL SearchDirs() API when compiling base script since we have already validated its path earlier + Use stat(_) type shortcut for stat() & -X calls where possible + Moved @INC initilization up to handler() & consolidated with $INCDir lib + removed useless Apache::ASP::Collection::DESTROY + removed useless Apache::ASP::Server::DESTROY + removed useless Apache::ASP::GlobalASA::DESTROY + removed useless Apache::ASP::Response::DESTROY - Default path for $Response->{Cookies} was from CookiePath config, but this was incorrect as CookiePath config is only for $Session cookie, so now path for $Response->{Cookies} defaults to / - Fixed bug where global.asa events would get undefined with StatINC and GlobalPackage set when the GlobalPackage library changed & get reloaded. (d) Documented long time config NoCache. -- Fixed use with Apache::Filter, capable as both source and destination filter. Added ./site/eg/filter.filter example to demonstrate these abilities. + Use $r->err_headers_out->add Apache::Table API for cookies now instead of $r->cgi_header_out. Added t/cookies.t test to cover new code path as well as general $Response->Cookies API. Also make cookies headers sorted by cookie and dictionary key while building headers for repeatable behavior, this latter was to facilitate testing. - fixed $Server->Mail error_log output when failing to connect to SMTP server. + added tests to cover UniquePackages & NoCache configs since this config logic was updated + made deprecated warnings for use of certain $Response->Member calls more loudly write to error_log, so I can remove the AUTOLOAD for Response one day - Probably fixed behavior in CgiHeaders, at least under perl 5.8.0, and added t/cgi_headers.t to cover this config. + removed $Apache::ASP::CompressGzip setting ability, used to possibly set CompressGzip in the module before, not documented anyway + removed $Apache::ASP::Filter setting ability to set Filter globally, not documented anyway + removed old work around for setting ServerStarting to 0 at runtime, which was bad for Apache::DBI on win32 a long time ago: $Apache::ServerStarting and $Apache::ServerStarting = 0; If this code is still needed in Apache::ASP->handler() let me know. + check to make sure data in internal database is a HASH ref before using it for session garbage collection. This is to help prevent against internal database corruption in a network share that does not support flock() file locking. + For new XMLSubs ASP type <%= %> argument interpolation activated with XMLSubsPerlArgs 0, data references can now be passed in addition to SCALAR/string references, so one can pass an object reference like so: This will only work as long as the variable interpolation <%= %> are flushed against the containing " " or ' ', or else the object reference will be stringified when it is concatenated with the rest of the data. Testing for this feature was added to ./t/xmlsubs_aspargs.t This feature is still experimental, and its interface may change. However it is slated for the 3.0 release as default method, so feedback is appreciated. + For new XMLSubs ASP type <%= %> argument interpolation activated with XMLSubsPerlArgs 0, <% %> will no longer work, just <%= %>, as in This feature is still experimental, and its interface may change. However it is slated for the 3.0 release as default method, so feedback is appreciated. $VERSION = 2.45; $DATE="10/13/2002" ++New XMLSubsPerlArgs config, default 1, indicates how XMLSubs arguments have always been parsed. If set to 0, will enable new XMLSubs args that are more ASP like with <%= %> for dynamic interpolation, such as: Settings XMLSubsPerlArgs to 0 is experimental for now, but will become the default by Apache::ASP version 3.0 ++Optimization for static HTML/XML files that are served up via Apache::ASP so that they are not compiled into perl subroutines first. This makes especially native XSLT both faster & take less memory to serve, before XSL & XML files being transformed by XSLT would both be compiled as normal ASP script first, so now this will happen if they really are ASP scripts with embedded <% %> code blocks & XMLSubs being executed. +Consolidate some config data for Apache::ASP->Loader to use globals in @Apache::ASP::CompileChecksumKeys to know which config data is important for precompiling ASP scripts. +Further streamlined code compilation. Now both base scripts and includes use the internal CompileInclude() API to generate code. -Fixed runtime HTML error output when Debug is set to -2/2, so that script correctly again gets rendered in final perl form. Added compile time error output to ./site/eg/syntax_error.asp when a special link is clicked for a quick visual test. -Cleaned up some bad coding practices in ./site/eg/global.asa associated changes in other example files. Comment example global.asa some for the first time reader -DemoASP.pm examples module needed "use strict" fix, thanks to Allan Vest for bug report --$rv = $Response->Include({ File => ..., Cache => 1}); now works to get the first returned value fetched from the cache. Before, because a list was always returned, $rv would have been equal to the number of items returned, even if the return value list has just one element. (d) added site/robots.txt file with just a comment for search engine indexing -fixed ./site/eg/binary_write.htm to not use $Response->{ContentLength} because it does not exist. Fixed it to use $Response->AddHeader now instead $VERSION = 2.41; $DATE="09/29/2002" -Removed CVS Revision tag from Apache::ASP::Date, which was causing bad revision numbers in CPAN after CVS integration of Apache::ASP +removed cgi/asp link to ../asp-perl from distribution. This link was for the deprecated asp script which is now asp-perl $VERSION = 2.39; $DATE="09/10/2002" -Turn off $^W explicitly before reloading global.asa. Reloading global.asa when $^W is set will trigger subroutine redefinition warnings. Reloading global.asa should occur without any problems under normal usage of the system, thus this work around. This fix is important to UseStrict functionality because warnings automatically become thrown as die() errors with UseStrict enabled, so we have to disable normal soft warnings here. -$Response->Include() runtime errors now throw a die() that can be trapped. This was old functionality that has been restored. Other compile time errors should still trigger a hard error like script compilation, global.asa, or $Response->Include() without an eval() +Some better error handling with Debug 3 or -3 set, cleaned up developer errors messages somewhat. $VERSION = 2.37; $DATE="07/03/2002" -Fixed the testing directory structures for t/long_names.t so that tar software like Archive::Tar & Solaris tar that have problems with long file names will still be able to untar distribution successfully. Now t/long_names.t generates its testing directory structures at runtime. -Fixes for "make test" to work under perl 5.8.0 RC2, courtesy of Manabu Higashida +SessionQueryForce setting created for disabling use of cookies for $Session session-id passing, rather requiring use of SessionQuery* functionality for session-id passing via URL query string. By default, even when SessionQuery* options are used, cookies will be used if available with SessionQuery* functionality acting only as a backup, so this makes it so that cookies will never be used. +Escape ' with HTMLEncode() to ' -Trying to fix t/server_mail.t to work better for platforms that it should skip testing on. Updated t/server.t test case. +Remove exit() from Makefile.PL so CPAN.pm's automatic follow prereq mechanism works correctly. Thanks to Slaven Rezic for pointing this out. +Added Apache::compat loading in mod_perl environment for better mod_perl 2.0 support. $VERSION = 2.35; $DATE="05/30/2002" +Destroy better $Server & $Response objects so that my closure references to these to not attempt to work in the future against invalid internal data. There was enough data left in these old objects to make debugging the my closure problem confusing, where it looked like the ASP object state became invalid. +Added system debug diagnostics to inspect StateManager group cleanup (d) Documentation update about flock() work around for Win95/Win98/WinMe systems, confirmed by Rex Arul (d) Documentation/site build bug found by Mitsunobu Ozato, where <% %> not being escaped correctly with $Server->HTMLEncode(). New japanese documentation project started by him at http://sourceforge.jp/projects/apache-asp-jp/ -InitPackageGlobals() called after new Apache::ASP object created so core system templates can be compiled even when there was a runtime compilation error of user templates. Bug fix needed pointed out by Eamon Daly $VERSION = 2.33; $DATE="04/29/2002" - fixed up t/server_mail.t test to skip if a sendmail server is not available on localhost. We only want the test to run if there is a server to test against. + removed cgi/asp script, just a symlink now to the ./asp-perl script which in this way deprecates it. I had it hard linked, but the distribution did not untar very well on win32 platform. + Reordered the modules in Bundle::Apache::ASP for a cleaner install. - Fixed bug where XMLSubs where removing tag when it was needed in XSLT mode. + $Server->Mail({ CC => '...', BCC => '...' }), now works to send CC & BCC headers/recipients. + Removed $Apache::ASP::Register definition which defined the current executing Apache::ASP object. Only one part of the application was using it, and this has been fixed. This would have been an unsafe use of globals for a threaded environment. + Decreased latency when doing Application_OnStart, used to sleep(1) for CleanupMaster sync, but this is not necessary for Application_OnStart scenario + Restructure code / core templates for MailErrorsTo funcationality. Wrote test mail_error.t to cover this. $ENV{REMOTE_USER} will now be displayed in the MailErrorsTo message when defined from 401 basic auth. + $Server->RegisterCleanup should be thread safe now, as it no longer relies on access to @Apache::ASP::Cleanup for storing the CODE ref stack. + test t/inode_names.t for InodeNames and other file tests covering case of long file names. - Fixed long file name sub identifier bug. Added test t/long_names.t. + CacheDir may now be set independently of StateDir. It used to default to StateDir if it was set. ++ Decomposition of modules like Apache::ASP::Session & Apache::ASP::Application out of ASP.pm file. This should make the source more developer friendly. This selective code compilation also speeds up CGI requests that do not need to load unneeded modules like Apache::ASP::Session, by about 50%, so where CGI mode ran at about 2.1 hits/sec before, now for light requests that do not load $Session & $Application, requests run at 3.4 hits/sec, this is on a dual PIII-450 linux 2.4.x - Caching like for XSLTCache now works in CGI mode. This was a bug that it did not before. + $Server->File() API added, acts as a wrapper around Apache->request->filename Added test in t/server.t ++ *** EXPERIMENTAL / ALPHA FEATURE NOTE BEGIN *** New $PERLLIB/Apache/ASP/Share/ directory created to hold system & user contributed components, which will be found on the $Server->MapInclude() path, which helps $Response->Include search '.',Global,IncludesDir, and now Apache::ASP::Share for includes to load at runtime. The syntax for loading a shared include is to prefix the file name with Share:: as in: $Response->TrapInclude('Share::CORE/MailError.inc'); New test to cover this at t/share.t This feature is experimental. The naming convention may change and the feature may disappear altogether, so only use if you are interesting in experimenting with this feature & will provide feedback about how it works. *** EXPERIMENTAL / ALPHA FEATURE NOTE END *** + asp-perl script now uses ./asp.conf instead of ./asp.config for runtime configuration via %Config defined there. Update docs for running in standalone CGI mode + Make use of MANFEST.SKIP to not publish the dev/* files anymore. - Script_OnEnd guaranteed to run after $Response->End, but it will not run if there was an error earlier in the request. + lots of new test cases covering behaviour of $Response->End and $Response->Redirect under various conditions like XMLSubs and SoftRedirect and global.asa Script_OnStart + asp-perl will be installed into the bin executables when Apache::ASP is installed. asp-perl is the command line version of Apache::ASP that can also be used to run script in CGI mode. Test case covering asp-perl functionality. + asp CGI/command line script now called asp-perl. I picked this name because Apache::ASP often has the name asp-perl in distributions of the module. + Apache::ASP::CGI::Test class now subclass of Apache::ASP::CGI. To facilitate this Apache::ASP::CGI::init() now called OO like Apache::ASP::CGI->init() Fixed up places where the old style was called. New Test class allows a dummy Apache request object to be built which caches header & body output for later inspection instead of writing it to STDOUT. - $Response->Redirect() under SoftRedirect 1 will not first Clear() buffer - $Response->Redirect() in an XMLSubs will work now ... behavior of $Response->Flush() being turned off in an XMLSubs was interfering with this. + srand() init tracking done better, thanks for patch from Ime Smits + Added file/directory being used for precompilation in Apache::ASP->Loader($file, ...) to output like: [Mon Feb 04 20:19:22 2002] [error] [asp] 4215 (re)compiled 22 scripts of 22 loaded for $file This is so that when precompiling multiple web sites each with different directories, one can easier see the compile output relevant to the Loader() command being run. + better decomp of Apache::ASP site build files at ./build/* files, which is good should anyone look at it for ideas. + improved test suite to error when unintended output results from t/*.t test scripts. - () now supported in XMLSubsMatch config, added xmlsubsmatch.t test... specifically a config like PerlSetVar (aaa|bbb):\w+ should now work. Thanks for bug report from David Kulp. + Added an early srand() for better $ServerID creation + Work around for DSO problems where $r is not always correctly defined in Apache::ASP::handler(). Thanks to Tom Lear for patch. $VERSION = 2.31; $DATE="01/22/2002"; + $Server->MapInclude() API extension created to wrap up Apache::ASP::SearchDirs functionality so one may do an conditional check for an include existence befor executing $Response->Include(). Added API test to server.t + $Server->Transfer() now allows arguments like $Response->Include(), and now acts just as a wrapper for: $Response->Include($file, @args); $Response->End(); added test case at t/server_transfer.t + Removed dependency of StatINC functionality on Apache::Symbol. Apache::Symbol is no longer required. Added test of t/stat_inc.t for correct StatINC initialization for platforms where Devel::Symdump is present. + Better error message when $Request->Params has not been defined with RequestParams config & it gets used in script. Added test case as t/request_params_none.t + Directories cannot now be included as scripts via $Response->Include(), added test case to t/include.t - No longer make $Response->Flush dependent on $Response->IsClientConnected() to be true to write output to client. There have been spurious errors reported about the new ( >= 2.25 ) IsClientConnected code, and this will limit the impact of that functionality possibly not working still to those users explicitly using that API. + $Response->AddHeader($header_name, $value) now will set $Response members for these headers: Content-Type, Cache-Control, Expires. This is to avoid both the application & Apache::ASP sending out duplicate headers. Added test cases for this to t/response.t + split up Bundle::Apache::ASP into that, and Bundle::Apache::ASP::Extra the former with just the required modules to run, and the latter for extra functionality in Apache::ASP + new $Request->{Method} member to return $r->method of GET or POST that client browser is requesting, added t/request.t sub test to cover this member. $VERSION = 2.29; $DATE="11/19/2001"; +Added some extra help text to the ./cgi/asp --help message to clarify how to pass arguments to a script from the command line. +When using $Server->Mail() API, if Content-Type header is set, and MIME-Version is not, then a "MIME-Version: 1.0" header will be sent for the email. This is correct according to RFC 1521 which specifies for the first time the Content-Type: header for email documents. Thanks to Philip Mak for pointing out this correct behavior. +Made dependent on MLDBM::Sync version .25 to pass the taint_check.t test +Improved server_mail.t test to work with mail servers were relaying is denied +Added tags to MailErrorsTo email --Fixed SessionCount / Session_OnEnd bug, where these things were not working for $Sessions that never had anything written to them. This bug was introduced in 2.23/2.25 release. There was an optimization in 2.23/2.25 where a $Session that was never used does not write its state lock file & dbm files to disk, only if it gets written too like $Session->{MARK}++. Tracking of these NULL $Sessions then is handled solely in the internal database. For $Session garbage collection though which would fire Session_OnEnd events and update SessionCount, the Apache::ASP::State->GroupMembers() function was just looking for state files on disk ... now it looks in the internal database too for SessionID records for garbage collection. Added a test at ./t/session_events.t for these things. +Some optimizations for $Session API use. +Added support for XSLT via XML::LibXSLT, patch courtesy of Michael Buschauer -Got rid of an warning when recompiling changing includes under perl 5.6.1... undef($code) method did not work for this perl version, rather undef(&$code) does. Stopped using using Apache::Symbol for this when available. -Make Apache::ASP script run under perl taint checking -T for perl 5.6.1... $code =~ tr///; does not work to untaint here, so much use the slower: $code =~ /^(.*)$/s; $code = $1; method to untaint. -Check for inline includes changing, included in a dynamic included loaded at runtime via $Response->Include(). Added test case for this at t/include_change.t. If an inline include of a dynamic include changes, the dynamic include should get recompiled now. -Make OK to use again with PerlTaintCheck On, with MLDBM::Sync 2.25. Fixed in ASP.pm, t/global.asa, and created new t/taint_check.t test script +Load more modules when Apache::ASP is loaded so parent will share more with children httpd: Apache::Symbol Devel::Symdump Config lib MLDBM::Sync::SDBM_File +When FileUploadMax bytes is exceeded for a file upload, there will not be an odd error anymore resulting from $CGI::POST_MAX being triggered, instead the file upload input will simply be ignored via $CGI::DISABLE_UPLOADS. This gives the developer the opportunity to tell the user the the file upload was too big, as demonstrated by the ./site/eg/file_upload.asp example. To not let the web client POST a lot of data to your scripts as a form of a denial of service attack use the apache config LimitRequestBody for the max limits. You can think of PerlSetVar FileUploadMax as a soft limit, and apache's LimitRequestBody as a hard limit. --Under certain circumstances with file upload, it seems that IsClientConnected() would return an aborted client value from $r->connection->aborted, so the buffer output data would not be flushed to the client, and the HTML page would return to the browser empty. This would be under normal file upload use. One work-around was to make sure to initialize the $Request object before $Response->IsClientConnected is called, then $r->connection->aborted returns the right value. This problem was probably introduced with IsClientConnected() code changes starting in the 2.25 release. $VERSION = 2.27; $DATE="10/31/2001"; + Wrapped call to $r->connection->fileno in eval {} so to preserve backwards compatibility with older mod_perl versions that do not have this method defined. Thanks to Helmut Zeilinger for catching this. + removed ./dev directory from distribution, useless clutter + Removed dependency on HTTP::Date by taking code into Apache::ASP as Apache::ASP::Date. This relieves the dependency of Apache::ASP on libwww LWP libraries. If you were using HTTP::Date functions before without loading "use HTTP::Date;" on your own, you will have to do this now. + Streamlined code execution. Especially worked on $Response->IsClientConnected which gets called during a normal request execution, and got rid of IO::Select dependency. Some function style calls instead of OO style calls where private functions were being invokes that one would not need to override. - Fixed possible bug when flushing a data buffer where there is just a '0' in it. + Updated docs to note that StateCache config was deprecated as of 2.23. Removed remaining code that referenced the config. + Removed references to unused OrderCollections code. - Better Cache meta key, lower chance of collision with unrelated data since its using the full MD5 keyspace now + Optimized some debugging statements that resulted from recent development. + Tie::TextDir .04 and above is supported for StateDB and CacheDB settings with MLDBM::Sync .21. This is good for CacheDB where output is larger and there are not many versions to cache, like for XSLTCache, where the site is mostly static. + Better RESOURCES section to web site, especially with adding some links to past Apache::ASP articles & presentations. $VERSION = 2.25; $DATE="10/11/2001"; + Improved ./site/apps/search application, for better search results at Apache::ASP site. Also, reengineered application better, with more perl code moved to global.asa. Make use of MLDBM::Sync::SDBM_File, where search database before was engineering around SDBM_File's shortcomings. - Fix for SessionSerialize config, which broke in 2.23 Also, added t/session_serialize.t to test suite to catch this problem in the future. $VERSION = 2.23; $DATE="10/11/2001"; +Make sure a couple other small standard modules get loaded upon "PerlModule Apache::ASP", like Time::HiRes, Class::Struct, and MLDBM::Serializer::Data::Dumper. If not available these modules won't cause errors, but will promote child httpd RAM sharing if they are. -XMLSubs args parsing fix so an arg like z-index does not error under UseStrict. This is OK now: HTML -Only remove outermost These settings require that buffering be enabled, as Apache::ASP will parse through the buffer to parse the URLs. With SessionQueryParse on, it will just parse non-absolute URLs, but with SessionQueryParseMatch set to some server url regexp, like ^http://localhost , will also parse in the session id for URLs that match that. When testing, the performance hit from this parsing a script dropped from 12.5 hits/sec on my WinNT box to 11.7 hits per second for 1K of buffered output. The difference is .007 of my PII300's processing power per second. For 10K of output then, my guess is that this speed of script, would be slowed to 6.8 hits per second. This kind of performance hit would also slow a script running at 40 hits per second on a UNIX box to 31 hits/sec for 1K, and to 11 hits/sec for 10K parsed. Your mileage may vary and you will have to test the difference yourself. Get yourself a valid URL with a session-id in it, and run it through ab, or Socrates, with SessionQuery turned on, and then with SessionQueryParse set to see the difference. SessionQuery just enables of session id setting from the query string but will not auto parse urls. -If buffering, Content-Length will again be set. It broke, probably while I was tuning in the past couple versions. +UseStrict setting compiles all scripts including global.asa with "use strict" turned on for catching more coding errors. With this setting enabled, use strict errors die during compilation forcing Apache::ASP to try to recompile the script until successful. -Object use in includes like $Response->Write() no longer error with "use strict" programming. +SessionQuery config setting with $Server->URL($url, { %params } ) alpha API extensions to enable cookieless sessions. +Debugging not longer produces internal debugging by default. Set to -1,-2 for internal debugging for Debug settings 1 & 2. +Both StateSerializer & StateDB can be changed without affecting a live web site, by storing the configurations for $Application & $Session in an internal database, so that if $Session was created with SDBM_File for the StateDB (default), it will keep this StateDB setting until it ends. +StateSerializer config setting. Default Data::Dumper, can also be set to Storable. Controls how data is serialized before writing to $Application & $Session. +Beefed up the make test suite. +Improved the locking, streamlining a bit of the $Application / $Session setup process. Bench is up to 22 from 21 hits / sec on dev NT box. +Cut more fat for faster startup, now on my dev box I get 44 hits per sec Apache::ASP vs. 48 Embperl vs. 52 CGI via Apache::Registry for the HelloWorld Scripts. -Improved linking for the online site documentation, where a few links before were bad. $VERSION = 0.17; $DATE="11/15/99"; ++20%+ faster startup script execution, as measured by the HelloWorld bench. I cut a lot of the fat out of the code, and is now at least 20% faster on startup both with and without state. On my dev (NT, apache 1.3.6+mod_perl) machine, I now get: 42 hits per sec on Apache::ASP HelloWorld bench 46 hits per sec on Embperl (1.2b10) and 51 hits per sec for CGI Apache::Registry scripts Before Apache::ASP was clocking some 31 hits per sec. Apache::ASP also went from 75 to 102 hits per second on Solaris. +PerlTaintCheck On friendly. This is mod_perl's way of providing -T taint checking. When Apache::ASP is used with state objects like $Session or $Application, MLDBM must also be made taint friendly with: $MLDBM::RemoveTaint = 1; which could be put in the global.asa. Documented. +Added $Response->ErrorDocument($error_code, $uri_or_string) API extension which allows for setting of Apache's error document at runtime. This is really just a wrapper for Apache->custom_response() renamed so it syncs with the Apache ErrorDocument config setting. Updated documentation, and added error_document.htm example. =OrderCollections setting was added, but then REMOVED because it was not going to be used. It bound $Request->* collections/hashes to Tie::IxHash, so that data in those collections would be read in the order the browser sent it, when eaching through or with keys. -global.asa will be reloaded when changed. This broke when I optimized the modification times with (stat($file))[9] rather than "use File::stat; stat($file)->mtime" -Make Apache::ASP->Loader() PerlRestartHandler safe, had some unstrict code that was doing the wrong thing. -IncludesDir config now works with DynamicIncludes. +DebugBufferLength feature added, giving control to how much buffered output gets shown when debugging errors. ++Tuning of $Response->Write(), which processes all static html internally, to be almost 50% faster for its typical use, when BufferingOn is enabled, and CgiHeaders are disabled, both being defaults. This can show significant speed improvements for tight loops that render ASP output. +Auto linking of ./site/eg/ text to example scripts at web site. +$Application->GetSession($session_id) API extension, useful for managing active user sessions when storing session ids in $Application. Documented. -disable use of flock() on Win95/98 where it is unimplemented -@array context of $Request->Form('name') returns undef when value for 'name' is undefined. Put extra logic in there to make sure this happens. $VERSION = 0.16; $DATE="09/22/99"; -$Response->{Buffer} and PerlSetVar BufferingOn configs now work when set to 0, to unbuffer output, and send it out to the web client as the script generates it. Buffering is enabled by default, as it is faster, and allows a script to error cleanly in the middle of execution. +more bullet proof loading of Apache::Symbol, changed the way Apache::ASP loads modules in general. It used to check for the module to load every time, if it hadn't loaded successfully before, but now it just tries once per httpd, so the web server will have to be restarted to see new installed modules. This is just for modules that Apache::ASP relies on. Old modules that are changed or updated with an installation are still reloaded with the StatINC settings if so configured. +ASP web site wraps around

          tags now to override the other font used for the text
          areas.  The spacing was all weird in Netscape before
          for 
 sections.

         -Fixed Content-Length calculation when using the Clean
          option, so that the length is calculated after the HTML
          is clean, not before.  This would cause a browser to 
          hang sometimes.

         +Added IncludesDir config option that if set will also be
          used to check for includes, so that includes may easily be
          shared between applications.  By default only Global and 
          the directory the script is in are checked for includes.

          Also added IncludesDir as a possible configuration option
          for Apache::ASP->Loader()

         -Re-enabled the Application_OnStart & OnEnd events, after
          breaking them when implementing the AllowApplicationState
          config setting.

         +Better pre-fork caching ... StatINC & StatINCMatch are now 
          args for Apache::ASP->Loader(), so StatINC symbols loading
          may be done pre-fork and shared between httpds.  This lowers
          the child httpd init cost of StatINC.  Documented.

         +Made Apache::ASP Basic Authorization friendly so authentication
          can be handled by ASP scripts.  If AuthName and AuthType Apache
          config directives are set, and a $Response->{Status} is set to 
          401, a user will be prompted for username/password authentication
          and the entered data will show up in ServerVariables as:
            $env = $Request->ServerVariables
            $env->{REMOTE_USER} = $env->{AUTH_USER} = username
            $env->{AUTH_PASSWD} = password
            $env->{AUTH_NAME}   = your realm
            $env->{AUTH_TYPE}   = 'Basic'

          This is the same place to find auth data as if Apache had some 
          authentication handler deal with the auth phase separately.

         -MailErrorsTo should report the right file now that generates
          the error.

    $VERSION = 0.15; $DATE="08/24/1999";
         --State databases like $Session, $Application are 
          now tied/untied to every lock/unlock triggered by read/write 
          access.  This was necessary for correctness issues, so that 
          database file handles are flushed appropriately between writes
          in a highly concurrent multi-process environment.

          This problem raised its ugly head because under high volume, 
          a DB_File can become corrupt if not flushed correctly.  
          Unfortunately, there is no way to flush SDBM_Files & DB_Files 
          consistently other than to tie/untie the databases every access.

          DB_File may be used optionally for StateDB, but the default is
          to use SDBM_File which is much faster, but limited to 1024 byte
          key/value pairs.

          For SDBM_Files before, if there were too many concurrent 
          writes to a shared database like $Application, some of the 
          writes would not be saved because another process
          might overwrite the changes with its own.

          There is now a 10 fold performance DECREASE associated
          with reading from and writing to files like $Session 
          and $Application.  With rough benchmarks I can get about
          100 increments (++) now per second to $Session->{count}, where
          before I could get 1000 increments / second.  

          You can improve this if you have many reads / writes happening
          at the same time, by placing locking code around the group like
  
                $Session->Lock();
                $Session->{count}++;
                $Session->{count}++;
                $Session->{count}++;
                $Session->UnLock();     

          This method will reduce the number of ties to the $Session database
          from 6 to 1 for this kind of code, and will improve the performance
          dramatically.

          Also, instead of using explicit $Session locking, you can 
          create an automatic lock on $Session per script by setting
          SessionSerialize in your config to 1.  The danger here is
          if you have any long running scripts, the user will have
          to wait for it to finish before another script can be run.

          To see the number of lock/unlocks or ties/unties to each database
          during a script execution, look at the last lines of debug output
          to your error log when Debug is set to 1.  This can help you
          performance tweak access to these databases.

         +Updated documentation with new config settings and
          API extensions.

         +Added AllowApplicationState config option which allows
          you to leave $Application undefined, and will not
          execute Application_OnStart or Application_OnEnd.
          This can be a slight performance increase of 2-3% if
          you are not using $Application, but are using $Session.

         +Added $Session->Lock() / $Session->UnLock() API routines
          necessary additions since access to session is not
          serialized by default like IIS ASP.  Also prompted
          by change in locking code which retied to SDBM_File
          or DB_File each lock.  If you $Session->Lock / UnLock
          around many read/writes, you will increase performance.

         +Added StateCache config which, if set will cache
          the file handle locks for $Application and an internal 
          database used for tracking $Session info.  This caching can 
          make an ASP application perform up to 10% faster,
          at a cost of each web server process holding 2 more 
          cached file handles open, per ASP application using
          this configuration.  The data written to or read from
          these state databases is not cached, just the locking 
          file handles are held open.

         -Added in much more locking in session manager 
          and session garbage collector to help avoid collisions
          between the two.  There were definite windows that the
          two would collide in, during which bad things could 
          happen on a high volume site.

         -Fixed some warnings in DESTROY and ParseParams()

    $VERSION = 0.14; $DATE="07/29/1999";
         -CGI & StatINC or StatINCMatch would have bad results
          at times, with StatINC deleting dynamically compiled
          CGI subroutines, that were imported into other scripts
          and modules namespaces.

          A couple tweaks, and now StatINC & CGI play nice again ;)
          StatINCMatch should be safe to use in production with CGI. 
          This affects in particular environments that use file upload, 
          since CGI is loaded automatically by Apache::ASP to handle 
          file uploads.

          This fix should also affect other seemingly random 
          times when StatINC or StatINCMatch don't seem to do 
          the right thing.

         +use of ASP objects like $Response are now "use strict"
          safe in scripts, while UniquePackages config is set.

         +Better handling of "use strict" errors in ASP scripts.
          The error is detected, and the developer is pointed to the 
          Apache error log for the exact error.  

          The script with "use strict" errors will be recompiled again.  Its seems 
          though that "use strict" will only throw its error once, so that a script 
          can be recompiled with the same errors, and work w/o any use strict
          error messaging.

    $VERSION = 0.12; $DATE="07/01/1999";
         -Compiles are now 10 +times faster for scripts with lots of big
          embedded perl blocks <% #perl %>

          Compiles were slow because of an old PerlScript compatibility
          parsing trick where $Request->QueryString('hi')->{item}
          would be parsed to $Request->QueryString('hi') which works.
          I think the regexp that I was using had O(n^2) characteristics
          and it took a really big perl block to 10 +seconds to parse
          to understand there was a problem :(

          I doubt anyone needed this compatibility, I don't even see
          any code that looks like this in the online PerlScript examples,
          so I've commented out this parsing trick for now.  If you 
          need me to bring back this functionality, it will be in the 
          form of a config setting.

          For information on PerlScript compatibility, see the PerlScript
          section in the ASP docs.

         -Added UniquePackages config option, that if set brings back 
          the old method of compiling each ASP script into its own
          separate package.  As of v.10, scripts are compiled by default
          into the same package, so that scripts, dynamic includes & global.asa
          can share globals.  This BROKE scripts in the same ASP Application
          that defined the same sub routines, as their subs would redefine
          each other.  

          UniquePackages has scripts compiled into separate perl packages,
          so they may define subs with the same name, w/o fear of overlap.
          Under this settings, scripts will not be able to share globals.  

         -Secure field for cookies in $Response->Cookies() must be TRUE to 
          force cookie to be secure.  Before, it just had to be defined, 
          which gave wrong behavior for Secure => 0. 

         +$Response->{IsClientConnected} set to one by default.  Will
          work out a real value when I upgrade to apache 1.3.6.  This
          value has no meaning before, as apache aborts the perl code
          when a client drops its connection in earlier versions.

         +better compile time debugging of dynamic includes, with 
          Debug 2 setting

         +"use strict" friendly handling of compiling dynamic includes
          with errors

    $VERSION = 0.11; $DATE="06/24/1999";
         +Lots of documentation updates

         +The MailHost config option is the smtp server used for 
          relay emails for the Mail* config options.

         +MailAlertTo config option used for sending a short administrative
          alert for an internal ASP error, server code 500.  This is the 
          compliment to MailErrorsTo, but is suited for sending a to a
          small text based pager.  The email sent by MailErrorsTo would
          then be checked by the web admin for quick response & debugging
          for the incident. 

          The MailAlertPeriod config specifies the time in minutes during 
          which only one alert will be sent, which defaults to 20.

         +MailErrorsTo config options sends the results of a 500 error
          to the email address specified as if Debug were set to 2.
          If Debug 2 is set, this config will not be on, as it is
          for production use only.  Debug settings less than 2 only 
          log errors to the apache server error log.

         -StatINCMatch / StatINC can be used in production and work
          even after a server graceful restart, which is essential for 
          a production server.

         -Content-Length header is set again, if BufferingOn is set, and
          haven't $Response->Flush()'d.  This broke when I introduce
          the Script_OnEnd event handler.

         +Optimized reloading of the GlobalPackage perl module upon changes, 
          so that scripts and dynamic includes don't have to be recompiled.  
          The global.asa will still have to be though.  Since we started
          compiling all routines into a package that can be named with
          GlobalPackage, we've been undeffing compiled scripts and includes
          when the real GlobalPackage changed on disk, as we do a full sweep
          through the namespace.  Now, we skip those subs that we know to 
          be includes or scripts. 

         -Using Apache::Symbol::undef() to undefine precompiled scripts
          and includes when reloading those scripts.  Doing just an undef() 
          would sometimes result in an "active subroutine undef" error.
          This bug came out when I started thrashing the StatINC system
          for production use.

         +StatINCMatch setting created for production use reloading of
          perl modules.  StatINCMatch allows StatINC reloading of a
          subset of all the modules defined in %INC, those that match
          $module =~ /$StatINCMatch/, where module is some module name
          like Class/Struct.pm

         +Reoptimized pod comment parsing.  I slowed it down to sync
          lines numbers in the last version, but found another corner I could cut.

    $VERSION = 0.10; $DATE="05/24/1999";
         += improvement; - = bug fix

         +Added index.html file to ./eg to help people wade through
          the examples.  This one has been long overdue.

         +Clean config option, or setting $Response->{Clean} to 1 - 9,
          uses HTML::Clean to compress text/html output of ASP scripts.
          I like the Clean 1 setting which is lightweight, stripping 
          white space for about 10% compression, at a cost of less than
          a 5% performance penalty.

         +Using pod style commenting no longer confuses the line
          numbering.  ASP script line numbers are almost exactly match
          their compiled perl version, except that normal inline includes
          (not dynamic) insert extra text which can confuse line numbering.
          If you want perl error line numbers to entirely sync with your 
          ASP scripts, I would suggest learning how to use dynamic includes,
          as opposed to inline includes.

         -Wrapped StatINC reloading of libs in an eval, and capturing
          error for Debug 2 setting.  This makes changing libs with StatINC
          on a little more friendly when there are errors. 

         -$Request->QueryString() now stores multiple values for the 
          same key, just as $Request->Form() has since v.07.  In
          wantarray() context like @vals = $Request->QueryString('dupkey'),
          @vals will store whatever values where associated with dupkey
          in the query string like (1,2) from: ?dupkey=1&dupkey=2

         +The GlobalPackage config directive may be defined
          to explicitly set the perl module that all scripts and global.asa
          are compiled into.

         -Dynamic includes may be in the Global directory, just like
          normal includes.

         +Perl script generated from asp scripts should match line
          for line, seen in errors, except when using inline (default) 
          includes, pod comments, or <% #comment %> perl comments, which 
          will throw off the line counts by adding text, removing
          text, or having an extra newline added, respectively.

         -Script_OnEnd may now send output to the browser.  Before
          $main::Response->End() was being called at the end of the
          main script preventing further output.

        ++All scripts are compiled as routines in a namespace uniquely defined
        by the global.asa of the ASP application. Thus, scripts, includes, and
        global.asa routines will share all globals defined in the global.asa
        namespace. This means that globals between scripts will be shared, and
        globals defined in a global.asa will be available to scripts.

          Scripts used to have their own namespace, thus globals
          were not shared between them.

         +a -o $output_dir switch on the ./cgi/asp script allows
          it to execute scripts and write their output to an output
          directory.  Useful for building static html sites, based on
          asp scripts.  An example use would be:

            asp -b -o out *.asp

          Without an output directory, script output is written to STDOUT

    $VERSION = 0.09; $DATE="04/22/1999";
         +Updated Makefile.PL optional modules output for CGI & DB_File

         +Improved docs on $Response->Cookies() and $Request->Cookies()

         +Added PERFORMANCE doc to main README, and added sub section
          on precompiling scripts with Apache::ASP->Loader()

         +Naming of CompileIncludes switched over to DynamicIncludes 
          for greater clarity.

         +Dynamic includes can now reference ASP objects like $Session
          w/o the $main::* syntax.  These subs are no longer anonymous
          subs, and are now compiled into the namespace of the global.asa package.

         +Apache::ASP->Loader() precompiles dynamic includes too. Making this work
          required fixing some subtle bugs / dependencies in the compiling process.

         +Added Apache::ASP->Loader() similar to Apache::RegistryLoader for
          precompiling ASP scripts.  Precompile a whole site at server 
          startup with one function call.

         +Prettied the error messaging with Debug 2.

         +$Response->Debug(@args) debugging extension, which
          allows a developer to hook into the module's debugging,
          and only have @args be written to error_log when Debug is greater
          than 0.

         -Put write locking code around State writes, like $Session
          and $Application.  I thought I fixed this bug a while ago.

         -API change: converted $Session->Timeout() and $Session->SessionID() 
          methods into $Session->{Timeout} and $Session->{SessionID} properties.
          The use of these properties as methods is deprecated, but 
          backwards compatibility will remain.  Updated ./eg/session.asp
          to use these new properties.

         +Implemented $Response->{PICS} which if set sends out a PICS-Label
          HTTP header, useful for ratings.

         +Implemented $Response->{CacheControl} and $Response->{Charset} members.
          By default, CacheControl is 'private', and this value gets sent out
          every request as HTTP header Cache-Control.  Charset appends itself
          onto the content type header.

         +Implemented $Request->BinaryRead(), $Request->{TotalBytes},
          documented them, and updated ./eg/form.asp for an example usage. 

         +Implemented $Response->BinaryWrite(), documented, and created
          and example in ./eg/binary_write.htm

         +Implemented $Server->MapPath() and created example of its use
          in ./eg/server.htm

         -$Request->Form() now reads file uploads correctly with 
          the latest CGI.pm, where $Request->Form('file_field') returns
          the actual file name uploaded, which can be used as a file handle
          to read in the data.  Before, $Request->Form('file_field') would
          return a glob that looks like *Fh::filename, so to get the file
          name, you would have to parse it like =~ s/^\*Fh\:\://,
          which you no longer have to do.  As long as parsing was done as
          mentioned, the change should be backwards compatible.

         +Updated  +enhanced documentation on file uploads.  Created extra
          comments about it as an FAQ, and under $Response->Form(), the latter
          being an obvious place for a developer to look for it.

         +Updated ./eg/file_upload.asp to show use of non file form data, 
          with which we had a bug before.

         +Finished retieing *STDIN to cached STDIN contents, so that 
          CGI input routines may be used transparently, along side with
          use of $Request->Form()

         +Cleaned up and optimized $Request code

         +Updated documentation for CGI input & file uploads.  Created
          file upload FAQ.

         +Reworked ./eg/cgi.htm example to use CGI input routines
          after doing a native read of STDIN.

         ++Added dynamic includes with 
          extension.  This style of include is compiled as an anonymous sub & 
          cached, and then executed with @args passed to the subroutine for 
          execution.  This is include may also be rewritten as a new API 
          extension: $Response->Include('file', @args)

         +Added ./eg/compiled_includes.htm example documenting new dynamic includes.

         +Documented SSI: native file includes, and the rest with filtering 
          to Apache::SSI

         +Turned the documentation of Filter config to value of Off so 
          people won't cut and paste the On config by default.

         +Added SecureSession config option, which forces session cookie to 
          be sent only under https secured www page requests.

         +Added StateDB config option allows use of DB_File for $Session, since 
          default use of SDBM_File is limited.  See StateDB in README.

         +file include syntax w/o quotes supported like 

         +Nested includes are supported, with includes including each other.
          Recursive includes are detected and errors out when an include has been 
          included 100 times for a script.  Better to quit early than 
          have a process spin out of control. (PORTABLE ? probably not)

         +Allow  notation w/o quotes around file names

         -PerlSetEnv apache conf setting now get passed through to 
          $Request->ServerVariables. This update has ServerVariables 
          getting data from %ENV instead of $r->cgi_env

         +README FAQ for PerlHandler errors

    $VERSION = 0.08; $DATE="02/06/1999";
         ++SSI with Apache::Filter & Apache::SSI, see config options & ./eg files
          Currently filtering only works in the direction Apache::ASP -> Apache::SSI,
          will not work the other way around, as SSI must come last in a set of filters

         +SSI file includes may reference files in the Global directory, better 
          code sharing

         - <% @array... %> no longer dropped from code.

         +perl =pod comments are stripped from script before compiling, and associated
          PodComments configuration options.

         +Command line cgi/asp script takes various options, and allows execution
          of multiple asp scripts at one time.  This script should be used for
          command line debugging.  This is also the beginning of building
          a static site from asp scripts with the -b option, suppressing headers.

         +$Response->AddHeader('Set-Cookie') works for multiple cookies.

         -$Response->Cookies('foo', '0') works, was dropping 0 because of boolean test

         -Fixed up some config doc errors.

    $VERSION = 0.07; $DATE="01/20/1999";
         -removed SIG{__WARN__} handler, it was a bad idea.

         -fixes file locking on QNX, work around poor flock porting

         +removed message about Win32::OLE on UNIX platforms from Makefile.PL

         -Better lock garbage collection.  Works with StatINC seamlessly.

         -Multiple select forms now work in array context with $Response->Form()
                @values = $Response->Form('multi');

         -Better CGI.pm compatibility with $r->header_out('Content-type'),
          improved garbage collection under modperl, esp. w/ file uploads

    $VERSION = 0.06; $DATE="12/21/1998";
         +Application_OnStart & Application_OnEnd event handlers support.

         -Compatible with CGI.pm 2.46 headers() 

         -Compatible with CGI.pm $q = new CGI({}), caveat: does not set params 

         +use strict; followed by use of objects like $Session is fine.

         -Multiple cookies may be set per script execution.

         +file upload implemented via CGI.pm

         ++global.asa implemented with events Session_OnStart and Session_OnEnd
          working appropriately.

         +StateDir configuration directive implemented.
          StateDir allows the session state directory to be specified separately 
          from the Global directory, useful for operating systems with caching file 
          systems.

         +StateManager config directive.  StateManager specifies how frequently
          Sessions are cleaned up, with 10 (default) meaning that old Sessions
          will be cleaned up 10 times per SessionTimeout period (default 20 minutes).

         +$Application->SessionCount() implemented, non-portable method.
                : returns the number of currently active sessions

         -STOP button fix.  Users may hit STOP button during script 
          execution, and Apache::ASP will cleanup with a routine registered
          in Apache's $r->register_cleanup.  Works well supposedly.

         +PerlScript compatibility work, trying to make ports smoother.
                : Collection emulator, no ->{Count} property
                : $.*(.*)->{Item} parsed automatically, 
                  shedding the ->{Item} for Collection support (? better way ?)
                : No VBScript dates support, just HTTP RFC dates with HTTP::Date
                : Win32::OLE::in not supported, just use "keys %{$Collection}"  

         +./cgi/asp script for testing scripts from the command line
                : will be upgraded to CGI method of doing asp
                : is not "correct" in anyway, so not documented for now
                  but still useful

         +strips DOS carriage returns from scripts automatically, so that
          programs like FrontPage can upload pages to UNIX servers
          without perl choking on the extra \r characters.

    $VERSION = 0.05; $DATE="10/19/1998";
         +Added PERFORMANCE doc, which includes benchmarks  +hints.

         +Better installation warnings and errors for other modules required. 

         -Turned off StatINC in eg/.htaccess, as not everyone installs Devel::Symdump

         -Fixed AUTOLOAD state bug, which wouldn't let you each through state
          objects, like %{$Session}, or each %$Session, (bug introduced in v.04)

         +Parses ASP white space better.  HTML output matches author's intent
          by better dealing with white space surrounding <% perl blocks %>

         -Scalar insertion code <%=$foo%> can now span many lines.

         +Added include.t test script for includes.

         +Script recompiles when included files change.

         +Files can be included in script with 
          SSI  syntax, needs to be
          done in ASP module to allow compilation of included code and html 
          into script.  Future chaining with Apache::SSI will allow static 
          html includes, and other SSI directives

    $VERSION = 0.04; $DATE="10/14/1998";
         +Example script eg/cgi.htm demonstrating CGI.pm use for output.

         +Optimized ASP parsing, faster and more legible executing code
                : try 'die();' in code with setting PerlSetVar Debug 2

         +Cleaned up code for running with 'use strict'

         -Fixed directory handle leak on Solaris, from not closing after opendir()

         +StatINC overhaul.  StatINC setting now works as it should, with 
          the caveat that exported functions will not be refreshed.

         +NoState setting optimization, disallows $Application & $Session

         +$Application->*Lock() functions implemented

         -SoftRedirect setting for those who want scripts to keep running
          after a Redirect()

         +SessionSerialize setting to lock session while script is running
                : Microsoft ASP style session locking
                : For a session, scripts execute one at a time 
                : NOT recommended use, please see note.

         -MLDBM can be used for other things without messing up internal use
                : before if it was used with different DB's and serializers,
                  internal state could be lost.

         --State file locking.  Corruption worries, and loss of data no more.

         +CGI header support, developer can use CGI.pm for *output*, or just print()
                : print "Set-Cookie: test=cookie\n", and things will just work
                : use CGI.pm for output
                : utilizes $r->send_cgi_header(), thanks Doug!

         +Improved Cookie implementation, more flexible and complete
                - Domain cookie key now works
                : Expire times now taken from time(), and relative time in sec
                : Request->Cookies() reading more flexible, with wantarray()
                  on hash cookie values, %hash = $Request->Cookie('test');

         -make test module naming correction, was t.pm, now T.pm for Unix

         +POD / README cleanup, formatting and HTML friendly.

    $VERSION = 0.03; $DATE="09/14/1998";
         +Installation 'make test' now works

         +ActiveX objects on Win32 implemented with $Server->CreateObject() 

         +Cookies implemented: $Response->Cookies() & $Request->Cookies()

         -Fixed $Response object API, converting some methods to object members.
          Deprecated methods, but backwards compatible.

         +Improved error messaging, debug output

         +$, influences $Response->Write(@strings) behavior

         +perl print() works, sending output to $Response object

         +$Response->Write() prints scalars, arrays, and hashes.  Before only scalars.

         +Begin implementation of $Server object.

         +Implemented $Response->{Expires} and $Response->{ExpiresAbsolute}

         +Added "PerlSetVar StatINC" config option

         +$0 is aliased to current script filename

         +ASP Objects ($Response, etc.) are set in main package
          Thus notation like $main::Response->Write() can be used anywhere.

    $VERSION = 0.02; $DATE="07/12/1998";
         ++Session Manager, won't break under denial of service attack

         +Fleshed out $Response, $Session objects, almost full implementation.

         +Enormously more documentation.

         -Fixed error handling with Debug = 2.

         -Documentation fixed for pod2man support.  README now more man-like.

         -Stripped \r\n dos characters from installation files

         -755 mode set for session state directory when created

         -Loads Win32/OLE properly, won't break with UNIX

    $VERSION = 0.01; $DATE="06/26/1998";
         Syntax Support
         --------------
         Initial release, could be considered alpha software.
         Allows developers to embed perl in html ASP style.

         
         
         
         <% for(1..10) { %>
                counting: <%=$_%> 
<% } %> ASP Objects ----------- $Session, $Application, $Response, $Request objects available for use in asp pages. $Session & $Application data is preserved using SDBM files. $Session id's are tracked through the use of cookies. Security -------- Timeouts any attempt to use a session id that doesn't already exist. Should stop hackers, since there is no wire speed guessing cookies. LICENSE Copyright (c) 1998-2018, Josh Chamas All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Apache::ASP is a perl native port of Active Server Pages for Apache and mod_perl. Apache-ASP-2.63/Makefile.PL0000755000175000017500000001343012336747511013343 0ustar jobjob#!/usr/local/bin/perl use strict; $| = 1; my $mtime_makefile = (stat('Makefile'))[9] || 0; my $fresh_makefile = ($mtime_makefile > time() - 1200) ? 1 : 0; my $necessary_modules = { # 'Apache' => 'Make sure your installation of mod_perl is complete', 'Class::Struct' => "Apache::ASP->Loader() precompile scripts functionality", 'MLDBM' => 'This is used for reading and writing multi-level hashes on disk', 'MLDBM::Sync 0.25' => 'Support for State dbms like $Session & $Application', 'SDBM_File' => 'Internal databases used for state files, like $Session', 'Data::Dumper' => 'Serializes data for MLDBM', 'Fcntl' => 'Used for file locking constants', 'File::Basename' => "Used for tests during 'make test'", 'Digest::MD5' => '32 byte hash algorithm for cookie session-id', 'Carp' => 'Provides critical error messaging with confess()', }; my $optional_modules = { 'Devel::Symdump' => 'Used for StatINC setting, which reloads modules dynamically', 'Win32::OLE' => { test => '$^O eq \'MSWin32\'', message => 'Required for access to ActiveX objects on Win32, like ADO.', }, 'CGI' => 'Required for file upload, make test, and command line ./cgi/asp script', 'Compress::Zlib' => "Required for html gzip text compression for browsers that support it", # 'DB_File' => 'Optional module for StateDB & CacheDB config options', 'MLDBM::Sync::SDBM_File' => 'Optional module for StateDB config option that is faster than DB_File on Linux. Also default CacheDB for XSLT caching, but DB_File may also be used as well as Tie::TextDir.', 'HTML::Clean' => 'Compress text/html with Clean config or $Response->{Clean} set to 1-9', 'HTML::FillInForm' => 'Enables FormFill feature which will auto fill forms from $Request->Form data', ## not relevant on apache2 context ## 'Apache::Filter' => 'Full SSI support via Apache::Filter & Apache::SSI', ## 'Apache::SSI' => 'Full SSI support via Apache::Filter & Apache::SSI', 'Net::SMTP' => 'Runtime errors can be mailed to the webmaster with MailErrorTo config', 'Net::Config' => 'Config options for use with Net::SMTP', 'Time::HiRes' => 'Sub second Apache::ASP response timing with Debug 3/-3 turned on.', ## no longer seems supported ## 'Tie::TextDir .04' => 'Fast cache for CacheDB setting for things like large XSLT transformations.', 'XML::XSLT 0.32' => 'XSLT, written in perl so makes for an easy install after installing Bundle::XML from CPAN.', ## no longer seems supported ## 'XML::Sablotron' => 'XSLT that is 10 times faster than XML::XSLT', 'XML::LibXSLT' => 'XSLT that is 2 times faster than XML::Sablotron', }; print "Checking for the REQUIRED modules...\n"; my($errors, $warnings); for(sort keys %$necessary_modules) { eval 'use ' . $_ ; my $module_display = $_; $module_display =~ s/( [\d\.]+)$/ \>\=$1/isg; if($@) { $errors++; print " !!! you need the module: $module_display\n"; print " WHY: $necessary_modules->{$_}\n"; } else { print " ... found $module_display !\n"; } } print "\n"; if(! $errors) { print "GOOD NEWS! You have all the required modules installed for Apache::ASP.\n"; } else { print "OTHER MODULES NEEDED! You need to install the above required modules before installing Apache::ASP.\n"; } print "\n"; sleep(2) unless $fresh_makefile; print "Checking for the OPTIONAL modules...\n"; sleep(2) unless $fresh_makefile; for(sort keys %$optional_modules) { my $data = $optional_modules->{$_}; my $message = ref($data) ? $data->{message} : $data; # if there is a test for this module run it and if returns false # skip this module's message, first so UNIX users don't see # message about Win32::OLE if(ref($data) && $data->{test} && ! eval($data->{test})) { next; } { local $SIG{__DIE__} = sub { die(@_); }; eval 'use ' . $_ ; my $module_display = $_; $module_display =~ s/( [\d\.]+)$/ \>\=$1/isg; if($@) { $warnings++; print " ??? you may want module: $module_display\n"; print " WHY: $optional_modules->{$_}\n"; # print " ERROR: $@\n"; } else { print " ... found $module_display !\n"; } } } if($warnings) { print "\n--- OPTIONAL modules missing. You can install Apache::ASP without these. ---\n"; sleep(2) unless $fresh_makefile; } my $CPAN = < perl -MCPAN -eshell Then to install any required modules, like MLDBM::Sync cpan> install MLDBM::Sync To install the modules commonly used with Apache::ASP, do: cpan> install Bundle::Apache::ASP and cpan will do all the work for you. For more information, please view the CPAN docs with > perldoc CPAN =-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-= CPAN ; if($errors) { print "\n"; print $CPAN; print "\n"; print "** You do not have the required modules for Apache::ASP. Do not run 'make install' **\n\n"; } else { if($warnings) { print $CPAN; } print "+++ Looks good! You are ready to install Apache::ASP! +++ \n\n"; } use ExtUtils::MakeMaker; &WriteMakefile( 'NAME' => "Apache::ASP", 'VERSION_FROM' => 'CHANGES', # finds $VERSION 'PREREQ_PM' => { 'Carp' => 0, 'Class::Struct' => 0, 'Data::Dumper' => 0, 'Fcntl' => 0, 'File::Basename' => 0, 'Digest::MD5' => 0, 'MLDBM' => 0, 'SDBM_File' => 0, 'MLDBM::Sync' => 0, }, 'EXE_FILES' => [ 'asp-perl' ], 'clean' => { FILES => 't/long_directory_path_test t/.cache t/.state t/session_events/.state t/null/.state Makefile.old' }, ); Apache-ASP-2.63/editors/0000755000175000017500000000000013252400404013017 5ustar jobjobApache-ASP-2.63/editors/mmm-asp-perl.el0000755000175000017500000000230511721310312015650 0ustar jobjob;;; Apache::ASP mmm-mode config, by Joshua Chamas, 6/17/2001 (require 'mmm-auto) (require 'mmm-compat) (require 'mmm-vars) (setq mmm-global-mode 'maybe) ; sets meta-p to reparse buffer in case the buffer does ; no update automatically while typing (global-set-key "\M-p" 'mmm-parse-buffer) ;; create asp-perl mmm-mode subclass (mmm-add-group 'asp-perl '((asp-perl-blocks :submode perl-mode :match-face (("<%" . mmm-code-submode-face) ("<%=" . mmm-output-submode_face)) :front "<%=?" :back "%>" ))) ; .asp, .htm, .inc files will be parsed with mmm-mode (add-to-list 'mmm-mode-ext-classes-alist '(nil "\\.\\(asp\\|htm\\|inc\\)" asp-perl)) (add-hook 'mmm-major-mode-hook 'turn-on-auto-fill) ; turn off background color for code blocks, may set it if you like (set-face-background 'mmm-default-submode-face nil) ;(set-face-background 'mmm-default-submode-face "gray") ; set major mode for these files to HTML mode, except global.asa which you ; want to treat as a pure perl file (setq auto-mode-alist (append '( ("\\.pm$" . cperl-mode) ("\\.asa$" . cperl-mode) ("\\.inc$" . html-mode) ("\\.htm" . html-mode) ("\\.asp$" . html-mode) ) auto-mode-alist)) Apache-ASP-2.63/editors/aasp.vim0000755000175000017500000000072711721310312014466 0ustar jobjob" Vim syntax file " Language: aasp Apache::ASP combination of Perl and HTML " Maintainer: Jon Topper " Last change: 2001 Feb 09 " Remove any old syntax stuff hanging around syn clear so :p:h/html.vim syn include @Perl :p:h/perl.vim syn cluster htmlPreproc add=aaspPerlInsideTags syntax region aaspPerlInsideTags keepend matchgroup=Delimiter start=+<%=\=+ skip=+".*%>.*"+ end=+%>+ contains=@Perl let b:current_syntax = "aasp" " vim: ts=8 Apache-ASP-2.63/META.json0000664000175000017500000000206713252400404012776 0ustar jobjob{ "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Apache-ASP", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Carp" : "0", "Class::Struct" : "0", "Data::Dumper" : "0", "Digest::MD5" : "0", "Fcntl" : "0", "File::Basename" : "0", "MLDBM" : "0", "MLDBM::Sync" : "0", "SDBM_File" : "0" } } }, "release_status" : "stable", "version" : 2.63 } Apache-ASP-2.63/META.yml0000664000175000017500000000111313252400404012615 0ustar jobjob--- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Apache-ASP no_index: directory: - t - inc requires: Carp: '0' Class::Struct: '0' Data::Dumper: '0' Digest::MD5: '0' Fcntl: '0' File::Basename: '0' MLDBM: '0' MLDBM::Sync: '0' SDBM_File: '0' version: 2.63 Apache-ASP-2.63/ASP.pm0000644000175000017500000115126713252400040012340 0ustar jobjob # For documentation for this module, please see the end of this file # or try `perldoc Apache::ASP` package Apache::ASP; $VERSION = 2.63; #require DynaLoader; #@ISA = qw(DynaLoader); #bootstrap Apache::ASP $VERSION; use Digest::MD5 qw(md5_hex); use Cwd qw(cwd); # create multiple entries for this symbols for StatINC use Fcntl qw(:flock O_RDWR O_CREAT); # load these always, but only load ::State, ::Session, ::Application # at runtime in non mod_perl environments since they may not be needed use Apache::ASP::GlobalASA; use Apache::ASP::Response; use Apache::ASP::Request; use Apache::ASP::Server; use Apache::ASP::Date; use Apache::ASP::Lang::PerlScript; use Carp qw(confess cluck); use strict; no strict qw(refs); use vars qw($VERSION %NetConfig %LoadedModules %LoadModuleErrors %Codes %includes %Includes %CompiledIncludes @Objects %Register %XSLT $ServerID $ServerPID $SrandPid $CompileErrorSize $CacheSize @CompileChecksumKeys %ScriptLanguages $ShareDir $INCDir $AbsoluteFileMatch $QuickStartTime $SessionCookieName $LoadModPerl $ModPerl2 ); # other common modules load now, these are optional though, so we do not error upon failure # just do this once perl mod_perl parent startup unless($LoadModPerl++) { my @load_modules = qw( Config lib Time::HiRes ); if($ENV{MOD_PERL}) { # Only pre-load these if in a mod_perl environment for sharing memory post fork. # These will not be loaded then for CGI until absolutely necessary at runtime push(@load_modules, qw( mod_perl MLDBM::Serializer::Data::Dumper Devel::Symdump CGI Apache::ASP::StateManager Apache::ASP::Session Apache::ASP::Application Apache::ASP::StatINC Apache::ASP::Error ) ); } for my $module ( @load_modules ) { eval "use $module ();"; } if(exists $ENV{MOD_PERL_API_VERSION}) { if($ModPerl2 = ($ENV{MOD_PERL_API_VERSION} >= 2)) { if($ModPerl2) { eval "use Apache::ASP::ApacheCommon ();"; die($@) if $@; } } } } ## HEADER TOKEN TWEAK # This must be called outside the above load module block, so that # its gets run whenever this module is loaded # This didn't work in 1.27 mod_perl, with DSO enabled, would # put the Apache::ASP token in front. # eval { &Apache::add_version_component("Apache::ASP/$VERSION"); }; # $Apache::Server::AddPerlVersion = 1; #use integer; # don't use screws up important numeric logic @Objects = ('Application', 'Session', 'Response', 'Server', 'Request'); map { eval "sub $_ { shift->{$_} }" } @Objects; # use regexp directly, not sub for speed $AbsoluteFileMatch = '^(/|[a-zA-Z]:)'; $CacheSize = 1024*1024*10; $SessionCookieName = 'session-id'; # ServerID creates a unique identifier for the server srand(); $ServerID = substr(md5_hex($$.rand().time().(-M('..')||'').(-M('/')||'')), 0, 16); $ServerPID = $$; # DEFAULT VALUES $Apache::ASP::CompileErrorSize = 500; @CompileChecksumKeys = qw ( Global DynamicIncludes UseStrict XMLSubsMatch XMLSubsPerlArgs XMLSubsStrict GlobalPackage UniquePackages IncludesDir InodeNames PodComments ); %ScriptLanguages = ( 'PerlScript' => 1, ); &InitPaths(); %Apache::ASP::LoadModuleErrors = ( 'Filter' => "Apache::Filter was not loaded correctly for using SSI filtering. ". "If you don't want to use filtering, make sure you turn the Filter ". "config option off whereever it's being used", Clean => undef, CreateObject => 'OLE-active objects not supported for this platform, '. 'try installing Win32::OLE', Gzip => 'Compress::Zlib is needed to make gzip content-encoding work, '. 'If you want to use this feature, get yourself the latest '. 'Compress::Zlib from CPAN. ', HiRes => undef, FormFill => 'HTML::FillInForm is needed to use the FormFill feature '. 'for auto filling forms with $Response->Form() data', MailAlert => undef, SendMail => "No mailing support", StateDB => 'cannot load StateDB '. 'must be a valid perl module with a db tied hash interface '. 'such as: SDBM_File (default), or DB_File', StateSerializer => 'cannot load StateSerializer '. 'must be a valid serializing perl module for use with MLDBM '. 'such as Data::Dumper (default), or Storable', StatINC => "You need this module for StatINC, please download it from CPAN", 'Cache' => "You need this module for xml output caching", XSLT => 'Cannot load XML::XSLT. Try installing the module.', ); sub handler { my($package, $r) = @_; my $status = 200; # allows it to be called as an object method ref $package and $r = $package; # default to Apache request object if not passed in, for possible DSO fix # rarely happens, but just in case my $filename; unless($filename = eval { $r->filename }) { my $rtest = $ModPerl2 ? Apache2::RequestUtil->request() : Apache->request(); if($filename = eval { $rtest->filename }) { $r = $rtest; } else { return &DSOError($rtest); } } # better error checking ? $filename ||= $r->filename(); # using _ is optimized to use last stat() record return(404) if (! -e $filename or -d _); # alias $0 to filename, bind to glob for bug workaround local *0 = \$filename; # ASP object creation, a lot goes on in there! # method call used for speed optimization, as OO calls are slow my $self = &Apache::ASP::new('Apache::ASP', $r, $filename); # for runtime use/require library loads from global/INCDir # do this in the handler section to cover all the execution stages # following object set up as possible. local @INC = ($self->{global}, $INCDir, @INC); # Execute if no errors $self->{errs} || &Run($self); # moved print of object to the end, so we'll pick up all the # runtime config directives set while the code is running $self->{dbg} && $self->Debug("ASP Done Processing $self", $self ); # error processing if($self->{errs}) { require Apache::ASP::Error; $status = $self->ProcessErrors; } # XX return code of 302 hangs server on WinNT # STATUS hook back to Apache my $response = $self->{Response}; if($status != 500 and defined $response->{Status} and $response->{Status} != 302) { # if still default then set to what has been set by the # developer $status = $response->{Status}; } # X: we DESTROY in register_cleanup, but if we are filtering, and we # handle a virtual request to an asp app, we need to free up the # the locked resources now, or the session requests will collide # a performance hack would be to share an asp object created between # virtual requests, but don't worry about it for now since using SSI # is not really performance oriented anyway. # # If we are not filtering, we let RegisterCleanup get it, since # there will be a perceived performance increase on the client side # since the connection is terminated before the garabage collection is run. # # Also need to destroy if we return a 500, as we could be serving an # error doc next, before the cleanup phase if($self->{filter} || ($status == 500) || ( $r->isa('Apache::ASP::CGI'))) { $self->DESTROY(); } if($status eq '200') { $status = 0; # OK status code is default unless there was an internal error } $status; } sub Warn { shift if(ref($_[0]) or $_[0] eq 'Apache::ASP'); print STDERR "[ASP WARN] ", @_; } sub new { my($class, $r, $filename) = @_; $r || die("need Apache->request() object to Apache::ASP->new(\$r)"); # $StartTime is set by asp-perl early on before modules are loaded # for more accurate per time tracking. Unset, so this init load time does # not get used more than once. my $start_time; if($QuickStartTime) { $start_time = $QuickStartTime; $QuickStartTime = undef; } else { $start_time = eval { &Time::HiRes::time(); } || time(); } local $SIG{__DIE__} = \&Carp::confess; # like cgi, operate in the scripts directory $filename ||= $r->filename(); $filename =~ m|^(.*?[/\\]?)([^/\\]+)$|; my $dirname = $1 || '.'; my $basename = $2; chdir($dirname) || die("can't chdir to $dirname: $!"); # temp object just to call config() on, do not bless since we # do not want the object to be DESTROY()'d my $dir_config = $r->dir_config; my $headers_in = $r->headers_in; my $self = { r => $r, dir_config => $dir_config }; # global is the default for the state dir and also # a default lib path for perl, as well as where global.asa # can be found my $global = &get_dir_config($dir_config, 'Global') || '.'; $global = &AbsPath($global, $dirname); # asp object is handy for passing state around $self = bless { 'basename' => $basename, 'cleanup' => [], 'dbg' => &get_dir_config($dir_config, 'Debug') || 0, # debug level 'destroy' => 1, 'dir_config' => $dir_config, 'headers_in' => $headers_in, filename => $filename, global => $global, global_package => &get_dir_config($dir_config, 'GlobalPackage'), inode_names => &get_dir_config($dir_config, 'InodeNames'), no_cache => &get_dir_config($dir_config, 'NoCache'), 'r' => $r, # apache request object start_time => $start_time, stat_scripts => &config($self, 'StatScripts', undef, 1), stat_inc => &get_dir_config($dir_config, 'StatINC'), stat_inc_match => &get_dir_config($dir_config, 'StatINCMatch'), use_strict => &get_dir_config($dir_config, 'UseStrict'), win32 => ($^O eq 'MSWin32') ? 1 : 0, xslt => &get_dir_config($dir_config, 'XSLT'), }, $class; # Only if debug is negative do we kick out all the internal stuff if($self->{dbg}) { if($self->{dbg} < 0) { *Debug = *Out; $self->{dbg} = -1 * $self->{dbg}; } else { *Debug = *Null; } $self->Debug('RUN ASP (v'. $VERSION .") for $self->{filename}"); } else { *Debug = *Null; } # Ken said no need for seed ;), now we just make sure its called post fork # Patch from Ime suggested no need for %SrandPid, just srand() again when $$ has changed unless($SrandPid && $SrandPid == $$) { $self->{dbg} && $self->Debug("call srand() post fork"); srand(); $SrandPid = $$; } # filtering support my $filter_config = &get_dir_config($dir_config, 'Filter'); if($filter_config) { if($self->LoadModules('Filter', 'Apache::Filter')) { # new filter_register with Apache::Filter 1.013 if($r->can('filter_register')) { $self->{r} = $r = $r->filter_register; } if ($r->can('filter_input') && $r->can('get_handlers')) { $self->{filter} = 1; #X: do something with the return code, can't now because # apache constants aren't working on my win32 my($fh, $rc) = $r->filter_input(); $self->{filehandle} = $fh; } } else { if(! $r->can('get_handlers')) { $self->Error("You need at least mod_perl 1.16 to use SSI filtering"); } else { $self->Error("Apache::Filter was not loaded correctly for using SSI filtering. ". "If you don't want to use filtering, make sure you turn the Filter ". "config option off whereever it's being used"); } } } # gzip content encoding option by ime@iae.nl 28/4/2000 my $compressgzip_config = &get_dir_config($dir_config, 'CompressGzip'); if($compressgzip_config) { if($self->LoadModule('Gzip','Compress::Zlib')) { $self->{compressgzip} = 1; } } # must have global directory into which we put the global.asa # and possibly state files, optimize out the case of . or .. if($self->{global} !~ /^(\.|\.\.)$/) { -d $self->{global} or $self->Error("global path, $self->{global}, is not a directory"); } # includes_dir calculation if($filename =~ m,^((/|[a-zA-Z]:).*[/\\])[^/\\]+?$,) { $self->{dirname} = $1; } else { $self->{dirname} = '.'; } $self->{includes_dir} = [ $self->{dirname}, $self->{global}, split(/;/, &config($self, 'IncludesDir') || ''), ]; # register cleanup before the state files get set in InitObjects # this way DESTROY gets called every time this script is done # we must cache $self for lookups later &RegisterCleanup($self, sub { $self->DESTROY }); #### WAS INIT OBJECTS, REMOVED DECOMP FOR SPEED # GLOBALASA, RESPONSE, REQUEST, SERVER # always create these # global_asa assigns itself to parent object automatically my $global_asa = &Apache::ASP::GlobalASA::new($self); $self->{Request} = &Apache::ASP::Request::new($self); $self->{Response} = &Apache::ASP::Response::new($self); # Server::new() is just one line, so execute directly $self->{Server} = bless {asp => $self}, 'Apache::ASP::Server'; #&Apache::ASP::Server::new($self); # After GlobalASA Init, init the package that this script will execute in # must be here, and not end of new before things like Application_OnStart get run # UniquePackages & NoCache configs do not work together, NoCache wins here if(&config($self, 'UniquePackages')) { # id is not generally useful for the ASP object now, so calculate # it here now, only to twist the package object for this script # pass in basename for where to find the file for InodeNames, and the full path # for the FileId otherwise my $package = $global_asa->{'package'}.'::'.&FileId($self, $self->{basename}, $self->{filename}); $self->{'package'} = $package; $self->{init_packages} = ['main', $global_asa->{'package'}, $self->{'package'}]; } else { $self->{'package'} = $global_asa->{'package'}; $self->{init_packages} = ['main', $global_asa->{'package'}]; } $self->{state_dir} = &config($self, 'StateDir', undef, $self->{global}.'/.state'); $self->{state_dir} =~ tr///; # untaint # if no state has been config'd, then set up none of the # state objects: Application, Internal, Session unless(&get_dir_config($dir_config, 'NoState')) { # load at runtime for CGI environments, preloaded for mod_perl require Apache::ASP::StateManager; &InitState($self); } $self; } # called upon every end of connection by RegisterCleanup sub DESTROY { my $self = shift; return unless $self->{destroy}; # still active object $self->{dbg} && $self->Debug("destroying ASP object $self"); # do before undef'ing the object references in main for my $code ( @{$self->{cleanup}} ) { $self->{dbg} && $self->Debug("executing cleanup $code"); eval { &$code() }; $@ && $self->Error("executing cleanup $code error: $@"); } local $^W = 0; # suppress untie while x inner references warnings select(STDOUT); untie *RESPONSE if tied *RESPONSE; # can't move this to Request::DESTROY(), then CGI object compatibility # in test ./site/eg/cgi.htm test fails, don't know why, --jc, 12/06/2002 untie *STDIN if tied *STDIN; # in case there is a dummy session here by the # end of object execution if($self->{Session}) { if(eval { $self->{Session}->isa('Apache::ASP::Session') }) { # only the cleanup master may cleanup groups now, so OK # to call just CleanupGroups $self->CleanupGroups(); } else { $self->Debug("$self->{Session} is not an Apache::ASP::Session"); eval { $self->{Session}->DESTROY }; $self->{Session} = undef; } } # free file handles here. mod_perl tends to be pretty clingy # to memory for('Application', 'Internal', 'Session') { # all this stuff in here is very necessary for total cleanup # the DESTROY is the most important, as we need to explicitly free # state objects, just in case anyone else is keeping references to them # But the destroy won't work without first untieing, go figure next unless defined $self->{$_}; my $tied = tied %{$self->{$_}}; next unless $tied; untie %{$self->{$_}}; $tied->DESTROY(); # call explicit DESTROY } if(my $caches = $self->{Caches}) { # default cache size to 10M $self->{cache_size} = &config($self, 'CacheSize') || $CacheSize; if($self->{cache_size} =~ /^([\d\.]+)(M|K|B)?$/) { my($size, $unit) = ($1, $2); if($unit eq 'M') { $size *= 1024*1024; } elsif($unit eq 'K') { $size *= 1024; } if($size ne $self->{cache_size}) { $self->{dbg} && $self->Debug("converting CacheSize $self->{cache_size} to $size bytes"); $self->{cache_size} = $size; } } for my $cache (values %$caches) { my $tied = $cache; if($tied->{writes} && $tied->Size > $self->{cache_size}) { $self->{dbg} && $self->Debug("deleting cache $cache, size: ".$tied->Size); $tied->Delete; } else { $self->{dbg} && $self->Debug("cache $cache OK size, size: ".$tied->Size); } $tied->DESTROY(); } } # $self->{'dbg'} && $self->Debug("END ASP DESTROY"); $self->{Request} && &Apache::ASP::Request::DESTROY($self->{Request}); $self->{Server} && ( %{$self->{Server}} = () ); $self->{Response} && ( %{$self->{Response}} = () ); %$self = (); 1; } sub RegisterCleanup { my $self = shift; if($ModPerl2) { $self->{r}->pool->cleanup_register(@_); } else { $self->{r}->register_cleanup(@_); } } sub InitPaths { # we load this module just to detect where the shared directory really is use Apache::ASP::Share::CORE; # major problem with %INC if we cannot get this information my $share_path = $INC{'Apache/ASP/Share/CORE.pm'} || die(q(can't find path for $INC{'Apache/ASP/Share/CORE.pm'})); $share_path =~ s/CORE\.pm$//s; unless($share_path =~ /$AbsoluteFileMatch/) { # this %ENV manipulation is just to allow cwd() to run in taint check mode local %ENV = %ENV; $ENV{PATH} = '/bin:/usr/bin:/usr/sbin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; my $currdir = cwd(); $share_path = "$currdir/$share_path"; } # not finding the ShareDir creates a hard error, because the Apache/ASP/Share # directory will become one of the fundamental underpinings of the project # People will need to rely on being able to load shared includes, and not have # to discover the lack of loading Share:: at runtime, rather this is a compile # time error. -d $share_path || die("Apache::ASP::Share directory not found. ". "Please make sure to install all the modules that make up the Apache::ASP installation." ); $ShareDir = $share_path; # once we find the $ShareDir, we can truncate the library path # and push it onto @INC with use lib... this is to help with loading # future Apache::ASP::* modules when the lib path it was found at is # relative to some directory. This was needed to have the "make test" # test suite to work which loads libraries from "blib/lib", but Apache::ASP # will chdir() into the script directory so that can ruin this # library lookup. # my $lib_path = $share_path; $lib_path =~ s/Apache.ASP.Share.?$//s; -d $lib_path || die("\%INC library path $lib_path not found."); $INCDir = $lib_path; # clear taint, for some reason, tr/// or s/^(.*)$/ did not work on perl 5.6.1 $INCDir =~ /^(.*)$/s; $INCDir = $1; # make sure this gets on @INC at startup, can't hurt eval "use lib qw($INCDir);"; 1; } sub FileId { my($self, $file, $abs_file, $no_compile_checksum) = @_; $file || die("no file passed to FileId()"); my $id; # calculate compile checksum for file id unless($self->{compile_checksum}) { my $r = $self->{r}; my $checksum = md5_hex(join('&-+', $VERSION, map { &config($self, $_) || '' } @CompileChecksumKeys ) ); # $self->{dbg} && $self->Debug("compile checksum $checksum"); $self->{compile_checksum} = $checksum; } my $compile_checksum = $no_compile_checksum ? '' : $self->{compile_checksum}; my @inode_stat = (); if($self->{inode_names}) { @inode_stat = stat($file); # one or the other device or file ids must be not 0 unless($inode_stat[0] || $inode_stat[1]) { @inode_stat = (); } } if(@inode_stat) { $id = sprintf("____DEV%X_INODE%X",@inode_stat[0,1]); $id .= 'x'.$compile_checksum; } else { if($abs_file) { $file = $abs_file; } $file =~ s|/+|/|sg; $file =~ s/[\Wx]/_/sg; my $file_name_length = length($file); if($file_name_length >= 35) { $id = substr($file, $file_name_length - 35, 36); # only do the hex of the original file to create a unique identifier for the long id $id .= 'x'.&md5_hex($file.$compile_checksum); } else { $id = $file.'x'.$compile_checksum; } } $id = '__ASP_'.$id; } # defaults to parsing the script's file, or data from a file handle # in the case of filtering, but we can also pass in text to parse, # which is useful for doing includes separately for compiling sub Parse { my($self, $file) = @_; my $file_exists = 0; my $parse_file = $file; my $r = $self->{r}; my $data; # get script data, from varied data sources; $file || die("can't parse without file data"); $self->{dbg} && $self->Debug("parse file $file"); # file can be a filename, scalar ref, or scalar if(ref $file) { if ($file =~ /SCALAR/) { $data = $$file; } elsif ($file =~ /GLOB/) { local $/ = undef; $data = <$file> } } elsif((length($file) < 1024) && ($file !~ /^GLOB/) && (-e $file)) { # filename has length < 1024, should be fine across OS's $self->{dbg} && $self->Debug("parsing $file"); $data = ${$self->ReadFile($file)}; $file_exists = 1; $self->{parse_file_count}++; } else { $data = $file; # raw script, no ref } # moved parsing config here since not needed for normal # eval execution of scripts after compilation unless($self->{parse_config}) { $self->{parse_config} = 1; $self->{compile_includes} = &config($self, 'DynamicIncludes'); $self->{pod_comments} = &config($self, 'PodComments', undef, 1); $self->{xml_subs_strict} = &config($self, 'XMLSubsStrict'); # default XMLSubsPerlArgs to 1 for now, until 3.0 $self->{xml_subs_perl_args} = &config($self, 'XMLSubsPerlArgs', undef, 1); # reduce (pattern) patterns to (?:pattern) to not create $1 side effect if($self->{xml_subs_match} = &config($self, 'XMLSubsMatch')) { $self->{xml_subs_match} =~ s/\(\?\:([^\)]*)\)/($1)/isg; $self->{xml_subs_match} =~ s/\(([^\)]*)\)/(?:$1)/isg; } my $lang = &config($self, 'ScriptLanguage', undef, 'PerlScript'); my $module = "Apache::ASP::Lang::".$lang; unless($ScriptLanguages{$lang}) { # eval "use $module;"; $self->Error("ScriptLanguage for $lang could not be loaded: $@"); return; } eval { my $lang_object = $module->new(ASP => $self); $self->{lang_object} = $lang_object; $self->{lang_module} = $module; $self->{lang_language} = $lang; $self->{lang_comment} = $lang_object->CommentStart; }; if($@) { $self->Error("ScriptLanguage object for $lang failed init: $@"); return; } } my $comment = $self->{lang_comment}; if(&config($self, 'CgiDoSelf')) { $data =~ s,^(.*?)__END__,,so; } # do both before and after, so =pods can span includes with =pods if($self->{pod_comments}) { &PodComments($self, \$data); } # if compiling includes, then do now before includes conversion # each include will also have its Script_OnParse run on it. if($self->{compile_includes} && $self->{GlobalASA}{'exists'}) { $self->{Server}{ScriptRef} = \$data; $self->{GlobalASA}->ExecuteEvent('Script_OnParse'); } # do includes as early as possible !! so included text gets done too # this section is for file includes, we do this here instead of ssi # so it can be parsed and compiled with the script local %includes; # trap recursive includes with this # JUST ONCE # there should only be one of these, <%@ LANGUAGE="PerlScript" %>, rip it out # we keep white space and substitue text in so the perlscript sync's up with lines # only take out the first one $data =~ s/^\#\![^\n]+(\n\s*)/\<\%$1\%\>/s; #X cgi compat ? $data =~ s/^(\s*)\<\%(\s*)\@([^\n]*?)\%\>/$1\<\%$2 ; \%\>/so; my $root_file = $file; my $line1_added = 0; my $munge = $data; $data = ''; my($file_context, $file_line_number, $code_block); while($munge =~ s/^(.*?)\ or $Response->Include() syntax, may also be in this directory, please see section on includes for more information. PerlSetVar Global /tmp =item GlobalPackage Perl package namespace that all scripts, includes, & global.asa events are compiled into. By default, GlobalPackage is some obscure name that is uniquely generated from the file path of the Global directory, and global.asa file. The use of explicitly naming the GlobalPackage is to allow scripts access to globals and subs defined in a perl module that is included with commands like: in perl script: use Some::Package; in apache conf: PerlModule Some::Package PerlSetVar GlobalPackage Some::Package =item UniquePackages default 0. Set to 1 to compile each script into its own perl package, so that subroutines defined in one script will not collide with another. By default, ASP scripts in a web application are compiled into the *same* perl package, so these scripts, their includes, and the global.asa events all share common globals & subroutines defined by each other. The problem for some developers was that they would at times define a subroutine of the same name in 2+ scripts, and one subroutine definition would redefine the other one because of the namespace collision. PerlSetVar UniquePackages 0 =item DynamicIncludes default 0. SSI file includes are normally inlined in the calling script, and the text gets compiled with the script as a whole. With this option set to TRUE, file includes are compiled as a separate subroutine and called when the script is run. The advantage of having this turned on is that the code compiled from the include can be shared between scripts, which keeps the script sizes smaller in memory, and keeps compile times down. PerlSetVar DynamicIncludes 0 =item IncludesDir no defaults. If set, this directory will also be used to look for includes when compiling scripts. By default the directory the script is in, and the Global directory are checked for includes. This extension was added so that includes could be easily shared between ASP applications, whereas placing includes in the Global directory only allows sharing between scripts in an application. PerlSetVar IncludesDir . Also, multiple includes directories may be set by creating a directory list separated by a semicolon ';' as in PerlSetVar IncludesDir ../shared;/usr/local/asp/shared Using IncludesDir in this way creates an includes search path that would look like ., Global, ../shared, /usr/local/asp/shared The current directory of the executing script is checked first whenever an include is specified, then the Global directory in which the global.asa resides, and finally the IncludesDir setting. =item NoCache Default 0, if set to 1 will make it so that neither script nor include compilations are cached by the server. Using this configuration will save on memory but will slow down script execution. Please see the TUNING section for other strategies on improving site performance. PerlSetVar NoCache 0 =head2 State Management =item NoState default 0, if true, neither the $Application nor $Session objects will be created. Use this for a performance increase. Please note that this setting takes precedence over the AllowSessionState and AllowApplicationState settings. PerlSetVar NoState 0 =item AllowSessionState Set to 0 for no session tracking, 1 by default If Session tracking is turned off, performance improves, but the $Session object is inaccessible. PerlSetVar AllowSessionState 1 Note that if you want to dissallow session creation for certain non web browser user agents, like search engine spiders, you can use an init handler like: PerlInitHandler "sub { $_[0]->dir_config('AllowSessionState', 0) }" =item AllowApplicationState Default 1. If you want to leave $Application undefined, then set this to 0, for a performance increase of around 2-3%. Allowing use of $Application is less expensive than $Session, as there is more work for the StateManager associated with $Session garbage collection so this parameter should be only used for extreme tuning. PerlSetVar AllowApplicationState 1 =item StateDir default $Global/.state. State files for ASP application go to this directory. Where the state files go is the most important determinant in what makes a unique ASP application. Different configs pointing to the same StateDir are part of the same ASP application. The default has not changed since implementing this config directive. The reason for this config option is to allow operating systems with caching file systems like Solaris to specify a state directory separately from the Global directory, which contains more permanent files. This way one may point StateDir to /tmp/myaspapp, and make one's ASP application scream with speed. PerlSetVar StateDir ./.state =item StateManager default 10, this number specifies the numbers of times per SessionTimeout that timed out sessions are garbage collected. The bigger the number, the slower your system, but the more precise Session_OnEnd's will be run from global.asa, which occur when a timed out session is cleaned up, and the better able to withstand Session guessing hacking attempts. The lower the number, the faster a normal system will run. The defaults of 20 minutes for SessionTimeout and 10 times for StateManager, has dead Sessions being cleaned up every 2 minutes. PerlSetVar StateManager 10 =item StateDB default SDBM_File, this is the internal database used for state objects like $Application and $Session. Because an SDBM_File %hash has a limit on the size of a record key+value pair, usually 1024 bytes, you may want to use another tied database like DB_File or MLDBM::Sync::SDBM_File. With lightweight $Session and $Application use, you can get away with SDBM_File, but if you load it up with complex data like $Session{key} = { # very large complex object } you might max out the 1024 limit. Currently StateDB can be: SDBM_File, MLDBM::Sync::SDBM_File, DB_File, and GDBM_File. Please let me know if you would like to add any more to this list. As of version .18, you may change this setting in a live production environment, and new state databases created will be of this format. With a prior version if you switch to a new StateDB, you would want to delete the old StateDir, as there will likely be incompatibilities between the different database formats, including the way garbage collection is handled. PerlSetVar StateDB SDBM_File =item StateCache Deprecated as of 2.23. There is no equivalent config for the functionality this represented from that version on. The 2.23 release represented a significant rewrite of the state management, moving to MLDBM::Sync for its subsystem. =item StateSerializer default Data::Dumper, you may set this to Storable for faster serialization and storage of data into state objects. This is particularly useful when storing large objects in $Session and $Application, as the Storable.pm module has a faster implementation of freezing and thawing data from and to perl structures. Note that if you are storing this much data in your state databases, you may want to use DB_File since it does not have the default 1024 byte limit that SDBM_File has on key/value lengths. This configuration setting may be changed in production as the state database's serializer type is stored in the internal state manager which will always use Data::Dumper & SDBM_File to store data. PerlSetVar StateSerializer Data::Dumper =head2 Sessions =item CookiePath URL root that client responds to by sending the session cookie. If your asp application falls under the server url "/asp", then you would set this variable to /asp. This then allows you to run different applications on the same server, with different user sessions for each application. PerlSetVar CookiePath / =item CookieDomain Default 0, this NON-PORTABLE configuration will allow sessions to span multiple web sites that match the same domain root. This is useful if your web sites are hosted on the same machine and can share the same StateDir configuration, and you want to shared the $Session data across web sites. Whatever this is set to, that will add a ; domain=$CookieDomain part to the Set-Cookie: header set for the session-id cookie. PerlSetVar CookieDomain .your.global.domain =item SessionTimeout Default 20 minutes, when a user's session has been inactive for this period of time, the Session_OnEnd event is run, if defined, for that session, and the contents of that session are destroyed. PerlSetVar SessionTimeout 20 =item SecureSession default 0. Sets the secure tag for the session cookie, so that the cookie will only be transmitted by the browser under https transmissions. PerlSetVar SecureSession 1 =item HTTPOnlySession default 0. Sets HttpOnly flag to session cookie to mitigate XSS attacks. Supported by most modern browsers, it only allows access to the session cookie by the server (ie NOT Javascript) PerlSetVar HTTPOnlySession 1 =item ParanoidSession default 0. When true, stores the user-agent header of the browser that creates the session and validates this against the session cookie presented. If this check fails, the session is killed, with the rationale that there is a hacking attempt underway. This config option was implemented to be a smooth upgrade, as you can turn it off and on, without disrupting current sessions. Sessions must be created with this turned on for the security to take effect. This config option is to help prevent a brute force cookie search from being successful. The number of possible cookies is huge, 2^128, thus making such a hacking attempt VERY unlikely. However, on the off chance that such an attack is successful, the hacker must also present identical browser headers to authenticate the session, or the session will be destroyed. Thus the User-Agent acts as a backup to the real session id. The IP address of the browser cannot be used, since because of proxies, IP addresses may change between requests during a session. There are a few browsers that will not present a User-Agent header. These browsers are considered to be browsers of type "Unknown", and this method works the same way for them. Most people agree that this level of security is unnecessary, thus it is titled paranoid :) PerlSetVar ParanoidSession 0 =item SessionSerialize default 0, if true, locks $Session for duration of script, which serializes requests to the $Session object. Only one script at a time may run, per user $Session, with sessions allowed. Serialized requests to the session object is the Microsoft ASP way, but is dangerous in a production environment, where there is risk of long-running or run-away processes. If these things happen, a session may be locked for an indefinite period of time. A user STOP button should safely quit the session however. PerlSetVar SessionSerialize 0 =item SessionCount default 0, if true enables the $Application->SessionCount API which returns how many sessions are currently active in the application. This config was created because there is a performance hit associated with this count tracking, so it is disabled by default. PerlSetVar SessionCount 1 =head2 Cookieless Sessions =item SessionQueryParse default 0, if true, will automatically parse the $Session session id into the query string of each local URL found in the $Response buffer. For this setting to work therefore, buffering must be enabled. This parsing will only occur when a session cookie has not been sent by a browser, so the first script of a session enabled site, and scripts viewed by web browsers that have cookies disabled will trigger this behavior. Although this runtime parsing method is computationally expensive, this cost should be amortized across most users that will not need this URL parsing. This is a lazy programmer's dream. For something more efficient, look at the SessionQuery setting. For more information about this solution, please read the SESSIONS section. PerlSetVar SessionQueryParse 0 =item SessionQueryParseMatch default 0, set to a regexp pattern that matches all URLs that you want to have SessionQueryParse parse in session ids. By default SessionQueryParse only modifies local URLs, but if you name your URLs of your site with absolute URLs like http://localhost then you will need to use this setting. So to match http://localhost URLs, you might set this pattern to ^http://localhost. Note that by setting this config, you are also setting SessionQueryParse. PerlSetVar SessionQueryParseMatch ^https?://localhost =item SessionQuery default 0, if set, the session id will be initialized from the $Request->QueryString if not first found as a cookie. You can use this setting coupled with the $Server->URL($url, \%params) API extension to generate local URLs with session ids in their query strings, for efficient cookieless session support. Note that if a browser has cookies disabled, every URL to any page that needs access to $Session will need to be created by this method, unless you are using SessionQueryParse which will do this for you automatically. PerlSetVar SessionQuery 0 =item SessionQueryMatch default 0, set to a regexp pattern that will match URLs for $Server->URL() to add a session id to. SessionQuery normally allows $Server->URL() to add session ids just to local URLs, so if you use absolute URL references like http://localhost/ for your web site, then just like with SessionQueryParseMatch, you might set this pattern to ^http://localhost If this is set, then you don't need to set SessionQuery, as it will be set automatically. PerlSetVar SessionQueryMatch ^http://localhost =item SessionQueryForce default 0, set to 1 if you want to disallow the use of cookies for session id passing, and only allow session ids to be passed on the query string via SessionQuery and SessionQueryParse settings. PerlSetVar SessionQueryForce 1 =head2 Developer Environment =item UseStrict default 0, if set to 1, will compile all scripts, global.asa and includes with "use strict;" inserted at the head of the file, saving you from the painful process of strictifying code that was not strict to begin with. Because of how essential "use strict" programming is in a mod_perl environment, this default might be set to 1 one day, but this will be up for discussion before that decision is made. Note too that errors triggered by "use strict" are now captured as part of the normal Apache::ASP error handling when this configuration is set, otherwise "use strict" errors will not be handled properly, so using UseStrict is better than your own "use strict" statements. PerlSetVar UseStrict 1 =item Debug 1 for server log debugging, 2 for extra client html output, 3 for microtimes logged. Use 1 for production debugging, use 2 or 3 for development. Turn off if you are not debugging. These settings activate $Response->Debug(). PerlSetVar Debug 2 If Debug 3 is set and Time::HiRes is installed, microtimes will show up in the log, and also calculate the time between one $Response->Debug() and another, so good for a quick benchmark when you glance at the logs. PerlSetVar Debug 3 If you would like to enable system level debugging, set Debug to a negative value. So for system level debugging, but no output to browser: PerlSetVar Debug -1 =item DebugBufferLength Default 100, set this to the number of bytes of the buffered output's tail you want to see when an error occurs and Debug 2 or MailErrorsTo is set, and when BufferingOn is enabled. With buffering the script output will not naturally show up when the script errors, as it has been buffered by the $Response object. It helps to see where in the script output an error halted the script, so the last bytes of the buffered output are included with the rest of the debugging information. For a demo of this functionality, try the ./site/eg/syntax_error.asp script, and turn buffering on. =item PodComments default 1. With pod comments turned on, perl pod style comments and documentation are parsed out of scripts at compile time. This make for great documentation and a nice debugging tool, and it lets you comment out perl code and html in blocks. Specifically text like this: =pod text or perl code here =cut will get ripped out of the script before compiling. The =pod and =cut perl directives must be at the beginning of the line, and must be followed by the end of the line. PerlSetVar PodComments 1 =item CollectionItem Enables PerlScript syntax like: $Request->Form('var')->Item; $Request->Form('var')->Item(1); $Request->Form('var')->Count; Old PerlScript syntax, enabled with use Win32::OLE qw(in valof with OVERLOAD); is like native syntax $Request->Form('var'); Only in Apache::ASP, can the above be written as: $Request->{Form}{var}; which you would do if you _really_ needed the speed. =head2 XML / XSLT =item XMLSubsMatch default not defined, set to some regexp pattern that will match all XML and HTML tags that you want to have perl subroutines handle. The is Apache::ASP's custom tag technology, and can be used to create powerful extensions to your XML and HTML rendering. Please see XML/XSLT section for instructions on its use. PerlSetVar XMLSubsMatch my:[\w\-]+ =item XMLSubsStrict default 0, when set XMLSubs will only take arguments that are properly formed XML tag arguments like: By default, XMLSubs accept arbitrary perl code as argument values: which is not always wanted or expected. Set XMLSubsStrict to 1 if this is the case. PerlSetVar XMLSubsStrict 1 =item XMLSubsPerlArgs default 1, when set attribute values will be interpreted as raw perl code so that these all would execute as one would expect: With the 2.45 release, 0 may be set for this configuration or a more ASP style variable interpolation: This configuration is being introduced experimentally in version 2.45, as it will become the eventual default in the 3.0 release. PerlSetVar XMLSubsPerlArgs Off =item XSLT default not defined, if set to a file, ASP scripts will be regarded as XML output and transformed with the given XSL file with XML::XSLT. This XSL file will also be executed as an ASP script first, and its output will be the XSL data used for the transformation. This XSL file will be executed as a dynamic include, so may be located in the current directory, Global, or IncludesDir. Please see the XML/XSLT section for an explanation of its use. PerlSetVar XSLT template.xsl =item XSLTMatch default .*, if XSLT is set by default all ASP scripts will be XSL transformed by the specified XSL template. This regexp setting will tell XSLT which file names to match with doing XSL transformations, so that regular HTML ASP scripts and XML ASP scripts can be configured with the same configuration block. Please see ./site/eg/.htaccess for an example of its use. PerlSetVar XSLTMatch \.xml$ =item XSLTParser default XML::XSLT, determines which perl module to use for XSLT parsing. This is a new config as of 2.11. Also supported is XML::Sablotron which does not handle XSLT with the exact same output, but is about 10 times faster than XML::XSLT. XML::LibXSLT may also be used as of version 2.29, and seems to be about twice again as fast as XML::Sablotron, and a very complete XSLT implementation. PerlSetVar XSLTParser XML::XSLT PerlSetVar XSLTParser XML::Sablotron PerlSetVar XSLTParser XML::LibXSLT =item XSLTCache Activate XSLT file based caching through CacheDB, CacheDir, and CacheSize settings. This gives cached XSLT performance near AxKit and greater than Cocoon. XSLT caches transformations keyed uniquely by XML & XSLT inputs. PerlSetVar XSLTCache 1 =item XSLTCacheSize as of version 2.11, this config is no longer supported. =head2 Caching The output caching layer is a file dbm based output cache that runs on top of the MLDBM::Sync so inherits its performance characteristics. With CacheDB set to MLDBM::Sync::SDBM_File, the cache layer is very fast at caching entries up to 20K in size, but for greater cached items, you should set CacheDB to another dbm like DB_File or GDBM_File. In order for the cache layer to function properly, whether for $Response->Include() output caching, see OBJECTS, or XSLT caching, see XML/XSLT, then Apache::ASP must be loaded in the parent httpd like so: # httpd.conf PerlModule Apache::ASP -- or -- use Apache::ASP; The cache layer automatically expires entries upon server restart, but for this to work, a $ServerID must be computed when the Apache::ASP module gets loaded to store in each cached item. Without the above done, each child httpd process will get its own $ServerID, so caching will not work at all. This said, output caching will not work in raw CGI mode, just running under mod_perl. =item CacheDB Like StateDB, sets dbm format for caching. Since SDBM_File only support key/values pairs of around 1K max in length, the default for this is MLDBM::Sync::SDBM_File, which is very fast for < 20K output sizes. For caching larger data than 20K, DB_File or GDBM_File are probably better to use. PerlSetVar CacheDB MLDBM::Sync::SDBM_File =begin html Here are some benchmarks about the CacheDB when used with caching output from $Response->Include(\%cache) running on a Linux 2.2.14 dual PIII-450. The variables are output size being cached & the CacheDB used, the default being MLDBM::Sync::SDBM_File.
CacheDBOutput CachedOperationOps/sec
MLDBM::Sync::SDBM_File 3200 bytes read 177
DB_File 3200 bytes read 59
MLDBM::Sync::SDBM_File 32000 bytes read 42
DB_File 32000 bytes read 53
MLDBM::Sync::SDBM_File 3200 bytes write 42
DB_File 3200 bytes write 39
=end html For your own benchmarks to test the relative speeds of the various DBMs under MLDBM::Sync, which is used by CacheDB, you may run the ./bench/bench_sync.pl script from the MLDBM::Sync distribution on your system. =item CacheDir By default, the cache directory is at StateDir/cache, but CacheDir can be used to set the StateDir value for caching purposes. One may want the CacheDir separate from StateDir for example StateDir might be a centrally network mounted file system, while CacheDir might be a local file cache. PerlSetVar CacheDir /tmp/asp_demo On a system like Solaris where there is a RAM disk mounted on the system like /tmp, I could put the CacheDir there. On a system like Linux where files are cached pretty well by default, this is less important. =item CacheSize By default, this is 10M of data per cache. When any cache, like the XSLTCache, reaches this limit, the cache will be purged by deleting the cached dbm files entirely. This is better for long term running of dbms than deleting individual records, because dbm formats will often degrade in performance with lots of insert & deletes. Units of M, K, and B are supported for megabytes, kilobytes, and bytes, with the default unit being B, so the following configs all mean the same thing; PerlSetVar CacheSize 10M PerlSetVar CacheSize 10240K PerlSetVar CacheSize 10485760B PerlSetVar CacheSize 10485760 There are 2 caches currently, the XSLTCache, and the Response cache, the latter which is currently invoked for caching output from includes with special syntax. See $Response->Include() for more info on the Response cache. =head2 Miscellaneous =item AuthServerVariables default 0. If you are using basic auth and would like $Request->ServerVariables set like AUTH_TYPE, AUTH_USER, AUTH_NAME, REMOTE_USER, & AUTH_PASSWD, then set this and Apache::ASP will initialize these values from Apache->*auth* commands. Use of these environment variables keeps applications cross platform compatible as other servers set these too when performing basic 401 auth. PerlSetVar AuthServerVariables 0 =item BufferingOn default 1, if true, buffers output through the response object. $Response object will only send results to client browser if a $Response->Flush() is called, or if the asp script ends. Lots of output will need to be flushed incrementally. If false, 0, the output is immediately written to the client, CGI style. There will be a performance hit server side if output is flushed automatically to the client, but is probably small. I would leave this on, since error handling is poor, if your asp script errors after sending only some of the output. PerlSetVar BufferingOn 1 =item InodeNames Default 0. Set to 1 to uses a stat() call on scripts and includes to derive subroutine namespace based on device and inode numbers. In case of multiple symbolic links pointing to the same script this will result in the script being compiled only once. Use only on unix flavours which support the stat() call that know about device and inode numbers. PerlSetVar InodeNames 1 =item RequestParams Default 0, if set creates $Request->Params object with combined contents of $Request->QueryString and $Request->Form. This is for developer convenience simlar to CGI.pm's param() method. PerlSetVar RequestParams 1 =item RequestBinaryRead Default On, if set to Off will not read POST data into $Request->Form(). One potential reason for configuring this to Off might be to initialize the Apache::ASP object in an Apache handler phase earlier than the normal PerlRequestHandler phase, so that it does not interfere with normal reading of POST data later in the request. PerlSetVar RequestBinaryRead On =item StatINC default 0, if true, reloads perl libraries that have changed on disk automatically for ASP scripts. If false, the www server must be restarted for library changes to take effect. A known bug is that any functions that are exported, e.g. confess Carp qw(confess), will not be refreshed by StatINC. To refresh these, you must restart the www server. This setting should be used in development only because it is so slow. For a production version of StatINC, see StatINCMatch. PerlSetVar StatINC 1 =item StatINCMatch default undef, if defined, it will be used as a regular expression to reload modules that match as in StatINC. This is useful because StatINC has a very high performance penalty in production, so if you can narrow the modules that are checked for reloading each script execution to a handful, you will only suffer a mild performance penalty. The StatINCMatch setting should be a regular expression like: Struct|LWP which would match on reloading Class/Struct.pm, and all the LWP/.* libraries. If you define StatINCMatch, you do not need to define StatINC. PerlSetVar StatINCMatch .* =item StatScripts default 1, if set to 0, changed scripts, global.asa, and includes will not be reloaded. Coupled with Apache mod_perl startup and restart handlers executing Apache::ASP->Loader() for your application this allows your application to be frozen, and only reloaded on the next server restart or stop/start. There are a few advantages for not reloading scripts and modules in production. First there is a slight performance improvement by not having to stat() the script, its includes and the global.asa every request. From an application deployment standpoint, you also gain the ability to deploy your application as a snapshot taken when the server starts and restarts. This provides you with the reassurance that during a production server update from development sources, you do not have to worry with sources being used for the wrong libraries and such, while they are all being copied over. Finally, though you really should not do this, you can work on a live production application, with a test server reloading changes, but your production server does see the changes until you restart or stop/start it. This saves your public from syntax errors while you are just doing a quick bug fix. PerlSetVar StatScripts 1 =item SoftRedirect default 0, if true, a $Response->Redirect() does not end the script. Normally, when a Redirect() is called, the script is ended automatically. SoftRedirect 1, is a standard way of doing redirects, allowing for html output after the redirect is specified. PerlSetVar SoftRedirect 0 =item Filter On/Off, default Off. With filtering enabled, you can take advantage of full server side includes (SSI), implemented through Apache::SSI. SSI is implemented through this mechanism by using Apache::Filter. A sample configuration for full SSI with filtering is in the ./site/eg/.htaccess file, with a relevant example script ./site/eg/ssi_filter.ssi. You may only use this option with modperl v1.16 or greater installed and PERL_STACKED_HANDLERS enabled. Filtering may be used in conjunction with other handlers that are also "filter aware". If in doubt, try building your mod_perl with perl Makefile.PL EVERYTHING=1 With filtering through Apache::SSI, you should expect near a a 20% performance decrease. PerlSetVar Filter Off =item CgiHeaders default 0. When true, script output that looks like HTTP / CGI headers, will be added to the HTTP headers of the request. So you could add: Set-Cookie: test=message ... to the top of your script, and all the headers preceding a newline will be added as if with a call to $Response->AddHeader(). This functionality is here for compatibility with raw cgi scripts, and those used to this kind of coding. When set to 0, CgiHeaders style headers will not be parsed from the script response. PerlSetVar CgiHeaders 0 =item Clean default 0, may be set between 1 and 9. This setting determine how much text/html output should be compressed. A setting of 1 strips mostly white space saving usually 10% in output size, at a performance cost of less than 5%. A setting of 9 goes much further saving anywhere 25% to 50% typically, but with a performance hit of 50%. This config option is implemented via HTML::Clean. Per script configuration of this setting is available via the $Response->{Clean} property, which may also be set between 0 and 9. PerlSetVar Clean 0 =item CompressGzip default 0, if true will gzip compress HTML output on the fly if Compress::Zlib is installed, and the client browser supports it. Depending on the HTML being compressed, the client may see a 50% to 90% reduction in HTML output. I have seen 40K of HTML squeezed down to just under 6K. This will come at a 5%-20% hit to CPU usage per request compressed. Note there are some cases when a browser says it will accept gzip encoding, but then not render it correctly. This behavior has been seen with IE5 when set to use a proxy but not using a proxy, and the URL does not end with a .html or .htm. No work around has yet been found for this case so use at your own risk. PerlSetVar CompressGzip 1 =item FormFill default 0, if true will auto fill HTML forms with values from $Request->Form(). This functionality is provided by use of HTML::FillInForm. For more information please see "perldoc HTML::FillInForm", and the example ./site/eg/formfill.asp. This feature can be enabled on a per form basis at runtime with $Response->{FormFill} = 1 PerlSetVar FormFill 1 =item TimeHiRes default 0, if set and Time::HiRes is installed, will do sub second timing of the time it takes Apache::ASP to process a request. This will not include the time spent in the session manager, nor modperl or Apache, and is only a rough approximation at best. If Debug is set also, you will get a comment in your HTML output that indicates the time it took to process that script. If system debugging is set with Debug -1 or -2, you will also get this time in the Apache error log with the other system messages. =head2 Mail Administration Apache::ASP has some powerful administrative email extensions that let you sleep at night, knowing full well that if an error occurs at the web site, you will know about it immediately. With these features already enabled, it was also easy to provide the $Server->Mail(\%mail) API extension which you can read up about in the OBJECTS section. =item MailHost The mail host is the smtp server that the below Mail* config directives will use when sending their emails. By default Net::SMTP uses smtp mail hosts configured in Net::Config, which is set up at install time, but this setting can be used to override this config. The mail hosts specified in the Net::Config file will be used as backup smtp servers to the MailHost specified here, should this primary server not be working. PerlSetVar MailHost smtp.yourdomain.com.foobar =item MailFrom Default NONE, set this to specify the default mail address placed in the From: mail header for the $Server->Mail() API extension, as well as MailErrorsTo and MailAlertTo. PerlSetVar MailFrom youremail@yourdomain.com.foobar =item MailErrorsTo No default, if set, ASP server errors, error code 500, that result while compiling or running scripts under Apache::ASP will automatically be emailed to the email address set for this config. This allows an administrator to have a rapid response to user generated server errors resulting from bugs in production ASP scripts. Other errors, such as 404 not found will be handled by Apache directly. An easy way to see this config in action is to have an ASP script which calls a die(), which generates an internal ASP 500 server error. The Debug config of value 2 and this setting are mutually exclusive, as Debug 2 is a development setting where errors are displayed in the browser, and MailErrorsTo is a production setting so that errors are silently logged and sent via email to the web admin. PerlSetVar MailErrorsTo youremail@yourdomain.com =item MailAlertTo The address configured will have an email sent on any ASP server error 500, and the message will be short enough to fit on a text based pager. This config setting would be used to give an administrator a heads up that a www server error occurred, as opposed to MailErrorsTo would be used for debugging that server error. This config does not work when Debug 2 is set, as it is a setting for use in production only, where Debug 2 is for development use. PerlSetVar MailAlertTo youremail@yourdomain.com =item MailAlertPeriod Default 20 minutes, this config specifies the time in minutes over which there may be only one alert email generated by MailAlertTo. The purpose of MailAlertTo is to give the admin a heads up that there is an error at the www server. MailErrorsTo is for to aid in speedy debugging of the incident. PerlSetVar MailAlertPeriod 20 =head2 File Uploads =item FileUploadMax default 0, if set will limit file uploads to this size in bytes. This is currently implemented by setting $CGI::POST_MAX before handling the file upload. Prior to this, a developer would have to hardcode a value for $CGI::POST_MAX to get this to work. PerlSetVar 100000 =item FileUploadTemp default 0, if set will leave a temp file on disk during the request, which may be helpful for processing by other programs, but is also a security risk in that other users on the operating system could potentially read this file while the script is running. The path to the temp file will be available at $Request->{FileUpload}{$form_field}{TempFile}. The regular use of file uploads remains the same with the <$filehandle> to the upload at $Request->{Form}{$form_field}. Please see the CGI section for more information on file uploads, and the $Request section in OBJECTS. PerlSetVar FileUploadTemp 0 =head1 SYNTAX =head2 General ASP embedding syntax allows one to embed code in html in 2 simple ways. The first is the <% xxx %> tag in which xxx is any valid perl code. The second is <%= xxx %> where xxx is some scalar value that will be inserted into the html directly. An easy print. A simple asp page would look like: For loop incrementing font size:

<% for(1..5) { %> Size = <%=$_%>
<% } %> Notice that your perl code blocks can span any html. The for loop above iterates over the html without any special syntax. =head2 XMLSubs XMLSubs allows a developer to define custom handlers for HTML & XML tags, which can extend the natural syntax of the ASP environment. Configured like: PerlSetVar XMLSubsMatch site:\w+ A simple tag like: can be constructed that could translate into: sub site::header { my $args = shift; print "$args->{title}\n"; print "\n"; } Better yet, one can use this functionality to trap and post process embedded HTML & XML like: ... some HTML here ... and then: sub site::page { my($args, $html) = @_; &site::header($args); $main::Response->Write($html); $main::Response->Write(""); } Though this could be used to fully render XML documents, it was not built for this purpose, but to add powerful tag extensions to HTML development environments. For full XML rendering, you ought to try an XSLT approach, also supported by Apache::ASP. =head2 Editors As Apache::ASP supports a mixing of perl and HTML, any editor which supports development of one or the other would work well. The following editors are known to work well for developing Apache::ASP web sites: * Emacs, in perl or HTML modes. For a mmm-mode config that mixes HTML & perl modes in a single buffer, check out the editors/mmm-asp-perl.el file in distribution. * Vim, special syntax support with editors/aasp.vim file in distribution. * UltraEdit32 ( http://www.ultraedit.com/ ) has syntax highlighting, good macros and a configurable wordlist (so one can have syntax highlighting both for Perl and HTML). Please feel free to suggest your favorite development environment for this list. =head1 EVENTS =head2 Overview The ASP platform allows developers to create Web Applications. In fulfillment of real software requirements, ASP allows event-triggered actions to be taken, which are defined in a global.asa file. The global.asa file resides in the Global directory, defined as a config option, and may define the following actions: Action Event ------ ------ Script_OnStart * Beginning of Script execution Script_OnEnd * End of Script execution Script_OnFlush * Before $Response being flushed to client. Script_OnParse * Before script compilation Application_OnStart Beginning of Application Application_OnEnd End of Application Session_OnStart Beginning of user Session. Session_OnEnd End of user Session. * These are API extensions that are not portable, but were added because they are incredibly useful These actions must be defined in the $Global/global.asa file as subroutines, for example: sub Session_OnStart { $Application->{$Session->SessionID()} = started; } Sessions are easy to understand. When visiting a page in a web application, each user has one unique $Session. This session expires, after which the user will have a new $Session upon revisiting. A web application starts when the user visits a page in that application, and has a new $Session created. Right before the first $Session is created, the $Application is created. When the last user $Session expires, that $Application expires also. For some web applications that are always busy, the Application_OnEnd event may never occur. =head2 Script_OnStart & Script_OnEnd The script events are used to run any code for all scripts in an application defined by a global.asa. Often, you would like to run the same code for every script, which you would otherwise have to add by hand, or add with a file include, but with these events, just add your code to the global.asa, and it will be run. There is one caveat. Code in Script_OnEnd is not guaranteed to be run when $Response->End() is called, since the program execution ends immediately at this event. To always run critical code, use the API extension: $Server->RegisterCleanup() =head2 Session_OnStart Triggered by the beginning of a user's session, Session_OnStart gets run before the user's executing script, and if the same session recently timed out, after the session's triggered Session_OnEnd. The Session_OnStart is particularly useful for caching database data, and avoids having the caching handled by clumsy code inserted into each script being executed. =head2 Session_OnEnd Triggered by a user session ending, Session_OnEnd can be useful for cleaning up and analyzing user data accumulated during a session. Sessions end when the session timeout expires, and the StateManager performs session cleanup. The timing of the Session_OnEnd does not occur immediately after the session times out, but when the first script runs after the session expires, and the StateManager allows for that session to be cleaned up. So on a busy site with default SessionTimeout (20 minutes) and StateManager (10 times) settings, the Session_OnEnd for a particular session should be run near 22 minutes past the last activity that Session saw. A site infrequently visited will only have the Session_OnEnd run when a subsequent visit occurs, and theoretically the last session of an application ever run will never have its Session_OnEnd run. Thus I would not put anything mission-critical in the Session_OnEnd, just stuff that would be nice to run whenever it gets run. =head2 Script_OnFlush API extension. This event will be called prior to flushing the $Response buffer to the web client. At this time, the $Response->{BinaryRef} buffer reference may be used to modify the buffered output at runtime to apply global changes to scripts output without having to modify all the scripts. sub Script_OnFlush { my $ref = $Response->{BinaryRef}; $$ref =~ s/\s+/ /sg; # to strip extra white space } Check out the ./site/eg/global.asa for an example of its use. =head2 Script_OnParse This event allows one to set up a source filter on the script text, allowing one to change the script on the fly before the compilation stage occurs. The script text is available in the $Server->{ScriptRef} scalar reference, and can be accessed like so: sub Script_OnParse { my $code = $Server->{ScriptRef} $$code .= " ADDED SOMETHING "; } =head2 Application_OnStart This event marks the beginning of an ASP application, and is run just before the Session_OnStart of the first Session of an application. This event is useful to load up $Application with data that will be used in all user sessions. =head2 Application_OnEnd The end of the application is marked by this event, which is run after the last user session has timed out for a given ASP application. =head2 Server_OnStart ( pseudo-event ) Some might want something like a Server_OnStart event, where some code gets runs when the web server starts. In mod_perl, this is easy to achieve outside of the scope of an ASP application, by putting some initialization code into a section in the httpd.conf file. Initializations that you would like to be shared with the child httpds are particularly useful, one such being the Apache::ASP->Loader() routine which you can read more about in the TUNING section - Precompile Scripts subsection. It is could be called like: # httpd.conf Apache::ASP->Loader($path, $pattern, %config) So a section is your Server_OnStart routine! =head2 mod_perl handlers If one wants to extend one's environment with mod_perl handlers, Apache::ASP does not stop this. Basic use of Apache::ASP in fact only involves the content handler phase of mod_perl's PerlHandler, like SetHandler perl-script PerlModule Apache::ASP PerlHandler Apache::ASP But mod_perl allows for direct access to many more Apache event stages, for full list try "perldoc mod_perl" or buy the mod_perl Eagle book. Some commonly used ones are: PerlInitHandler PerlTransHandler PerlFixupHandler PerlHandler PerlLogHandler PerlCleanupHandler For straight Apache::ASP programming, there are some equivalents, say Script_OnStart event instead of Init/Fixup stages, or $Server->RegisterCleanup() for Log/Cleanup stages, but you can do things in the mod_perl handlers that you cannot do in Apache::ASP, especially if you want to handle all files globally, and not just ASP scripts. For many Apache::* modules for use with mod_perl, of which Apache::ASP is just one, check out http://perl.apache.org/src/apache-modlist.html To gain access to the ASP objects like $Session outside in a non-PerlHandler mod_perl handler, you may use this API: my $ASP = Apache::ASP->new($r); # $r is Apache->request object as in this possible Authen handler: use Apache::ASP; sub My::Auth::handler { my $r = shift; my $ASP = Apache::ASP->new($r) my $Session = $ASP->Session; } Here are some examples of do-it-yourself mod_perl handler programming... === Forbid Bad HSlide User Agent === # httpd.conf PerlAccessHandler My::Access sub My::Access::handler { my $r = shift; if($r->headers_in->{'USER_AGENT'} =~ /HSlide/) { 403; } else { 200; } } === Runtime Path Parsing === This example shows how one might take an arbitrary URL path /$path/$file.asp, and turn that into a runtime config for your site, so your scripts get executed always in your sites DocumentRoot. INPUT URL /SomeCategory/ OUTPUT Script: index.asp $Server->Config('PATH') eq '/SomeCategory' INPUT URL /SomeCategory/index.asp OUTPUT Script: index.asp $Server->Config('PATH') eq '/SomeCategory' INPUT URI /index.asp OUTPUT Script: index.asp $Server->Config('PATH') eq '' # httpd.conf PerlTransHandler My::Init use lib qw( $custom_perllib ); # $custom_perllib/My/Init.pm package My::Init; use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; my $uri = $r->uri || '/'; unless($uri =~ m|^(.*)(/([^/.]+\.[\w]+)?)$|i) { warn("can't parse uri $uri"); return DECLINED; } $uri = $2; my $PATH = $1 || ''; $r->dir_config('PATH', $PATH); if($uri eq '/') { $uri = '/index.asp'; } $r->uri($uri); $r->filename($r->document_root.$uri); DECLINED; } 1; =head1 OBJECTS The beauty of the ASP Object Model is that it takes the burden of CGI and Session Management off the developer, and puts them in objects accessible from any ASP script & include. For the perl programmer, treat these objects as globals accessible from anywhere in your ASP application. The Apache::ASP object model supports the following: Object Function ------ -------- $Session - user session state $Response - output to browser $Request - input from browser $Application - application state $Server - general methods These objects, and their methods are further defined in the following sections. If you would like to define your own global objects for use in your scripts and includes, you can initialize them in the global.asa Script_OnStart like: use vars qw( $Form $Site ); # declare globals sub Script_OnStart { $Site = My::Site->new; # init $Site object $Form = $Request->Form; # alias form data $Server->RegisterCleanup(sub { # garbage collection $Site->DESTROY; $Site = $Form = undef; }); } In this way you can create site wide application objects and simple aliases for common functions. =head2 $Session Object The $Session object keeps track of user and web client state, in a persistent manner, making it relatively easy to develop web applications. The $Session state is stored across HTTP connections, in database files in the Global or StateDir directories, and will persist across web server restarts. The user session is referenced by a 128 bit / 32 byte MD5 hex hashed cookie, and can be considered secure from session id guessing, or session hijacking. When a hacker fails to guess a session, the system times out for a second, and with 2**128 (3.4e38) keys to guess, a hacker will not be guessing an id any time soon. If an incoming cookie matches a timed out or non-existent session, a new session is created with the incoming id. If the id matches a currently active session, the session is tied to it and returned. This is also similar to the Microsoft ASP implementation. The $Session reference is a hash ref, and can be used as such to store data as in: $Session->{count}++; # increment count by one %{$Session} = (); # clear $Session data The $Session object state is implemented through MLDBM, and a user should be aware of the limitations of MLDBM. Basically, you can read complex structures, but not write them, directly: $data = $Session->{complex}{data}; # Read ok. $Session->{complex}{data} = $data; # Write NOT ok. $Session->{complex} = {data => $data}; # Write ok, all at once. Please see MLDBM for more information on this topic. $Session can also be used for the following methods and properties: =over =item $Session->{CodePage} Not implemented. May never be until someone needs it. =item $Session->{LCID} Not implemented. May never be until someone needs it. =item $Session->{SessionID} SessionID property, returns the id for the current session, which is exchanged between the client and the server as a cookie. =item $Session->{Timeout} [= $minutes] Timeout property, if minutes is being assigned, sets this default timeout for the user session, else returns the current session timeout. If a user session is inactive for the full timeout, the session is destroyed by the system. No one can access the session after it times out, and the system garbage collects it eventually. =item $Session->Abandon() The abandon method times out the session immediately. All Session data is cleared in the process, just as when any session times out. =item $Session->Lock() API extension. If you are about to use $Session for many consecutive reads or writes, you can improve performance by explicitly locking $Session, and then unlocking, like: $Session->Lock(); $Session->{count}++; $Session->{count}++; $Session->{count}++; $Session->UnLock(); This sequence causes $Session to be locked and unlocked only 1 time, instead of the 6 times that it would be locked otherwise, 2 for each increment with one to read and one to write. Because of flushing issues with SDBM_File and DB_File databases, each lock actually ties fresh to the database, so the performance savings here can be considerable. Note that if you have SessionSerialize set, $Session is already locked for each script invocation automatically, as if you had called $Session->Lock() in Script_OnStart. Thus you do not need to worry about $Session locking for performance. Please read the section on SessionSerialize for more info. =item $Session->UnLock() API Extension. Unlocks the $Session explicitly. If you do not call this, $Session will be unlocked automatically at the end of the script. =back =head2 $Response Object This object manages the output from the ASP Application and the client web browser. It does not store state information like the $Session object but does have a wide array of methods to call. =over =item $Response->{BinaryRef} API extension. This is a perl reference to the buffered output of the $Response object, and can be used in the Script_OnFlush global.asa event to modify the buffered output at runtime to apply global changes to scripts output without having to modify all the scripts. These changes take place before content is flushed to the client web browser. sub Script_OnFlush { my $ref = $Response->{BinaryRef}; $$ref =~ s/\s+/ /sg; # to strip extra white space } Check out the ./site/eg/global.asa for an example of its use. =item $Response->{Buffer} Default 1, when TRUE sends output from script to client only at the end of processing the script. When 0, response is not buffered, and client is sent output as output is generated by the script. =item $Response->{CacheControl} Default "private", when set to public allows proxy servers to cache the content. This setting controls the value set in the HTTP header Cache-Control =item $Response->{Charset} This member when set appends itself to the value of the Content-Type HTTP header. If $Response->{Charset} = 'ISO-LATIN-1' is set, the corresponding header would look like: Content-Type: text/html; charset=ISO-LATIN-1 =item $Response->{Clean} = 0-9; API extension. Set the Clean level, default 0, on a per script basis. Clean of 1-9 compresses text/html output. Please see the Clean config option for more information. This setting may also be useful even if using compression to obfuscate HTML. =item $Response->{ContentType} = "text/html" Sets the MIME type for the current response being sent to the client. Sent as an HTTP header. =item $Response->{Debug} = 1|0 API extension. Default set to value of Debug config. May be used to temporarily activate or inactivate $Response->Debug() behavior. Something like: { local $Response->{Debug} = 1; $Response->Debug($values); } maybe be used to always log something. The Debug() method can be better than AppendToLog() because it will log data in data structures one level deep, whereas AppendToLog prints just raw string/scalar values. =item $Response->{Expires} = $time Sends a response header to the client indicating the $time in SECONDS in which the document should expire. A time of 0 means immediate expiration. The header generated is a standard HTTP date like: "Wed, 09 Feb 1994 22:23:32 GMT". =item $Response->{ExpiresAbsolute} = $date Sends a response header to the client with $date being an absolute time to expire. Formats accepted are all those accepted by HTTP::Date::str2time(), e.g. "Wed, 09 Feb 1994 22:23:32 GMT" -- HTTP format "Tuesday, 08-Feb-94 14:15:29 GMT" -- old rfc850 HTTP format "08-Feb-94" -- old rfc850 HTTP format "09 Feb 1994" -- proposed new HTTP format "Feb 3 1994" -- Unix 'ls -l' format "Feb 3 17:03" -- Unix 'ls -l' format =item $Response->{FormFill} = 0|1 If true, HTML forms generated by the script output will be auto filled with data from $Request->Form. This feature requires HTML::FillInForm to be installed. Please see the FormFill CONFIG for more information. This setting overrides the FormFill config at runtime for the script execution only. =item $Response->{IsClientConnected} 1 if web client is connected, 0 if not. This value starts set to 1, and will be updated whenever a $Response->Flush() is called. If BufferingOn is set, by default $Response->Flush() will only be called at the end of the HTML output. As of version 2.23 this value is updated correctly before global.asa Script_OnStart is called, so global script termination may be correctly handled during that event, which one might want to do with excessive user STOP/RELOADS when the web server is very busy. An API extension $Response->IsClientConnected may be called for refreshed connection status without calling first a $Response->Flush =item $Response->{PICS} If this property has been set, a PICS-Label HTTP header will be sent with its value. For those that do not know, PICS is a header that is useful in rating the internet. It stands for Platform for Internet Content Selection, and you can find more info about it at: http://www.w3.org =item $Response->{Status} = $status Sets the status code returned by the server. Can be used to set messages like 500, internal server error =item $Response->AddHeader($name, $value) Adds a custom header to a web page. Headers are sent only before any text from the main page is sent, so if you want to set a header after some text on a page, you must turn BufferingOn. =item $Response->AppendToLog($message) Adds $message to the server log. Useful for debugging. =item $Response->BinaryWrite($data) Writes binary data to the client. The only difference from $Response->Write() is that $Response->Flush() is called internally first, so the data cannot be parsed as an html header. Flushing flushes the header if has not already been written. If you have set the $Response->{ContentType} to something other than text/html, cgi header parsing (see CGI notes), will be automatically be turned off, so you will not necessarily need to use BinaryWrite for writing binary data. For an example of BinaryWrite, see the binary_write.htm example in ./site/eg/binary_write.htm Please note that if you are on Win32, you will need to call binmode on a file handle before reading, if its data is binary. =item $Response->Clear() Erases buffered ASP output. =item $Response->Cookies($name, [$key,] $value) Sets the key or attribute of cookie with name $name to the value $value. If $key is not defined, the Value of the cookie is set. ASP CookiePath is assumed to be / in these examples. $Response->Cookies('name', 'value'); --> Set-Cookie: name=value; path=/ $Response->Cookies("Test", "data1", "test value"); $Response->Cookies("Test", "data2", "more test"); $Response->Cookies( "Test", "Expires", &HTTP::Date::time2str(time+86400) ); $Response->Cookies("Test", "Secure", 1); $Response->Cookies("Test", "Path", "/"); $Response->Cookies("Test", "Domain", "host.com"); --> Set-Cookie:Test=data1=test%20value&data2=more%20test; \ expires=Fri, 23 Apr 1999 07:19:52 GMT; \ path=/; domain=host.com; secure The latter use of $key in the cookies not only sets cookie attributes such as Expires, but also treats the cookie as a hash of key value pairs which can later be accesses by $Request->Cookies('Test', 'data1'); $Request->Cookies('Test', 'data2'); Because this is perl, you can (NOT PORTABLE) reference the cookies directly through hash notation. The same 5 commands above could be compressed to: $Response->{Cookies}{Test} = { Secure => 1, Value => { data1 => 'test value', data2 => 'more test' }, Expires => 86400, # not portable, see above Domain => 'host.com', Path => '/' }; and the first command would be: # you don't need to use hash notation when you are only setting # a simple value $Response->{Cookies}{'Test Name'} = 'Test Value'; I prefer the hash notation for cookies, as this looks nice, and is quite perlish. It is here to stay. The Cookie() routine is very complex and does its best to allow access to the underlying hash structure of the data. This is the best emulation I could write trying to match the Collections functionality of cookies in IIS ASP. For more information on Cookies, please go to the source at http://home.netscape.com/newsref/std/cookie_spec.html =item $Response->Debug(@args) API Extension. If the Debug config option is set greater than 0, this routine will write @args out to server error log. refs in @args will be expanded one level deep, so data in simple data structures like one-level hash refs and array refs will be displayed. CODE refs like $Response->Debug(sub { "some value" }); will be executed and their output added to the debug output. This extension allows the user to tie directly into the debugging capabilities of this module. While developing an app on a production server, it is often useful to have a separate error log for the application to catch debugging output separately. One way of implementing this is to use the Apache ErrorLog configuration directive to create a separate error log for a virtual host. If you want further debugging support, like stack traces in your code, consider doing things like: $Response->Debug( sub { Carp::longmess('debug trace') }; $SIG{__WARN__} = \&Carp::cluck; # then warn() will stack trace The only way at present to see exactly where in your script an error occurred is to set the Debug config directive to 2, and match the error line number to perl script generated from your ASP script. However, as of version 0.10, the perl script generated from the asp script should match almost exactly line by line, except in cases of inlined includes, which add to the text of the original script, pod comments which are entirely yanked out, and <% # comment %> style comments which have a \n added to them so they still work. If you would like to see the HTML preceding an error while developing, consider setting the BufferingOn config directive to 0. =item $Response->End() Sends result to client, and immediately exits script. Automatically called at end of script, if not already called. =item $Response->ErrorDocument($code, $uri) API extension that allows for the modification the Apache ErrorDocument at runtime. $uri may be a on site document, off site URL, or string containing the error message. This extension is useful if you want to have scripts set error codes with $Response->{Status} like 401 for authentication failure, and to then control from the script what the error message looks like. For more information on the Apache ErrorDocument mechanism, please see ErrorDocument in the CORE Apache settings, and the Apache->custom_response() API, for which this method is a wrapper. =item $Response->Flush() Sends buffered output to client and clears buffer. =item $Response->Include($filename, @args) This API extension calls the routine compiled from asp script in $filename with the args @args. This is a direct translation of the SSI tag Please see the SSI section for more on SSI in general. This API extension was created to allow greater modularization of code by allowing includes to be called with runtime arguments. Files included are compiled once, and the anonymous code ref from that compilation is cached, thus including a file in this manner is just like calling a perl subroutine. The @args can be found in @_ in the includes like: # include.inc <% my @args = @_; %> As of 2.23, multiple return values can be returned from an include like: my @rv = $Response->Include($filename, @args); =item $Response->Include(\%cache_args, @sub_args) *CACHE API* As of version 2.23, output from an include may be cached with this API and the CONFIG settings CacheDir & CacheDB. This can be used to execute expensive includes only rarely where applicable, drastically increasing performance in some cases. This API extension applies to the entire include family: my @rv = $Response->Include(\%cache_args, @include_args) my $html_ref = $Response->TrapInclude(\%cache_args, @include_args) $Server->Execute(\%cache_args, @include_args) For this output cache to work, you must load Apache::ASP in the Apache parent httpd like so: # httpd.conf PerlModule Apache::ASP The cache arguments are shown here $Response->Include({ File => 'file.inc', Cache => 1, # to activate cache layer Expires => 3600, # to expire in one hour LastModified => time() - 600, # to expire if cached before 10 minutes ago Key => $Request->Form, # to cache based on checksum of serialized form data, Clear => 1, # always executes include & cache output }, @include_args); File - include file to execute, can be file name or \$script script data passed in as a string reference. Cache - activate caching, will run like normal include without this Expires - only cache for this long in seconds LastModified - if cached before this time(), expire Key - The cache item identity. Can be $data, \$data, \%data, \@data, this data is serialized and combined with the filename & @include_args to create a MD5 checksum to fetch from the cache with. If you wanted to cache the results of a search page from form data POSTed, then this key could be { Key => $Request->Form } Clear - If set to 1, or boolean true, will always execute the include and update the cache entry for it. Motivation: If an include takes 1 second to execute because of complex SQL to a database, and you can cache the output of this include because it is not realtime data, and the cache layer runs at .01 seconds, then you have a 100 fold savings on that part of the script. Site scalability can be dramatically increased in this way by intelligently caching bottlenecks in the web application. Use Sparingly: If you have a fast include, then it may execute faster than the cache layer runs, in which case you may actually slow your site down by using this feature. Therefore try to use this sparingly, and only when sure you really need it. Apache::ASP scripts generally execute very quickly, so most developers will not need to use this feature at all. =item $Response->Include(\$script_text, @args) Added in Apache::ASP 2.11, this method allows for executing ASP scripts that are generated dynamically by passing in a reference to the script data instead of the file name. This works just like the normal $Response->Include() API, except a string reference is passed in instead of a filename. For example: <% my $script = "<\% print 'TEST'; %\>"; $Response->Include(\$script); %> This include would output TEST. Note that tokens like <% and %> must be escaped so Apache::ASP does not try to compile those code blocks directly when compiling the original script. If the $script data were fetched directly from some external resource like a database, then these tokens would not need to be escaped at all as in: <% my $script = $dbh->selectrow_array( "select script_text from scripts where script_id = ?", undef, $script_id ); $Response->Include(\$script); %> This method could also be used to render other types of dynamic scripts, like XML docs using XMLSubs for example, though for complex runtime XML rendering, one should use something better suited like XSLT. See the $Server->XSLT API for more on this topic. =item $Response->IsClientConnected() API Extension. 1 for web client still connected, 0 if disconnected which might happen if the user hits the stop button. The original API for this $Response->{IsClientConnected} is only updated after a $Response->Flush is called, so this method may be called for a refreshed status. Note $Response->Flush calls $Response->IsClientConnected to update $Response->{IsClientConnected} so to use this you are going straight to the source! But if you are doing a loop like: while(@data) { $Response->End if ! $Response->{IsClientConnected}; my $row = shift @data; %> <%= $row %> <% $Response->Flush; } Then its more efficient to use the member instead of the method since $Response->Flush() has already updated that value for you. =item $Response->Redirect($url) Sends the client a command to go to a different url $url. Script immediately ends. =item $Response->TrapInclude($file, @args) Calls $Response->Include() with same arguments as passed to it, but instead traps the include output buffer and returns it as as a perl string reference. This allows one to postprocess the output buffer before sending to the client. my $string_ref = $Response->TrapInclude('file.inc'); $$string_ref =~ s/\s+/ /sg; # squash whitespace like Clean 1 print $$string_ref; The data is returned as a referenece to save on what might be a large string copy. You may dereference the data with the $$string_ref notation. =item $Response->Write($data) Write output to the HTML page. <%=$data%> syntax is shorthand for a $Response->Write($data). All final output to the client must at some point go through this method. =back =head2 $Request Object The request object manages the input from the client browser, like posts, query strings, cookies, etc. Normal return results are values if an index is specified, or a collection / perl hash ref if no index is specified. WARNING, the latter property is not supported in ActiveState PerlScript, so if you use the hashes returned by such a technique, it will not be portable. A normal use of this feature would be to iterate through the form variables in the form hash... $form = $Request->Form(); for(keys %{$form}) { $Response->Write("$_: $form->{$_}
\n"); } Please see the ./site/eg/server_variables.htm asp file for this method in action. Note that if a form POST or query string contains duplicate values for a key, those values will be returned through normal use of the $Request object: @values = $Request->Form('key'); but you can also access the internal storage, which is an array reference like so: $array_ref = $Request->{Form}{'key'}; @values = @{$array_ref}; Please read the PERLSCRIPT section for more information on how things like $Request->QueryString() & $Request->Form() behave as collections. =over =item $Request->{Method} API extension. Returns the client HTTP request method, as in GET or POST. Added in version 2.31. =item $Request->{TotalBytes} The amount of data sent by the client in the body of the request, usually the length of the form data. This is the same value as $Request->ServerVariables('CONTENT_LENGTH') =item $Request->BinaryRead([$length]) Returns a string whose contents are the first $length bytes of the form data, or body, sent by the client request. If $length is not given, will return all of the form data. This data is the raw data sent by the client, without any parsing done on it by Apache::ASP. Note that BinaryRead will not return any data for file uploads. Please see the $Request->FileUpload() interface for access to this data. $Request->Form() data will also be available as normal. =item $Request->ClientCertificate() Not implemented. =item $Request->Cookies($name [,$key]) Returns the value of the Cookie with name $name. If a $key is specified, then a lookup will be done on the cookie as if it were a query string. So, a cookie set by: Set-Cookie: test=data1=1&data2=2 would have a value of 2 returned by $Request->Cookies('test','data2'). If no name is specified, a hash will be returned of cookie names as keys and cookie values as values. If the cookie value is a query string, it will automatically be parsed, and the value will be a hash reference to these values. When in doubt, try it out. Remember that unless you set the Expires attribute of a cookie with $Response->Cookies('cookie', 'Expires', $xyz), the cookies that you set will only last until you close your browser, so you may find your self opening & closing your browser a lot when debugging cookies. For more information on cookies in ASP, please read $Response->Cookies() =item $Request->FileUpload($form_field, $key) API extension. The FileUpload interface to file upload data is stabilized. The internal representation of the file uploads is a hash of hashes, one hash per file upload found in the $Request->Form() collection. This collection of collections may be queried through the normal interface like so: $Request->FileUpload('upload_file', 'ContentType'); $Request->FileUpload('upload_file', 'FileHandle'); $Request->FileUpload('upload_file', 'BrowserFile'); $Request->FileUpload('upload_file', 'Mime-Header'); $Request->FileUpload('upload_file', 'TempFile'); * note that TempFile must be use with the UploadTempFile configuration setting. The above represents the old slow collection interface, but like all collections in Apache::ASP, you can reference the internal hash representation more easily. my $fileup = $Request->{FileUpload}{upload_file}; $fileup->{ContentType}; $fileup->{BrowserFile}; $fileup->{FileHandle}; $fileup->{Mime-Header}; $fileup->{TempFile}; =item $Request->Form($name) Returns the value of the input of name $name used in a form with POST method. If $name is not specified, returns a ref to a hash of all the form data. One can use this hash to create a nice alias to the form data like: # in global.asa use vars qw( $Form ); sub Script_OnStart { $Form = $Request->Form; } # then in ASP scripts <%= $Form->{var} %> File upload data will be loaded into $Request->Form('file_field'), where the value is the actual file name of the file uploaded, and the contents of the file can be found by reading from the file name as a file handle as in: while(read($Request->Form('file_field_name'), $data, 1024)) {}; For more information, please see the CGI / File Upload section, as file uploads are implemented via the CGI.pm module. An example can be found in the installation samples ./site/eg/file_upload.asp =item $Request->Params($name) API extension. If RequestParams CONFIG is set, the $Request->Params object is created with combined contents of $Request->QueryString and $Request->Form. This is for developer convenience simlar to CGI.pm's param() method. Just like for $Response->Form, one could create a nice alias like: # in global.asa use vars qw( $Params ); sub Script_OnStart { $Params = $Request->Params; } =item $Request->QueryString($name) Returns the value of the input of name $name used in a form with GET method, or passed by appending a query string to the end of a url as in http://localhost/?data=value. If $name is not specified, returns a ref to a hash of all the query string data. =item $Request->ServerVariables($name) Returns the value of the server variable / environment variable with name $name. If $name is not specified, returns a ref to a hash of all the server / environment variables data. The following would be a common use of this method: $env = $Request->ServerVariables(); # %{$env} here would be equivalent to the cgi %ENV in perl. =back =head2 $Application Object Like the $Session object, you may use the $Application object to store data across the entire life of the application. Every page in the ASP application always has access to this object. So if you wanted to keep track of how many visitors there where to the application during its lifetime, you might have a line like this: $Application->{num_users}++ The Lock and Unlock methods are used to prevent simultaneous access to the $Application object. =over =item $Application->Lock() Locks the Application object for the life of the script, or until UnLock() unlocks it, whichever comes first. When $Application is locked, this guarantees that data being read and written to it will not suddenly change on you between the reads and the writes. This and the $Session object both lock automatically upon every read and every write to ensure data integrity. This lock is useful for concurrent access control purposes. Be careful to not be too liberal with this, as you can quickly create application bottlenecks with its improper use. =item $Application->UnLock() Unlocks the $Application object. If already unlocked, does nothing. =item $Application->GetSession($sess_id) This NON-PORTABLE API extension returns a user $Session given a session id. This allows one to easily write a session manager if session ids are stored in $Application during Session_OnStart, with full access to these sessions for administrative purposes. Be careful not to expose full session ids over the net, as they could be used by a hacker to impersonate another user. So when creating a session manager, for example, you could create some other id to reference the SessionID internally, which would allow you to control the sessions. This kind of application would best be served under a secure web server. The ./site/eg/global_asa_demo.asp script makes use of this routine to display all the data in current user sessions. =item $Application->SessionCount() This NON-PORTABLE method returns the current number of active sessions in the application, and is enabled by the SessionCount configuration setting. This method is not implemented as part of the original ASP object model, but is implemented here because it is useful. In particular, when accessing databases with license requirements, one can monitor usage effectively through accessing this value. =back =head2 $Server Object The server object is that object that handles everything the other objects do not. The best part of the server object for Win32 users is the CreateObject method which allows developers to create instances of ActiveX components, like the ADO component. =over =item $Server->{ScriptTimeout} = $seconds Not implemented. May never be. Please see the Apache Timeout configuration option, normally in httpd.conf. =item $Server->Config($setting) API extension. Allows a developer to read the CONFIG settings, like Global, GlobalPackage, StateDir, etc. Currently implemented as a wrapper around Apache->dir_config($setting) May also be invoked as $Server->Config(), which will return a hash ref of all the PerlSetVar settings. =item $Server->CreateObject($program_id) Allows use of ActiveX objects on Win32. This routine returns a reference to an Win32::OLE object upon success, and nothing upon failure. It is through this mechanism that a developer can utilize ADO. The equivalent syntax in VBScript is Set object = Server.CreateObject(program_id) For further information, try 'perldoc Win32::OLE' from your favorite command line. =item $Server->Execute($file, @args) New method from ASP 3.0, this does the same thing as $Response->Include($file, @args) and internally is just a wrapper for such. Seems like we had this important functionality before the IIS/ASP camp! =item $Server->File() Returns the absolute file path to current executing script. Same as Apache->request->filename when running under mod_perl. ASP API extension. =item $Server->GetLastError() Not implemented, will likely not ever be because this is dependent on how IIS handles errors and is not relevant in Apache. =item $Server->HTMLEncode( $string || \$string ) Returns an HTML escapes version of $string. &, ", >, <, are each escapes with their HTML equivalents. Strings encoded in this nature should be raw text displayed to an end user, as HTML tags become escaped with this method. As of version 2.23, $Server->HTMLEncode() may take a string reference for an optmization when encoding a large buffer as an API extension. Here is how one might use one over the other: my $buffer = '&' x 100000; $buffer = $Server->HTMLEncode($buffer); print $buffer; - or - my $buffer = '&' x 100000; $Server->HTMLEncode(\$buffer); print $buffer; Using the reference passing method in benchmarks on 100K of data was 5% more efficient, but maybe useful for some. It saves on copying the 100K buffer twice. =item $Server->MapInclude($include) API extension. Given the include $include, as an absolute or relative file name to the current executing script, this method returns the file path that the include would be found from the include search path. The include search path is the current script directory, Global, and IncludesDir directories. If the include is not found in the includes search path, then undef, or bool false, is returned. So one may do something like this: if($Server->MapInclude('include.inc')) { $Response->Include('include.inc'); } This code demonstrates how one might only try to execute an include if it exists, which is useful since a script will error if it tries to execute an include that does not exist. =item $Server->MapPath($url); Given the url $url, absolute, or relative to the current executing script, this method returns the equivalent filename that the server would translate the request to, regardless or whether the request would be valid. Only a $url that is relative to the host is valid. Urls like "." and "/" are fine arguments to MapPath, but http://localhost would not be. To see this method call in action, check out the sample ./site/eg/server.htm script. =item $Server->Mail(\%mail, %smtp_args); With the Net::SMTP and Net::Config modules installed, which are part of the perl libnet package, you may use this API extension to send email. The \%mail hash reference that you pass in must have values for at least the To, From, and Subject headers, and the Body of the mail message. The return value of this routine is 1 for success, 0 for failure. If the MailHost SMTP server is not available, this will have a return value of 0. You could send an email like so: $Server->Mail({ To => 'somebody@yourdomain.com.foobar', From => 'youremail@yourdomain.com.foobar', Subject => 'Subject of Email', Body => 'Body of message. '. 'You might have a lot to say here!', Organization => 'Your Organization', CC => 'youremailcc@yourdomain.com.foobar', BCC => 'youremailbcc@yourdomain.com.foobar', Debug => 0 || 1, }); Any extra fields specified for the email will be interpreted as headers for the email, so to send an HTML email, you could set 'Content-Type' => 'text/html' in the above example. If you have MailFrom configured, this will be the default for the From header in your email. For more configuration options like the MailHost setting, check out the CONFIG section. The return value of this method call will be boolean for success of the mail being sent. If you would like to specially configure the Net::SMTP object used internally, you may set %smtp_args and they will be passed on when that object is initialized. "perldoc Net::SMTP" for more into on this topic. If you would like to include the output of an ASP page as the body of the mail message, you might do something like: my $mail_body = $Response->TrapInclude('mail_body.inc'); $Server->Mail({ %mail, Body => $$mail_body }); =item $Server->RegisterCleanup($sub) non-portable extension Sets a subroutine reference to be executed after the script ends, whether normally or abnormally, the latter occurring possibly by the user hitting the STOP button, or the web server being killed. This subroutine must be a code reference created like: $Server->RegisterCleanup(sub { $main::Session->{served}++; }); or sub served { $main::Session->{served}++; } $Server->RegisterCleanup(\&served); The reference to the subroutine passed in will be executed. Though the subroutine will be executed in anonymous context, instead of the script, all objects will still be defined in main::*, that you would reference normally in your script. Output written to $main::Response will have no affect at this stage, as the request to the www client has already completed. Check out the ./site/eg/register_cleanup.asp script for an example of this routine in action. =item $Server->Transfer($file, @args) New method from ASP 3.0. Transfers control to another script. The Response buffer will not be cleared automatically, so if you want this to serve as a faster $Response->Redirect(), you will need to call $Response->Clear() before calling this method. This new script will take over current execution and the current script will not continue to be executed afterwards. It differs from Execute() because the original script will not pick up where it left off. As of Apache::ASP 2.31, this method now accepts optional arguments like $Response->Include & $Server->Execute. $Server->Transfer is now just a wrapper for: $Response->Include($file, @args); $Response->End; =item $Server->URLEncode($string) Returns the URL-escaped version of the string $string. +'s are substituted in for spaces and special characters are escaped to the ascii equivalents. Strings encoded in this manner are safe to put in urls... they are especially useful for encoding data used in a query string as in: $data = $Server->URLEncode("test data"); $url = "http://localhost?data=$data"; $url evaluates to http://localhost?data=test+data, and is a valid URL for use in anchor tags and redirects, etc. =item $Server->URL($url, \%params) Will return a URL with %params serialized into a query string like: $url = $Server->URL('test.asp', { test => value }); which would give you a URL of test.asp?test=value Used in conjunction with the SessionQuery* settings, the returned URL will also have the session id inserted into the query string, making this a critical part of that method of implementing cookieless sessions. For more information on that topic please read on the setting in the CONFIG section, and the SESSIONS section too. =item $Server->XSLT(\$xsl_data, \$xml_data) * NON-PORTABLE API EXTENSION * This method takes string references for XSL and XML data and returns the XSLT output as a string reference like: my $xslt_data_ref = $Server->XSLT(\$xsl_data, \$xml_data) print $$xslt_data_ref; The XSLT parser defaults to XML::XSLT, and is configured with the XSLTParser setting, which can also use XML::Sablotron ( support added in 2.11 ), and XML::LibXSLT ( support added in 2.29 ). Please see the CONFIG section for more information on the XSLT* settings that drive this API. The XSLT setting itself uses this API internally to do its rendering. This API was created to allow developers easy XSLT component rendering without having to render the entire ASP scripts via XSLT. This will make an easy plugin architecture for those looking to integrate XML into their existing ASP application frameworks. At some point, the API will likely take files as arguments, but not as of the 2.11 release. =back =head1 SSI SSI is great! One of the main features of server side includes is to include other files in the script being requested. In Apache::ASP, this is implemented in a couple ways, the most crucial of which is implemented in the file include. Formatted as ,the .inc being merely a convention, text from the included file will be inserted directly into the script being executed and the script will be compiled as a whole. Whenever the script or any of its includes change, the script will be recompiled. Includes go a great length to promote good decomposition and code sharing in ASP scripts, but they are still fairly static. As of version .09, includes may have dynamic runtime execution, as subroutines compiled into the global.asa namespace. The first way to invoke includes dynamically is If @args is specified, Apache::ASP knows to execute the include at runtime instead of inlining it directly into the compiled code of the script. It does this by compiling the script at runtime as a subroutine, and caching it for future invocations. Then the compiled subroutine is executed and has @args passed into its as arguments. This is still might be too static for some, as @args is still hardcoded into the ASP script, so finally, one may execute an include at runtime by utilizing this API extension $Response->Include("filename.inc", @args); which is a direct translation of the dynamic include above. Although inline includes should be a little faster, runtime dynamic includes represent great potential savings in httpd memory, as includes are shared between scripts keeping the size of each script to a minimum. This can often be significant saving if much of the formatting occurs in an included header of a www page. By default, all includes will be inlined unless called with an args parameter. However, if you want all your includes to be compiled as subs and dynamically executed at runtime, turn the DynamicIncludes config option on as documented above. =head2 Apache::SSI for mod_perl 1.3.x only One of the things missing above is the tag. This and many other SSI code extensions are available by filtering Apache::ASP output through Apache::SSI via the Apache::Filter and the Filter config options, available in mod_perl 1.3.x / Apache 1.3.x. Unfortunately this functionality is not available with mod_perl 2 / Apache 2. For more information on how to wire Apache::ASP and Apache::SSI together, please see the Filter config option documented above. Also please see Apache::SSI for further information on the capabilities it offers. =head2 SSI with mod_filter in Apache 2 Apache 2 offers chained filters. It may be possible to chain filters to Apache::ASP output through mod_filter for SSI processing: http://httpd.apache.org/docs/2.1/mod/mod_filter.html =head1 EXAMPLES Use with Apache. Copy the ./site/eg directory from the ASP installation to your Apache document tree and try it out! You have to put "AllowOverride All" in your config section to let the .htaccess file in the ./site/eg installation directory do its work. IMPORTANT (FAQ): Make sure that the web server has write access to that directory. Usually a chmod -R 0777 eg will do the trick :) =head1 SESSIONS Cookies are used by default for user $Session support ( see OBJECTS ). In order to track a web user and associate server side data with that client, the web server sets, and the web client returns a 32 byte session id identifier cookie. This implementation is very secure and may be used in secure HTTPS transactions, and made stronger with SecureSession, HTTPOnlySession and ParanoidSession settings (see CONFIG ). However good cookies are for this kind of persistent state management between HTTP requests, they have long been under fire for security risks associated with JavaScript security exploits and privacy abuse by large data tracking companies. Because of these reasons, web users will sometimes turn off their cookies, rendering normal ASP session implementations powerless, resulting in a new $Session generated every request. This is not good for ASP style sessions. =head2 Cookieless Sessions *** See WARNING Below *** So we now have more ways to track sessions with the SessionQuery* CONFIG settings, that allow a web developer to embed the session id in URL query strings when use of cookies is denied. The implementations work such that if a user has cookies turned on, then cookies will be used, but for those users with cookies turned off, the session ids will be parsed into document URLs. The first and easiest method that a web developer may use to implement cookieless sessions are with SessionQueryParse* directives which enable Apache::ASP to the parse the session id into document URLs on the fly. Because this is resource inefficient, there is also the SessionQuery* directives that may be used with the $Server->URL($url,\%params) method to generate custom URLs with the session id in its query string. To see an example of these cookieless sessions in action, check out the ./site/eg/session_query_parse.asp example. *** WARNING *** If you do use these methods, then be VERY CAREFUL of linking offsite from a page that was accessed with a session id in a query string. This is because this session id will show up in the HTTP_REFERER logs of the linked to site, and a malicious hacker could use this information to compromise the security of your site's $Sessions, even if these are run under a secure web server. In order to shake a session id off an HTTP_REFERER for a link taking a user offsite, you must point that link to a redirect page that will redirect a user, like so: <% # "cross site scripting bug" prevention my $sanitized_url = $Server->HTMLEncode($Response->QueryString('OffSiteUrl')); %> Redirecting you offsite to >here... Because the web browser visits a real page before being redirected with the tag, the HTTP_REFERER will be set to this page. Just be sure to not link to this page with a session id in its query string. Unfortunately a simple $Response->Redirect() will not work here, because the web browser will keep the HTTP_REFERER of the original web page if only a normal redirect is used. =head1 XML/XSLT =head2 Custom Tags with XMLSubsMatch Before XML, there was the need to make HTML markup smarter. Apache::ASP gives you the ability to have a perl subroutine handle the execution of any predefined tag, taking the tag descriptors, and the text contained between, as arguments of the subroutine. This custom tag technology can be used to extend a web developer's abilities to add dynamic pieces without having to visibly use <% %> style code entries. So, lets say that you have a table that you want to insert for an employee with contact info and the like, you could set up a tag like: Jane Doe has been here since 1998. To render it with a custom tag, you would tell the Apache::ASP parser to render the tag with a subroutine: PerlSetVar XMLSubsMatch my:new-employee Any colons, ':', in the XML custom tag will turn into '::', a perl package separator, so the my:employee tag would translate to the my::employee subroutine, or the employee subroutine in the my package. Any dash "-" will also be translated to an underscore "_", as dash is not valid in the names of perl subroutines. Then you would create the my::employee subroutine in the my perl package or whereever like so: package my; sub new_employee { my($attributes, $body) = @_; $main::Response->Include('new_employee.inc', $attributes, $body); } 1; <% my($attributes, $body) = @_; %> <% for('name', 'last', 'phone') { %> <% } %>
<%=ucfirst $_ %>: <%= $attributes->{$_} %>
<%= $body %>
The $main::Response->Include() would then delegate the rendering of the new-employee to the new_employee.inc ASP script include. Though XML purists would not like this custom tag technology to be related to XML, the reality is that a careful site engineer could render full XML documents with this technology, applying all the correct styles that one might otherwise do with XSLT. Custom tags defined in this way can be used as XML tags are defined with both a body and without as it ... and just These tags are very powerful in that they can also enclose normal ASP logic, like: <% my $birthday = &HTTP::Date::time2str(time - 25 * 86400 * 365); %> This employee has been online for <%= int(rand()*600)+1 %> seconds, and was born near <%= $birthday %>. For an example of this custom XML tagging in action, please check out the ./site/eg/xml_subs.asp script. =head2 XSLT Tranformations XML is good stuff, but what can you use it for? The principle is that by having data and style separated in XML and XSL files, you can reformat your data more easily in the future, and you can render your data in multiple formats, just as easily as for your web site, so you might render your site to a PDA, or a cell phone just as easily as to a browser, and all you have to do is set up the right XSL stylesheets to do the transformation (XSLT). With native XML/XSLT support, Apache::ASP scripts may be the source of XML data that the XSL file transforms, and the XSL file itself will be first executed as an ASP script also. The XSLT transformation is handled by XML::XSLT or XML::Sablotron and you can see an example of it in action at the ./site/eg/xslt.xml XML script. To specify a XSL stylesheet, use the setting: PerlSetVar XSLT template.xsl where template.xsl could be any file. By default this will XSLT transform all ASP scripts so configured, but you can separate xml scripts from the rest with the setting: PerlSetVar XSLTMatch xml$ where all files with the ending xml would undergo a XSLT transformation. Note that XSLT depends on the installation of XML::XSLT, which in turn depends on XML::DOM, and XML::Parser. As of version 2.11, XML::Sablotron may also be used by setting: PerlSetVar XSLTParser XML::Sablotron and XML::LibXSLT may be used, as of 2.29, by setting PerlSetVar XSLTParser XML::LibXSLT If you would like to install XML::Sablotron or XML::LibXSLT, you will first have to install the libraries that these perl modules use, which you can get at: libxslt - The XSLT C Library for Gnome http://xmlsoft.org/XSLT/ Sablotron - Ginger Alliance http://www.gingerall.com For more on XML::XSLT, the default XSLT engine that Apache::ASP will use, please see: XML::XSLT http://xmlxslt.sourceforge.net/ XML:XSLT was the first supported XSLT engine as has the benefit of being written in pure perl so that though while it is slower than the other solutions, it is easier to port. If you would like to cache XSLT tranformations, which is highly recommended, just set: PerlSetVar XSLTCache 1 Please see the Cache settings in the CONFIG section for more about how to configure the XSLTCache. =head2 References For more information about XSLT, please see the standard at: http://www.w3.org/TR/xslt For their huge ground breaking XML efforts, these other XML OSS projects need mention: Cocoon - XML-based web publishing, in Java http://cocoon.apache.org/ AxKit - XML web publishing with Apache & mod_perl http://www.axkit.org/ =head1 CGI CGI has been the standard way of deploying web applications long before ASP came along. In the CGI gateway world, CGI.pm has been a widely used module in building CGI applications, and Apache::ASP is compatible with scripts written with CGI.pm. Also, as of version 2.19, Apache::ASP can run in standalone CGI mode for the Apache web server without mod_perl being available. See "Standalone CGI Mode" section below. Following are some special notes with respect to compatibility with CGI and CGI.pm. Use of CGI.pm in any of these ways was made possible through a great amount of work, and is not guaranteed to be portable with other perl ASP implementations, as other ASP implementations will likely be more limited. =over =item Standalone CGI Mode, without mod_perl As of version 2.19, Apache::ASP scripts may be run as standalone CGI scripts without mod_perl being loaded into Apache. Work to date has only been done with mod_cgi scripts under Apache on a Unix platform, and it is unlikely to work under other web servers or Win32 operating systems without further development. To run the ./site/eg scripts as CGI scripts, you copy the ./site directory to some location accessible by your web server, in this example its /usr/local/apache/htdocs/aspcgi, then in your httpd.conf activate Apache::ASP cgi scripts like so: Alias /aspcgi/ /usr/local/apache/htdocs/aspcgi/ AddType application/x-httpd-cgi .htm AddType application/x-httpd-cgi .html AddType application/x-httpd-cgi .asp AddType application/x-httpd-cgi .xml AddType application/x-httpd-cgi .ssi AllowOverride None Options +ExecCGI +Indexes Then install the asp-perl script from the distribution into /usr/bin, or some other directory. This is so the CGI execution line at the top of those scripts will invoke the asp-perl wrapper like so: #!/usr/bin/perl /usr/bin/asp-perl The asp-perl script is a cgi wrapper that sets up the Apache::ASP environment in lieu of the normal mod_perl handler request. Because there is no Apache->dir_config() data available under mod_cgi, the asp-perl script will load a asp.conf file that may define a hash %Config of data for populating the dir_config() data. An example of a complex asp.conf file is at ./site/eg/asp.conf So, a trivial asp.conf file might look like: # asp.conf %Config = ( 'Global' => '.', 'StateDir' => '/tmp/aspstate', 'NoState' => 0, 'Debug' => 3, ); The default for NoState is 1 in CGI mode, so one must set NoState to 0 for objects like $Session & $Application to be defined. =item CGI.pm CGI.pm is a very useful module that aids developers in the building of these applications, and Apache::ASP has been made to be compatible with function calls in CGI.pm. Please see cgi.htm in the ./site/eg directory for a sample ASP script written almost entirely in CGI. As of version 0.09, use of CGI.pm for both input and output is seamless when working under Apache::ASP. Thus if you would like to port existing cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around the script to get going. This functionality has been implemented so that developers may have the best of both worlds when building their web applications. For more information about CGI.pm, please see the web site http://search.cpan.org/dist/CGI/ =item Query Object Initialization You may create a CGI.pm $query object like so: use CGI; my $query = new CGI; As of Apache::ASP version 0.09, form input may be read in by CGI.pm upon initialization. Before, Apache::ASP would consume the form input when reading into $Request->Form(), but now form input is cached, and may be used by CGI.pm input routines. =item CGI headers Not only can you use the CGI.pm $query->header() method to put out headers, but with the CgiHeaders config option set to true, you can also print "Header: value\n", and add similar lines to the top of your script, like: Some-Header: Value Some-Other: OtherValue Script body starts here. Once there are no longer any cgi style headers, or the there is a newline, the body of the script begins. So if you just had an asp script like: print join(":", %{$Request->QueryString}); You would likely end up with no output, as that line is interpreted as a header because of the semicolon. When doing basic debugging, as long as you start the page with you will avoid this problem. =item print()ing CGI CGI is notorious for its print() statements, and the functions in CGI.pm usually return strings to print(). You can do this under Apache::ASP, since print just aliases to $Response->Write(). Note that $| has no affect. print $query->header(); print $query->start_form(); =item File Upload CGI.pm is used for implementing reading the input from file upload. You may create the file upload form however you wish, and then the data may be recovered from the file upload by using $Request->Form(). Data from a file upload gets written to a file handle, that may in turn be read from. The original file name that was uploaded is the name of the file handle. my $filehandle = $Request->Form('file_upload_field_name'); print $filehandle; # will get you the file name my $data; while(read($filehandle, $data, 1024)) { # data from the uploaded file read into $data }; Please see the docs on CGI.pm (try perldoc CGI) for more information on this topic, and ./site/eg/file_upload.asp for an example of its use. Also, for more details about CGI.pm itself, please see the web site: http://search.cpan.org/dist/CGI/ Occasionally, a newer version of CGI.pm will be released which breaks file upload compatibility with Apache::ASP. If you find this to occur, then you might consider downgrading to a version that works. For example, one can install a working CGI.pm v2.78 for a working version, and to get old versions of this module, one can go to BACKPAN at: http://backpan.cpan.org/modules/by-authors/id/L/LD/LDS/ There is also $Request->FileUpload() API extension that you can use to get more data about a file upload, so that the following properties are available for querying: my $file_upload = $Request->{FileUpload}{upload_field}; $file_upload->{BrowserFile} $file_upload->{FileHandle} $file_upload->{ContentType} # only if FileUploadTemp is set $file_upload->{TempFile} # whatever mime headers are sent with the file upload # just "keys %$file_upload" to find out $file_upload->{?Mime-Header?} Please see the $Request section in OBJECTS for more information. =back =head1 PERLSCRIPT Much work has been done to bring compatibility with ASP applications written in PerlScript under IIS. Most of that work revolved around bringing a Win32::OLE Collection interface to many of the objects in Apache::ASP, which are natively written as perl hashes. New as of version 2.05 is new functionality enabled with the CollectionItem setting, to giver better support to more recent PerlScript syntax. This seems helpful when porting from an IIS/PerlScript code base. Please see the CONFIG section for more info. The following objects in Apache::ASP respond as Collections: $Application $Session $Request->FileUpload * $Request->FileUpload('upload_file') * $Request->Form $Request->QueryString $Request->Cookies $Response->Cookies $Response->Cookies('some_cookie') * FileUpload API Extensions And as such may be used with the following syntax, as compared with the Apache::ASP native calls. Please note the native Apache::ASP interface is compatible with the deprecated PerlScript interface. C = PerlScript Compatibility N = Native Apache::ASP ## Collection->Contents($name) [C] $Application->Contents('XYZ') [N] $Application->{XYZ} ## Collection->SetProperty($property, $name, $value) [C] $Application->Contents->SetProperty('Item', 'XYZ', "Fred"); [N] $Application->{XYZ} = "Fred" ## Collection->GetProperty($property, $name) [C] $Application->Contents->GetProperty('Item', 'XYZ') [N] $Application->{XYZ} ## Collection->Item($name) [C] print $Request->QueryString->Item('message'), "
\n\n"; [N] print $Request->{QueryString}{'message'}, "
\n\n"; ## Working with Cookies [C] $Response->SetProperty('Cookies', 'Testing', 'Extra'); [C] $Response->SetProperty('Cookies', 'Testing', {'Path' => '/'}); [C] print $Request->Cookies(Testing) . "
\n"; [N] $Response->{Cookies}{Testing} = {Value => Extra, Path => '/'}; [N] print $Request->{Cookies}{Testing} . "
\n"; Several incompatibilities exist between PerlScript and Apache::ASP: > Collection->{Count} property has not been implemented. > VBScript dates may not be used for Expires property of cookies. > Win32::OLE::in may not be used. Use keys() to iterate over. > The ->{Item} property does not work, use the ->Item() method. =head1 STYLE GUIDE Here are some general style guidelines. Treat these as tips for best practices on Apache::ASP development if you will. =head2 UseStrict One of perl's blessings is also its bane, variables do not need to be declared, and are by default globally scoped. The problem with this in mod_perl is that global variables persist from one request to another even if a different web browser is viewing a page. To avoid this problem, perl programmers have often been advised to add to the top of their perl scripts: use strict; In Apache::ASP, you can do this better by setting: PerlSetVar UseStrict 1 which will cover both script & global.asa compilation and will catch "use strict" errors correctly. For perl modules, please continue to add "use strict" to the top of them. Because its so essential in catching hard to find errors, this configuration will likely become the default in some future release. For now, keep setting it. =head2 Do not define subroutines in scripts. DO NOT add subroutine declarations in scripts. Apache::ASP is optimized by compiling a script into a subroutine for faster future invocation. Adding a subroutine definition to a script then looks like this to the compiler: sub page_script_sub { ... ... some HTML ... ... sub your_sub { ... } ... } The biggest problem with subroutines defined in subroutines is the side effect of creating closures, which will not behave as usually desired in a mod_perl environment. To understand more about closures, please read up on them & "Nested Subroutines" at: http://perl.apache.org/docs/general/perl_reference/perl_reference.html Instead of defining subroutines in scripts, you may add them to your sites global.asa, or you may create a perl package or module to share with your scripts. For more on perl objects & modules, please see: http://perldoc.perl.org/perlobj.html =head2 Use global.asa's Script_On* Events Chances are that you will find yourself doing the same thing repeatedly in each of your web application's scripts. You can use Script_OnStart and Script_OnEnd to automate these routine tasks. These events are called before and after each script request. For example, let's say you have a header & footer you would like to include in the output of every page, then you might: # global.asa sub Script_OnStart { $Response->Include('header.inc'); } sub Script_OnEnd { $Response->Include('footer.inc'); } Or let's say you want to initialize a global database connection for use in your scripts: # global.asa use Apache::DBI; # automatic persistent database connections use DBI; use vars qw($dbh); # declare global $dbh sub Script_OnStart { # initialize $dbh $dbh = DBI->connect(...); # force you to explicitly commit when you want to save data $Server->RegisterCleanup(sub { $dbh->rollback; }); } sub Script_OnEnd { # not really necessary when using persistent connections, but # will free this one object reference at least $dbh = undef; } =head1 FAQ The following are some frequently asked questions about Apache::ASP. =head2 Installation =item Examples don't work, I see the ASP script in the browser? This is most likely that Apache is not configured to execute the Apache::ASP scripts properly. Check the INSTALL QuickStart section for more info on how to quickly set up Apache to execute your ASP scripts. =item Apache Expat vs. XML perl parsing causing segfaults, what do I do? Make sure to compile apache with expat disabled. The ./make_httpd/build_httpds.sh in the distribution will do this for you, with the --disable-rule=EXPAT in particular: cd ../$APACHE echo "Building apache ==============================" ./configure \ --prefix=/usr/local/apache \ --activate-module=src/modules/perl/libperl.a \ --enable-module=ssl \ --enable-module=proxy \ --enable-module=so \ --disable-rule=EXPAT ^^^^^ keywords: segmentation fault, segfault seg fault =item Why do variables retain their values between requests? Unless scoped by my() or local(), perl variables in mod_perl are treated as globals, and values set may persist from one request to another. This can be seen in as simple a script as this: $counter++; $Response->Write("
Counter: $counter"); The value for $counter++ will remain between requests. Generally use of globals in this way is a BAD IDEA, and you can spare yourself many headaches if do "use strict" perl programming which forces you to explicity declare globals like: use vars qw($counter); You can make all your Apache::ASP scripts strict by default by setting: PerlSetVar UseStrict 1 =item Apache errors on the PerlHandler or PerlModule directives ? You get an error message like this: Invalid command 'PerlModule', perhaps mis-spelled or defined by a module not included in the server configuration. You do not have mod_perl correctly installed for Apache. The PerlHandler and PerlModule directives in Apache *.conf files are extensions enabled by mod_perl and will not work if mod_perl is not correctly installed. Common user errors are not doing a 'make install' for mod_perl, which installs the perl side of mod_perl, and not starting the right httpd after building it. The latter often occurs when you have an old apache server without mod_perl, and you have built a new one without copying over to its proper location. To get mod_perl, go to http://perl.apache.org =item Error: no request object (Apache=SCALAR(0x???????):) Your Apache + mod_perl build is not working properly, and is likely a RedHat Linux RPM DSO build. Make sure you statically build your Apache + mod_perl httpd, recompiled fresh from the sources. =item I am getting a tie or MLDBM / state error message, what do I do? Make sure the web server or you have write access to the eg directory, or to the directory specified as Global in the config you are using. Default for Global is the directory the script is in (e.g. '.'), but should be set to some directory not under the www server document root, for security reasons, on a production site. Usually a chmod -R -0777 eg will take care of the write access issue for initial testing purposes. Failing write access being the problem, try upgrading your version of Data::Dumper and MLDBM, which are the modules used to write the state files. =head2 Sessions =item How can I use $Session to store complex data structures. Very carefully. Please read the $Session documentation in the OBJECTS section. You can store very complex objects in $Session, but you have to understand the limits, and the syntax that must be used to make this happen. In particular, stay away from statements that that have more than one level of indirection on the left side of an assignment like: BAD: $Session->{complex}{object} = $data; =item How can I keep search engine spiders from killing the session manager? If you want to disallow session creation for certain non web browser user agents, like search engine spiders, you can use a mod_perl PerlInitHandler like this to set configuration variables at runtime: # put the following code into httpd.conf and stop/start apache server PerlInitHandler My::InitHandler package My::InitHandler; use Apache; sub handler { my $r = shift; # get the Apache request object # if not a Mozilla User Agent, then disable sessions explicitly unless($r->headers_in('User-Agent') =~ /^Mozilla/) { $r->dir_config('AllowSessionState', 'Off'); } return 200; # return OK mod_perl status code } 1; This will configure your environment before Apache::ASP executes and sees the configuration settings. You can use the mod_perl API in this way to configure Apache::ASP at runtime. Note that the Session Manager is very robust on its own, and denial of service attacks of the types that spiders and other web bots normally execute are not likely to affect the Session Manager significantly. =item How can I use $Session to store a $dbh database handle ? You cannot use $Session to store a $dbh handle. This can be awkward for those coming from the IIS/NT world, where you could store just about anything in $Session, but this boils down to a difference between threads vs. processes. Database handles often have per process file handles open, which cannot be shared between requests, so though you have stored the $dbh data in $Session, all the other initializations are not relevant in another httpd process. All is not lost! Apache::DBI can be used to cache database connections on a per process basis, and will work for most cases. =head2 Development =item VBScript or JScript supported? Only Perl scripting is supported with this module. =item How is database connectivity handled? Database connectivity is handled through perl's DBI & DBD interfaces. In the UNIX world, it seems most databases have cross platform support in perl. You can find the book on DBI programming at http://www.oreilly.com/catalog/perldbi/ DBD::ODBC is often your ticket on Win32. On UNIX, commercial vendors like OpenLink Software (http://www.openlinksw.com/) provide the nuts and bolts for ODBC. Database connections can be cached per process with Apache::DBI. =item What is the best way to debug an ASP application ? There are lots of perl-ish tricks to make your life developing and debugging an ASP application easier. For starters, you will find some helpful hints by reading the $Response->Debug() API extension, and the Debug configuration directive. =item How are file uploads handled? Please see the CGI section. File uploads are implemented through CGI.pm which is loaded at runtime only for this purpose. This is the only time that CGI.pm will be loaded by Apache::ASP, which implements all other cgi-ish functionality natively. The rationale for not implementing file uploads natively is that the extra 100K in memory for CGI.pm shouldn't be a big deal if you are working with bulky file uploads. =item How do I access the ASP Objects in general? All the ASP objects can be referenced through the main package with the following notation: $main::Response->Write("html output"); This notation can be used from anywhere in perl, including routines registered with $Server->RegisterCleanup(). You use the normal notation in your scripts, includes, and global.asa: $Response->Write("html output"); =item Can I print() in ASP? Yes. You can print() from anywhere in an ASP script as it aliases to the $Response->Write() method. Using print() is portable with PerlScript when using Win32::ASP in that environment. =item Do I have access to ActiveX objects? Only under Win32 will developers have access to ActiveX objects through the perl Win32::OLE interface. This will remain true until there are free COM ports to the UNIX world. At this time, there is no ActiveX for the UNIX world. =head2 Support and Production =item How do I get things I want done?! If you find a problem with the module, or would like a feature added, please mail support, as listed in the SUPPORT section, and your needs will be promptly and seriously considered, then implemented. =item What is the state of Apache::ASP? Can I publish a web site on it? Apache::ASP has been production ready since v.02. Work being done on the module is on a per need basis, with the goal being to eventually have the ASP API completed, with full portability to ActiveState PerlScript and MKS PScript. If you can suggest any changes to facilitate these goals, your comments are welcome. =head1 TUNING A little tuning can go a long way, and can make the difference between a web site that gets by, and a site that screams with speed. With Apache::ASP, you can easily take a poorly tuned site running at 10 hits/second to 50+ hits/second just with the right configuration. Documented below are some simple things you can do to make the most of your site. =head2 Online Resources For more tips & tricks on tuning Apache and mod_perl, please see the tuning documents at: Stas Bekman's mod_perl guide http://perl.apache.org/guide/ Written in late 1999 this article provides an early look at how to tune your Apache::ASP web site. It has since been updated to remain current with Apache::ASP v2.29+ Apache::ASP Site Tuning http://www.apache-asp.org/articles/perlmonth3_tune.html =head2 Tuning & Benchmarking When performance tuning, it is important to have a tool to measure the impact of your tuning change by change. The program ab, or Apache Bench, provides this functionality well, and is freely included in the apache distribution. Because performance tuning can be a neverending affair, it is a good idea to establish a threshold where performance is "good enough", that once reached, tuning stops. =head2 $Application & $Session State Use NoState 1 setting if you don't need the $Application or $Session objects. State objects such as these tie to files on disk and will incur a performance penalty. If you need the state objects $Application and $Session, and if running an OS that caches files in memory, set your "StateDir" directory to a cached file system. On WinNT, all files may be cached, and you have no control of this. On Solaris, /tmp is a RAM disk and would be a good place to set the "StateDir" config setting to. When cached file systems are used there is little performance penalty for using state files. Linux tends to do a good job caching its file systems, so pick a StateDir for ease of system administration. On Win32 systems, where mod_perl requests are serialized, you can freely use SessionSerialize to make your $Session requests faster, and you can achieve similar performance benefits for $Application if you call $Application->Lock() in your global.asa's Script_OnStart. =head2 Low MaxClients Set your MaxClients low, such that if you have that many httpd servers running, which will happen on busy site, your system will not start swapping to disk because of excessive RAM usage. Typical settings are less than 100 even with 1 gig RAM! To handle more client connections, look into a dual server, mod_proxy front end. =head2 High MaxRequestsPerChild Set your max requests per child thread or process (in httpd.conf) high, so that ASP scripts have a better chance being cached, which happens after they are first compiled. You will also avoid the process fork penalty on UNIX systems. Somewhere between 50 - 500 is probably pretty good. You do not want to set this too high though or you will risk having your web processes use too much RAM. One may use Apache::SizeLimit or Apache::GTopLimit to optimally tune MaxRequestsPerChild at runtime. =head2 Precompile Modules For those modules that your Apache::ASP application uses, make sure that they are loaded in your sites startup.pl file, or loaded with PerlModule in your httpd.conf, so that your modules are compiled pre-fork in the parent httpd. =head2 Precompile Scripts Precompile your scripts by using the Apache::ASP->Loader() routine documented below. This will at least save the first user hitting a script from suffering compile time lag. On UNIX, precompiling scripts upon server startup allows this code to be shared with forked child www servers, so you reduce overall memory usage, and use less CPU compiling scripts for each separate www server process. These savings could be significant. On a PII300 Solaris x86, it takes a couple seconds to compile 28 scripts upon server startup, with an average of 50K RAM per compiled script, and this savings is passed on to the ALL child httpd servers, so total savings would be 50Kx28x20(MaxClients)=28M! Apache::ASP->Loader() can be called to precompile scripts and even entire ASP applications at server startup. Note also that in modperl, you can precompile modules with the PerlModule config directive, which is highly recommended. Apache::ASP->Loader($path, $pattern, %config) This routine takes a file or directory as its first argument. If a file, that file will be compiled. If a directory, that directory will be recursed, and all files in it whose file name matches $pattern will be compiled. $pattern defaults to .*, which says that all scripts in a directory will be compiled by default. The %config args, are the config options that you may want set that affect compilation. These options include: Debug, Global, GlobalPackage, DynamicIncludes, IncludesDir, InodeNames, PodComments, StatINC, StatINCMatch, UseStrict, XMLSubsPerlArgs, XMLSubsMatch, and XMLSubsStrict. If your scripts are later run with different config options, your scripts may have to be recompiled. Here is an example of use in a *.conf file: Apache::ASP->Loader( '/usr/local/proj/site', "(asp|htm)\$", 'Global' => '/proj/perllib', 'Debug' => -3, # see system output when starting apache # OPTIONAL configs if you use them in your apache configuration # these settings affect how the scripts are compiled and loaded 'GlobalPackage' => 'SomePackageName', 'DynamicIncludes' => 1, 'StatINC' => 1, 'StatINCMatch' => 'My', 'UseStrict' => 1, 'XMLSubsMatch' => 'my:\w+', 'XMLSubsStrict' => 0 || 1, ); This config section tells the server to compile all scripts in c:/proj/site that end in asp or htm, and print debugging output so you can see it work. It also sets the Global directory to be /proj/perllib, which needs to be the same as your real config since scripts are cached uniquely by their Global directory. You will probably want to use this on a production server, unless you cannot afford the extra startup time. To see precompiling in action, set Debug to 1 for the Loader() and for your application in general and watch your error_log for messages indicating scripts being cached. =head2 No .htaccess or StatINC Don't use .htaccess files or the StatINC setting in a production system as there are many more files touched per request using these features. I've seen performance slow down by half because of using these. For eliminating the .htaccess file, move settings into *.conf Apache files. Instead of StatINC, try using the StatINCMatch config, which will check a small subset of perl libraries for changes. This config is fine for a production environment, and if used well might only incur a 10-20% performance penalty, depending on the number of modules your system loads in all, as each module needs to be checked for changes on a per request basis. =head2 Turn off Debugging Turn off system debugging by setting Debug to 0-3. Having the system debug config option on slows things down immensely, but can be useful when troubleshooting your application. System level debugging is settings -3 through -1, where user level debugging is 1 to 3. User level debugging is much more light weight depending on how many $Reponse->Debug() statements you use in your program, and you may want to leave it on. =head2 Memory Sparing, NoCache If you have a lot (1000's+) of scripts, and limited memory, set NoCache to 1, so that compiled scripts are not cached in memory. You lose about 10-15% in speed for small scripts, but save at least 10K RAM per cached script. These numbers are very rough and will largely depend on the size of your scripts and includes. =head2 Resource Limits Make sure your web processes do not use too many resources like CPU or RAM with the handy Apache::Resource module. Such a config might look like: PerlModule Apache::Resource PerlSetEnv PERL_RLIMIT_CPU 1000 PerlSetEnv PERL_RLIMIT_DATA 60:60 If ever a web process should begin to take more than 60M ram or use more than 1000 CPU seconds, it will be killed by the OS this way. You only want to use this configuration to protect against runaway processes and web program errors, not for terminating a normally functioning system, so set these limits HIGH! =head1 SEE ALSO perl(1), mod_perl(3), Apache(3), MLDBM(3), HTTP::Date(3), CGI(3), Win32::OLE(3) =head1 NOTES Many thanks to those who helped me make this module a reality. With Apache + ASP + Perl, web development could not be better! Special thanks go to my father Kevin & wife Lina for their love and support through it all, and without whom none of it would have been possible. Other honorable mentions include: !! Gregory Youngblood, Thanos Chatziathanassiou, & Tsirkin Evgeny for keeping the flame alive! :) Doug MacEachern, for moral support and of course mod_perl :) Helmut Zeilinger, Skylos, John Drago, and Warren Young for their help in the community :) Randy Kobes, for the win32 binaries, and for always being the epitome of helpfulness :) Francesco Pasqualini, for bug fixes with stand alone CGI mode on Win32 :) Szymon Juraszczyk, for better ContentType handling for settings like Clean. :) Oleg Kobyakovskiy, for identifying the double Session_OnEnd cleanup bug. :) Peter Galbavy, for reporting numerous bugs and maintaining the OpenBSD port. :) Richard Curtis, for reporting and working through interesting module loading issues under mod_perl2 & apache2, and pushing on the file upload API. :) Rune Henssel, for catching a major bug shortly after 2.47 release, and going to great lengths to get me reproducing the bug quickly. :) Broc, for keeping things filter aware, which broke in 2.45, & much help on the list. :) Manabu Higashida, for fixes to work under perl 5.8.0 :) Slaven Rezic, for suggestions on smoother CPAN installation :) Mitsunobu Ozato, for working on a japanese translation of the site & docs. :) Eamon Daly for persistence in resolving a MailErrors bug. :) Gert, for help on the mailing list, and pushing the limits of use on Win32 in addition to XSLT. :) Maurice Aubrey, for one of the early fixes to the long file name problem. :) Tom Lancaster, for pushing the $Server->Mail API and general API discussion. :) Ross Thomas, for pushing into areas so far unexplored. :) Harald Kreuzer, for bug discovery & subsequent testing in the 2.25 era. :) Michael Buschauer for his extreme work with XSLT. :) Dariusz Pietrzak for a nice parser optimization. :) Ime Smits, for his inode patch facilitating cross site code reuse, and some nice performance enhancements adding another 1-2% speed. :) Michael Davis, for easier CPAN installation. :) Brian Wheeler, for keeping up with the Apache::Filter times, and pulling off filtering ASP->AxKit. :) Ged Haywood, for his great help on the list & professionally. :) Vee McMillen, for OSS patience & understanding. :) Craig Samuel, at LRN, for his faith in open source for his LCEC. :) Geert Josten, for his wonderful work on XML::XSLT :) Gerald Richter, for his Embperl, collaboration and competition! :) Stas Bekman, for his beloved guide, and keeping us all worldly. :) Matt Sergeant, again, for ever the excellent XML critique. :) Remi Fasol + Serge Sozonoff who inspired cookieless sessions. :) Matt Arnold, for the excellent graphics ! :) Adi, who thought to have full admin control over sessions :) Dmitry Beransky, for sharable web application includes, ASP on the big. :) Russell Weiss again, for finding the internal session garbage collection behaving badly with DB_File sensitive i/o flushing requirements. :) Tony Merc Mobily, inspiring tweaks to compile scripts 10 times faster :) Paul Linder, who is Mr. Clean... not just the code, its faster too ! Boy was that just the beginning. Work with him later facilitated better session management and XMLSubsMatch custom tag technology. :) Russell Weiss, for being every so "strict" about his code. :) Bill McKinnon, who understands the finer points of running a web site. :) Richard Rossi, for his need for speed & boldly testing dynamic includes. :) Greg Stark, for endless enthusiasm, pushing the module to its limits. :) Marc Spencer, who brainstormed dynamic includes. :) Doug Silver, for finding most of the bugs. :) Darren Gibbons, the biggest cookie-monster I have ever known. :) Ken Williams, for great teamwork bringing full SSI to the table :) Matt Sergeant, for his great tutorial on PerlScript and love of ASP :) Jeff Groves, who put a STOP to user stop button woes :) Alan Sparks, for knowing when size is more important than speed :) Lincoln Stein, for his blessed CGI.pm module :) Michael Rothwell, for his love of Session hacking :) Francesco Pasqualini, for bringing ASP to CGI :) Bryan Murphy, for being a PerlScript wiz :) Lupe Christoph, for his immaculate and stubborn testing skills :) Ryan Whelan, for boldly testing on Unix in the early infancy of ASP =head1 SUPPORT =head2 COMMUNITY =item Mailing List Archives Try the Apache::ASP mailing list archive first when working through an issue as others may have had the same question as you, then try the mod_perl list archives since often problems working with Apache::ASP are really mod_perl ones. The Apache::ASP mailing list archives are located at: http://groups.yahoo.com/group/apache-asp/ http://www.mail-archive.com/asp%40perl.apache.org/ The mod_perl mailing list archives are located at: http://mail-archives.apache.org/mod_mbox/perl-modperl/ =item Mailing List Please subscribe to the Apache::ASP mailing list by sending an email to asp-subscribe[at]perl.apache.org and send your questions or comments to the list after your subscription is confirmed. To unsubscribe from the Apache::ASP mailing list, just send an email to asp-unsubscribe[at]perl.apache.org If you think this is a mod_perl specific issue, you can send your question to modperl[at]apache.org =item Donations Apache::ASP is freely distributed under the terms of the Perl artistic license ( see the LICENSE section ). If you would like to donate time to the project, please get involved on the Apache::ASP Mailing List, and submit ideas, bug fixes and patches for the core system, and perhaps most importantly to simply support others in learning the ins and outs of the software. =head2 COMMERCIAL If you would like commercial support for Apache::ASP, please check out any of the following listed companies. Note that this is not an endorsement, and if you would like your company listed here, please email asp[at]perl.apache.org with your information. =item AlterCom We use, host and support mod_perl. We would love to be able to help anyone with their mod_perl Apache::ASP needs. Our mod_perl hosting is $24.95 mo. http://altercom.com/home.html =item The Cyberchute Connection Our hosting services support Apache:ASP along with Mod_Perl, PHP and MySQL. http://www.Cyberchute.com =item OmniTI OmniTI supports Apache and mod_perl (including Apache::ASP) and offers competitive pricing for both hourly and project-based jobs. OmniTI has extensive experience managing and maintaining both large and small projects. Our services range from short-term consulting to project-based development, and include ongoing maintenance and hosting. http://www.omniti.com =item TUX IT AG Main business is implementing and maintaining infrastructure for big websites and portals, as well as developing web applications for our customers (Apache, Apache::ASP, PHP, Perl, MySQL, etc.) The prices for our service are about 900 EUR per day which is negotiable (for longer projects, etc.). http://www.tuxit.de =head1 SITES USING What follows is a list of public sites that are using Apache::ASP. If you use the software for your site, and would like to show your support of the software by being listed, please send your link to asp[at]perl.apache.org For a list of testimonials of those using Apache::ASP, please see the TESTIMONIALS section. PERSONiO Match http://www.personio.com/home.asp gutscheinwurst.de - a German voucher community http://www.gutscheinwurst.de SalesJobs.com http://www.salesjobs.com hanschur.de http://www.hanschur.de Webtist http://www.webtist.de FreeLotto http://www.freelotto.com Hungarian TOP1000 http://www.hungariantop1000.com Hungarian Registry http://www.hunreg.com Kepeslap.com http://www.kepeslap.com yourpostcardsite.com http://www.yourpostcardsite.com WebTime http://webtime-project.net AlterCom, Advanced Web Hosting http://altercom.com/ AmericanGamers.com http://www.AmericanGamers.com/ ESSTECwebservices http://www.esstec.be/ Alumni.NET http://www.alumni.net Anime Wallpapers dot com http://www.animewallpapers.com/ Cine.gr http://www.cine.gr Condo-Mart Web Service http://www.condo-mart.com Discountclick.com http://www.discountclick.com/ HCST http://www.hcst.net International Telecommunication Union http://www.itu.int Integra http://www.integra.ru/ Money FM http://www.moneyfm.gr Motorsport.com http://www.motorsport.com MLS of Greater Cincinnati http://www.cincymls.com NodeWorks Link Checker http://www.nodeworks.com OnTheWeb Services http://www.ontheweb.nu Prices for Antiques http://www.p4a.com redhat.com | support http://www.redhat.com/apps/support/ Spotlight http://www.spotlight.com.au USCD Electrical & Computer Engineering http://ece-local.ucsd.edu =head1 TESTIMONIALS Here are testimonials from those using Apache::ASP. If you use this software and would like to show your support please send your testimonial to Apache::ASP mailing list at asp[at]perl.apache.org and indicate that we can post it to the web site. For a list of sites using Apache::ASP, please see the SITES USING section. =item Red Hat =begin html =end html We're using Apache::ASP on www.redhat.com. We find Apache::ASP very easy to use, and it's quick for new developers to get up to speed with it, given that many people have already been exposed to the ASP object model that Apache::ASP is based on. The documentation is comprehensive and easy to understand, and the community and maintainer have been very helpful whenever we've had questions. -- Tom Lancaster, Red Hat =item Anime Wallpaper at Anime Cubed Your suite has got our old CGI implementation beat, hands down. Our site is divided into two main areas, each run by a separate developer, and the Apache::ASP section runs head and shoulders above the other side. Anyone who is still using anything but your product to implement their webpages seriously needs to take a look at how versatile and powerful Apache::ASP is. Thanks again for such great work! -- Al from 'Anime Wallpaper at Anime Cubed', http://www.animecubed.com/wallpapers/ =item gutscheinwurst.de I am the web master of http://www.gutscheinwurst.de , a German voucher community. We use Apache::Asp to run our backend & administration servers for the system. We started using Apache::ASP to see whether it is a valid alternative to IIS legacy systems. So far all expectations in regard of performance, ease of development and integration have been fulfilled or exceeded. Thank's for such a great product :) -- Johnannes Leimbach =item D. L. Fox I had programmed in Perl for some time ... but, since I also knew VB, I had switched to VB in IIS-ASP for web stuff because of its ease of use in embedding code with HTML ... When I discovered Apache-ASP, it was like a dream come true. I would much rather code in Perl than any other language. Thanks for such a fine product! =item HOSTING 321, LLC. After discontinuing Windows-based hosting due to the high cost of software, our clients are thrilled with Apache::ASP and they swear ASP it's faster than before. Installation was a snap on our 25-server web farm with a small shell script and everything is running perfectly! The documentation is very comprehensive and everyone has been very helpful during this migration. Thank you! -- Richard Ward, HOSTING 321, LLC. =item Concept Online Ltd. =begin html =end html I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not "forced" to use JSP, we chose ASP. It is fast, reliable, versatile, documented in a way that is the best for professionals - so thank you for writting and maintaining it! -- Csongor Fagyal, Concept Online Ltd. =item WebTime =begin html =end html As we have seen with WebTime, Apache::ASP is not only good for the development of website, but also for the development of webtools. Since I first discoverd it, I made it a must-have in my society by taking traditional PHP users to the world of perl afficionados. Having the possibility to use Apache::ASP with mod_perl or mod_cgi make it constraintless to use because of CGI's universality and perl's portability. -- Grégoire Lejeune =item David Kulp First, I just want to say that I am very very impressed with Apache::ASP. I just want to gush with praise after looking at many other implementations of perl embedded code and being very underwhelmed. This is so damn slick and clean. Kudos! ... ... I'm very pleased how quickly I've been able to mock up the application. I've been writing Perl CGI off and on since 1993(!) and I can tell you that Apache::ASP is a pleasure. (Last year I tried Zope and just about threw my computer out the window.) -- David Kulp =item MFM Commmunication Software, Inc. =begin html

HUFF Realty
Star One Realtors
Comey & Shepherd Realtors
RE/MAX Unlimited Realtors
Cincinnati Builders
Blue Ash Airport Days Airshow

=end html Working in a team environment where you have HTML coders and perl coders, Apache::ASP makes it easy for the HTML folks to change the look of the page without knowing perl. Using Apache::ASP (instead of another embedded perl solution) allows the HTML jockeys to use a variety of HTML tools that understand ASP, which reduces the amount of code they break when editing the HTML. Using Apache::ASP instead of M$ ASP allows us to use perl (far superior to VBScript) and Apache (far superior to IIS). We've been very pleased with Apache::ASP and its support. =item Planet of Music Apache::ASP has been a great tool. Just a little background.... the whole site had been in cgi flat files when I started here. I was looking for a technology that would allow me to write the objects and NEVER invoke CGI.pm... I found it and hopefuly I will be able to implement this every site I go to. When I got here there was a huge argument about needing a game engine and I belive this has been the key... Games are approx. 10 time faster than before. The games don't break anylonger. All in all a great tool for advancement. -- JC Fant IV =item Cine.gr =begin html =end html ...we ported our biggest yet ASP site from IIS (well, actually rewrote), Cine.gr and it is a killer site. In some cases, the whole thing got almost 25 (no typo) times faster... None of this would ever be possible without Apache::ASP (I do not ever want to write ``print "\n";'' again). =head1 RESOURCES Here are some important resources listed related to the use of Apache::ASP for publishing web applications. If you have any more to suggest, please email the Apache::ASP list at asp[at]perl.apache.org =head2 Articles Apache::ASP Introduction ( #1 in 3 part series ) http://www.apache-asp.org/articles/perlmonth1_intro.html Apache::ASP Site Building ( #2 in 3 part series ) http://www.apache-asp.org/articles/perlmonth2_build.html Apache::ASP Site Tuning ( #3 in 3 part series ) http://www.apache-asp.org/articles/perlmonth3_tune.html Embedded Perl ( part of a series on Perl ) http://www.wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/index15.html =head2 Books mod_perl "Eagle" Book http://www.modperl.com mod_perl Developer's Cookbook http://www.modperlcookbook.org Programming the Perl DBI http://www.oreilly.com/catalog/perldbi/ =head2 Reference Cards Apache & mod_perl Reference Cards http://www.refcards.com/ =head2 Web Sites mod_perl Apache web module http://perl.apache.org mod_perl 1.x Guide http://perl.apache.org/guide/ Perl Programming Language http://www.perl.com Apache Web Server http://www.apache.org =head1 TODO There is no specific time frame in which these things will be implemented. Please let me know if any of these is of particular interest to you, and I will give it higher priority. =head2 WILL BE DONE + Database storage of $Session & $Application, so web clusters may scale better than the current NFS/CIFS StateDir implementation allows, maybe via Apache::Session. =head1 CHANGES Apache::ASP has been in development since 1998, and was production ready since its .02 release. Releases are always used in a production setting before being made publically available. In July 2000, the version numbers of releases went from .19 to 1.9 which is more relevant to software development outside the perl community. Where a .10 perl module usually means first production ready release, this would be the equivalent of a 1.0 release for other kinds of software. + = improvement - = bug fix (d) = documentations =item $VERSION = 2.63; $DATE="03/14/2018" + Added section ``raw'' to MailErrors.inc to debug POSTs without form fields - MailErrorsHTML now uses monospaced fonts for errors. Easier on the eyes and more informative =item $VERSION = 2.62; $DATE="08/16/2011" - Fixed 'application/x-www-form-urlencoded' for AJAX POSTs post Firefox 3.x + First sourceforge.net hosted version + Incremented version number to actually match SVN branch tag =item $VERSION = 2.61; $DATE="05/24/2008" - updated for more recent mod_perl 2 environment to trigger correct loading of modules + loads modules in a backwards compatible way for older versions of mod_perl 1.99_07 to 1.99_09 + license changes from GPL to Perl Artistic License =item $VERSION = 2.59; $DATE="05/23/2005" + added "use bytes" to Response object to calculate Content-Length correctly for UTF8 data, which should require therefore at least perl version 5.6 installed + updated to work with latest mod_perl 2.0 module naming convention, thanks to Randy Kobes for patch + examples now exclude usage of Apache::Filter & Apache::SSI under mod_perl 2.0 =item $VERSION = 2.57; $DATE="01/29/2004" - $Server->Transfer will update $0 correctly - return 0 for mod_perl handler to work with latest mod_perl 2 release when we were returning 200 ( HTTP_OK ) before - fixed bug in $Server->URL when called like $Server->URL($url) without parameters. Its not clear which perl versions this bug affected. =item $VERSION = 2.55; $DATE="08/09/2003" - Bug fixes for running on standalone CGI mode on Win32 submitted by Francesco Pasqualini + Added Apache::ASP::Request::BINMODE for binmode() being called on STDIN after STDIN is tied to $Request object + New RequestBinaryRead configuration created, may be turned off to prevent $Request object from reading POST data ++ mod_perl 2 optmizations, there was a large code impact on this, as much code was restructured to reduce the differences between mod_perl 1 and mod_perl 2, most importantly, Apache::compat is no longer used + preloaded CGI for file uploads in the mod_perl environment - When XSLT config is set, $Response->Redirect() should work now Thanks to Marcus Zoller for pointing problem out + Added CookieDomain setting, documented, and added test to cover it in t/cookies.t . Setting suggested by Uwe Riehm, who nicely submitted some code for this. =item $VERSION = 2.53; $DATE="04/10/2003" + XMLSubs tags with "-" in them will have "-" replaced with "_" or underscore, so a tag like will be translated to &my::render_table() ... tags with - in them are common in extended XML syntaxes, but perl subs cannot have - in them only. + Clean setting now works on output when $Response->{ContentType} begins with text/html; like "text/html; charset=iso-8859-2" ... before Clean would only work on output marked with ContentType text/html. Thanks to Szymon Juraszczyk for recommending fix. --Fixed a bug which would cause Session_OnEnd to be called twice on sessions in a certain case, particularly when an old expired session gets reused by and web browser... this bug was a result of a incomplete session cleanup method in this case. Thanks to Oleg Kobyakovskiy for reporting this bug. Added test in t/session_events.t to cover this problem going forward. - Compile errors from Apache::ASP->Loader() were not being reported. They will be reported again now. Thanks to Thanos Chatziathanassiou for discovering and documenting this bug. Added test in t/load.t to cover this problem going forward. + use of chr(hex($1)) to decode URI encoded parameters instead of pack("c",hex($1)) faster & more correct, thanks to Nikolay Melekhin for pointing out this need. (d) Added old perlmonth.com articles to ./site/articles in distribution and linked to them from the docs RESOURCES section (d) Updated documention for the $Application->SessionCount API + Scripts with named subroutines, which is warned against in the style guide, will not be cached to help prevent my closure problems that often hurt new developers working in mod_perl environments. The downside is that these script will have a performance penalty having to be recompiled each invocation, but this will kill many closure caching bugs that are hard to detect. - $Request->FileUpload('upload_file', 'BrowserFile') would return a glob before that would be the file name in scalar form. However this would be interpreted as a reference incorrectly. The fix is to make sure this is always a scalar by stringifying this data internally. Thanks to Richard Curtis for pointing out this bug. =item $VERSION = 2.51; $DATE="02/10/2003" + added t/session_query_parse.t test to cover use of SessionQueryParse and $Server->URL APIs - Fixed duplicate "&" bug associated with using $Server->URL and SessionQueryParse together + Patch to allow $Server->URL() to be called multiple times on the same URL as in $Server->URL($Server->URL($url, \%params), \%more_params) (d) Added new testimonials & sites & created a separate testimonials page. - SessionQueryParse will now add to & to the query strings embedded in the HTML, instead of & for proper HTML generation. Thanks to Peter Galbavy for pointing out and Thanos Chatziathanassiou for suggesting the fix. - $Response->{ContentType} set to text/html for developer error reporting, in case this was set to something else before the error occured. Thanks to Philip Mak for reporting. - Couple of minor bug fixes under PerlWarn use, thanks Peter Galbavy for reporting. + Added automatic load of "use Apache2" for compat with mod_perl2 request objects when Apache::ASP is loaded via "PerlModule Apache::ASP" Thanks to Richard Curtis for reporting bug & subsequent testing. - When GlobalPackage config changes, but global.asa has not, global.asa will be recompiled anyway to update the GlobalPackage correctly. Changing GlobalPackage before would cause errors if global.asa was already compiled. ++ For ANY PerlSetVar type config, OFF/Off/off will be assumed to have value of 0 for that setting. Before, only a couple settings had this semantics, but they all do now for consistency. - Fix for InodeNames config on OpenBSD, or any OS that might have a device # of 0 for the file being stat()'d, thanks to Peter Galbavy for bug report. ++ Total XSLT speedups, 5-10% on large XSLT, 10-15% on small XSLT + bypass meta data check like expires for XSLT Cache() API use because XSLT tranformations don't expire, saves hit to cache dbm for meta data + use of direct Apache::ASP::State methods like FETCH/STORE in Cache() layer so we don't have to go through slower tied interface. This will speed up XSLT & and include output caching mostly. + minor optimizations for speed & memory usage =item $VERSION = 2.49; $DATE="11/10/2002" -- bug introduced in 2.47 cached script compilations for executing scripts ( not includes ) of the same name in different directories for the same Global/GlobalPackage config for an application. Fix was to remove optimization that caused problem, and created test case t/same_name.t to cover bug. =item $VERSION = 2.47; $DATE="11/06/2002" ++ Runtime speed enhancements for 15-20% improvement including: + INTERNAL API ReadFile() now returns scalar ref as memory optimization + cache InodeNames config setting in ASP object now for common lookups + removed CompileChecksum() INTERNAL API, since it was an unnecesary method decomposition along a common code path + removed IsChanged() INTERNAL API since compiling of scripts is now handled by CompileInclude() which does this functionality already + removed unnecessary decomp of IncludesChanged() INTERNAL API, which was along critical code path + do not call INTERNAL SearchDirs() API when compiling base script since we have already validated its path earlier + Use stat(_) type shortcut for stat() & -X calls where possible + Moved @INC initilization up to handler() & consolidated with $INCDir lib + removed useless Apache::ASP::Collection::DESTROY + removed useless Apache::ASP::Server::DESTROY + removed useless Apache::ASP::GlobalASA::DESTROY + removed useless Apache::ASP::Response::DESTROY - Default path for $Response->{Cookies} was from CookiePath config, but this was incorrect as CookiePath config is only for $Session cookie, so now path for $Response->{Cookies} defaults to / - Fixed bug where global.asa events would get undefined with StatINC and GlobalPackage set when the GlobalPackage library changed & get reloaded. (d) Documented long time config NoCache. -- Fixed use with Apache::Filter, capable as both source and destination filter. Added ./site/eg/filter.filter example to demonstrate these abilities. + Use $r->err_headers_out->add Apache::Table API for cookies now instead of $r->cgi_header_out. Added t/cookies.t test to cover new code path as well as general $Response->Cookies API. Also make cookies headers sorted by cookie and dictionary key while building headers for repeatable behavior, this latter was to facilitate testing. - fixed $Server->Mail error_log output when failing to connect to SMTP server. + added tests to cover UniquePackages & NoCache configs since this config logic was updated + made deprecated warnings for use of certain $Response->Member calls more loudly write to error_log, so I can remove the AUTOLOAD for Response one day - Probably fixed behavior in CgiHeaders, at least under perl 5.8.0, and added t/cgi_headers.t to cover this config. + removed $Apache::ASP::CompressGzip setting ability, used to possibly set CompressGzip in the module before, not documented anyway + removed $Apache::ASP::Filter setting ability to set Filter globally, not documented anyway + removed old work around for setting ServerStarting to 0 at runtime, which was bad for Apache::DBI on win32 a long time ago: $Apache::ServerStarting and $Apache::ServerStarting = 0; If this code is still needed in Apache::ASP->handler() let me know. + check to make sure data in internal database is a HASH ref before using it for session garbage collection. This is to help prevent against internal database corruption in a network share that does not support flock() file locking. + For new XMLSubs ASP type <%= %> argument interpolation activated with XMLSubsPerlArgs 0, data references can now be passed in addition to SCALAR/string references, so one can pass an object reference like so: This will only work as long as the variable interpolation <%= %> are flushed against the containing " " or ' ', or else the object reference will be stringified when it is concatenated with the rest of the data. Testing for this feature was added to ./t/xmlsubs_aspargs.t This feature is still experimental, and its interface may change. However it is slated for the 3.0 release as default method, so feedback is appreciated. + For new XMLSubs ASP type <%= %> argument interpolation activated with XMLSubsPerlArgs 0, <% %> will no longer work, just <%= %>, as in This feature is still experimental, and its interface may change. However it is slated for the 3.0 release as default method, so feedback is appreciated. =item $VERSION = 2.45; $DATE="10/13/2002" ++New XMLSubsPerlArgs config, default 1, indicates how XMLSubs arguments have always been parsed. If set to 0, will enable new XMLSubs args that are more ASP like with <%= %> for dynamic interpolation, such as: Settings XMLSubsPerlArgs to 0 is experimental for now, but will become the default by Apache::ASP version 3.0 ++Optimization for static HTML/XML files that are served up via Apache::ASP so that they are not compiled into perl subroutines first. This makes especially native XSLT both faster & take less memory to serve, before XSL & XML files being transformed by XSLT would both be compiled as normal ASP script first, so now this will happen if they really are ASP scripts with embedded <% %> code blocks & XMLSubs being executed. +Consolidate some config data for Apache::ASP->Loader to use globals in @Apache::ASP::CompileChecksumKeys to know which config data is important for precompiling ASP scripts. +Further streamlined code compilation. Now both base scripts and includes use the internal CompileInclude() API to generate code. -Fixed runtime HTML error output when Debug is set to -2/2, so that script correctly again gets rendered in final perl form. Added compile time error output to ./site/eg/syntax_error.asp when a special link is clicked for a quick visual test. -Cleaned up some bad coding practices in ./site/eg/global.asa associated changes in other example files. Comment example global.asa some for the first time reader -DemoASP.pm examples module needed "use strict" fix, thanks to Allan Vest for bug report --$rv = $Response->Include({ File => ..., Cache => 1}); now works to get the first returned value fetched from the cache. Before, because a list was always returned, $rv would have been equal to the number of items returned, even if the return value list has just one element. (d) added site/robots.txt file with just a comment for search engine indexing -fixed ./site/eg/binary_write.htm to not use $Response->{ContentLength} because it does not exist. Fixed it to use $Response->AddHeader now instead =item $VERSION = 2.41; $DATE="09/29/2002" -Removed CVS Revision tag from Apache::ASP::Date, which was causing bad revision numbers in CPAN after CVS integration of Apache::ASP +removed cgi/asp link to ../asp-perl from distribution. This link was for the deprecated asp script which is now asp-perl =item $VERSION = 2.39; $DATE="09/10/2002" -Turn off $^W explicitly before reloading global.asa. Reloading global.asa when $^W is set will trigger subroutine redefinition warnings. Reloading global.asa should occur without any problems under normal usage of the system, thus this work around. This fix is important to UseStrict functionality because warnings automatically become thrown as die() errors with UseStrict enabled, so we have to disable normal soft warnings here. -$Response->Include() runtime errors now throw a die() that can be trapped. This was old functionality that has been restored. Other compile time errors should still trigger a hard error like script compilation, global.asa, or $Response->Include() without an eval() +Some better error handling with Debug 3 or -3 set, cleaned up developer errors messages somewhat. =item $VERSION = 2.37; $DATE="07/03/2002" -Fixed the testing directory structures for t/long_names.t so that tar software like Archive::Tar & Solaris tar that have problems with long file names will still be able to untar distribution successfully. Now t/long_names.t generates its testing directory structures at runtime. -Fixes for "make test" to work under perl 5.8.0 RC2, courtesy of Manabu Higashida +SessionQueryForce setting created for disabling use of cookies for $Session session-id passing, rather requiring use of SessionQuery* functionality for session-id passing via URL query string. By default, even when SessionQuery* options are used, cookies will be used if available with SessionQuery* functionality acting only as a backup, so this makes it so that cookies will never be used. +Escape ' with HTMLEncode() to ' -Trying to fix t/server_mail.t to work better for platforms that it should skip testing on. Updated t/server.t test case. +Remove exit() from Makefile.PL so CPAN.pm's automatic follow prereq mechanism works correctly. Thanks to Slaven Rezic for pointing this out. +Added Apache::compat loading in mod_perl environment for better mod_perl 2.0 support. =item $VERSION = 2.35; $DATE="05/30/2002" +Destroy better $Server & $Response objects so that my closure references to these to not attempt to work in the future against invalid internal data. There was enough data left in these old objects to make debugging the my closure problem confusing, where it looked like the ASP object state became invalid. +Added system debug diagnostics to inspect StateManager group cleanup (d) Documentation update about flock() work around for Win95/Win98/WinMe systems, confirmed by Rex Arul (d) Documentation/site build bug found by Mitsunobu Ozato, where <% %> not being escaped correctly with $Server->HTMLEncode(). New japanese documentation project started by him at http://sourceforge.jp/projects/apache-asp-jp/ -InitPackageGlobals() called after new Apache::ASP object created so core system templates can be compiled even when there was a runtime compilation error of user templates. Bug fix needed pointed out by Eamon Daly =item $VERSION = 2.33; $DATE="04/29/2002" - fixed up t/server_mail.t test to skip if a sendmail server is not available on localhost. We only want the test to run if there is a server to test against. + removed cgi/asp script, just a symlink now to the ./asp-perl script which in this way deprecates it. I had it hard linked, but the distribution did not untar very well on win32 platform. + Reordered the modules in Bundle::Apache::ASP for a cleaner install. - Fixed bug where XMLSubs where removing tag when it was needed in XSLT mode. + $Server->Mail({ CC => '...', BCC => '...' }), now works to send CC & BCC headers/recipients. + Removed $Apache::ASP::Register definition which defined the current executing Apache::ASP object. Only one part of the application was using it, and this has been fixed. This would have been an unsafe use of globals for a threaded environment. + Decreased latency when doing Application_OnStart, used to sleep(1) for CleanupMaster sync, but this is not necessary for Application_OnStart scenario + Restructure code / core templates for MailErrorsTo funcationality. Wrote test mail_error.t to cover this. $ENV{REMOTE_USER} will now be displayed in the MailErrorsTo message when defined from 401 basic auth. + $Server->RegisterCleanup should be thread safe now, as it no longer relies on access to @Apache::ASP::Cleanup for storing the CODE ref stack. + test t/inode_names.t for InodeNames and other file tests covering case of long file names. - Fixed long file name sub identifier bug. Added test t/long_names.t. + CacheDir may now be set independently of StateDir. It used to default to StateDir if it was set. ++ Decomposition of modules like Apache::ASP::Session & Apache::ASP::Application out of ASP.pm file. This should make the source more developer friendly. This selective code compilation also speeds up CGI requests that do not need to load unneeded modules like Apache::ASP::Session, by about 50%, so where CGI mode ran at about 2.1 hits/sec before, now for light requests that do not load $Session & $Application, requests run at 3.4 hits/sec, this is on a dual PIII-450 linux 2.4.x - Caching like for XSLTCache now works in CGI mode. This was a bug that it did not before. + $Server->File() API added, acts as a wrapper around Apache->request->filename Added test in t/server.t ++ *** EXPERIMENTAL / ALPHA FEATURE NOTE BEGIN *** New $PERLLIB/Apache/ASP/Share/ directory created to hold system & user contributed components, which will be found on the $Server->MapInclude() path, which helps $Response->Include search '.',Global,IncludesDir, and now Apache::ASP::Share for includes to load at runtime. The syntax for loading a shared include is to prefix the file name with Share:: as in: $Response->TrapInclude('Share::CORE/MailError.inc'); New test to cover this at t/share.t This feature is experimental. The naming convention may change and the feature may disappear altogether, so only use if you are interesting in experimenting with this feature & will provide feedback about how it works. *** EXPERIMENTAL / ALPHA FEATURE NOTE END *** + asp-perl script now uses ./asp.conf instead of ./asp.config for runtime configuration via %Config defined there. Update docs for running in standalone CGI mode + Make use of MANFEST.SKIP to not publish the dev/* files anymore. - Script_OnEnd guaranteed to run after $Response->End, but it will not run if there was an error earlier in the request. + lots of new test cases covering behaviour of $Response->End and $Response->Redirect under various conditions like XMLSubs and SoftRedirect and global.asa Script_OnStart + asp-perl will be installed into the bin executables when Apache::ASP is installed. asp-perl is the command line version of Apache::ASP that can also be used to run script in CGI mode. Test case covering asp-perl functionality. + asp CGI/command line script now called asp-perl. I picked this name because Apache::ASP often has the name asp-perl in distributions of the module. + Apache::ASP::CGI::Test class now subclass of Apache::ASP::CGI. To facilitate this Apache::ASP::CGI::init() now called OO like Apache::ASP::CGI->init() Fixed up places where the old style was called. New Test class allows a dummy Apache request object to be built which caches header & body output for later inspection instead of writing it to STDOUT. - $Response->Redirect() under SoftRedirect 1 will not first Clear() buffer - $Response->Redirect() in an XMLSubs will work now ... behavior of $Response->Flush() being turned off in an XMLSubs was interfering with this. + srand() init tracking done better, thanks for patch from Ime Smits + Added file/directory being used for precompilation in Apache::ASP->Loader($file, ...) to output like: [Mon Feb 04 20:19:22 2002] [error] [asp] 4215 (re)compiled 22 scripts of 22 loaded for $file This is so that when precompiling multiple web sites each with different directories, one can easier see the compile output relevant to the Loader() command being run. + better decomp of Apache::ASP site build files at ./build/* files, which is good should anyone look at it for ideas. + improved test suite to error when unintended output results from t/*.t test scripts. - () now supported in XMLSubsMatch config, added xmlsubsmatch.t test... specifically a config like PerlSetVar (aaa|bbb):\w+ should now work. Thanks for bug report from David Kulp. + Added an early srand() for better $ServerID creation + Work around for DSO problems where $r is not always correctly defined in Apache::ASP::handler(). Thanks to Tom Lear for patch. =item $VERSION = 2.31; $DATE="01/22/2002"; + $Server->MapInclude() API extension created to wrap up Apache::ASP::SearchDirs functionality so one may do an conditional check for an include existence befor executing $Response->Include(). Added API test to server.t + $Server->Transfer() now allows arguments like $Response->Include(), and now acts just as a wrapper for: $Response->Include($file, @args); $Response->End(); added test case at t/server_transfer.t + Removed dependency of StatINC functionality on Apache::Symbol. Apache::Symbol is no longer required. Added test of t/stat_inc.t for correct StatINC initialization for platforms where Devel::Symdump is present. + Better error message when $Request->Params has not been defined with RequestParams config & it gets used in script. Added test case as t/request_params_none.t + Directories cannot now be included as scripts via $Response->Include(), added test case to t/include.t - No longer make $Response->Flush dependent on $Response->IsClientConnected() to be true to write output to client. There have been spurious errors reported about the new ( >= 2.25 ) IsClientConnected code, and this will limit the impact of that functionality possibly not working still to those users explicitly using that API. + $Response->AddHeader($header_name, $value) now will set $Response members for these headers: Content-Type, Cache-Control, Expires. This is to avoid both the application & Apache::ASP sending out duplicate headers. Added test cases for this to t/response.t + split up Bundle::Apache::ASP into that, and Bundle::Apache::ASP::Extra the former with just the required modules to run, and the latter for extra functionality in Apache::ASP + new $Request->{Method} member to return $r->method of GET or POST that client browser is requesting, added t/request.t sub test to cover this member. =item $VERSION = 2.29; $DATE="11/19/2001"; +Added some extra help text to the ./cgi/asp --help message to clarify how to pass arguments to a script from the command line. +When using $Server->Mail() API, if Content-Type header is set, and MIME-Version is not, then a "MIME-Version: 1.0" header will be sent for the email. This is correct according to RFC 1521 which specifies for the first time the Content-Type: header for email documents. Thanks to Philip Mak for pointing out this correct behavior. +Made dependent on MLDBM::Sync version .25 to pass the taint_check.t test +Improved server_mail.t test to work with mail servers were relaying is denied +Added tags to MailErrorsTo email --Fixed SessionCount / Session_OnEnd bug, where these things were not working for $Sessions that never had anything written to them. This bug was introduced in 2.23/2.25 release. There was an optimization in 2.23/2.25 where a $Session that was never used does not write its state lock file & dbm files to disk, only if it gets written too like $Session->{MARK}++. Tracking of these NULL $Sessions then is handled solely in the internal database. For $Session garbage collection though which would fire Session_OnEnd events and update SessionCount, the Apache::ASP::State->GroupMembers() function was just looking for state files on disk ... now it looks in the internal database too for SessionID records for garbage collection. Added a test at ./t/session_events.t for these things. +Some optimizations for $Session API use. +Added support for XSLT via XML::LibXSLT, patch courtesy of Michael Buschauer -Got rid of an warning when recompiling changing includes under perl 5.6.1... undef($code) method did not work for this perl version, rather undef(&$code) does. Stopped using using Apache::Symbol for this when available. -Make Apache::ASP script run under perl taint checking -T for perl 5.6.1... $code =~ tr///; does not work to untaint here, so much use the slower: $code =~ /^(.*)$/s; $code = $1; method to untaint. -Check for inline includes changing, included in a dynamic included loaded at runtime via $Response->Include(). Added test case for this at t/include_change.t. If an inline include of a dynamic include changes, the dynamic include should get recompiled now. -Make OK to use again with PerlTaintCheck On, with MLDBM::Sync 2.25. Fixed in ASP.pm, t/global.asa, and created new t/taint_check.t test script +Load more modules when Apache::ASP is loaded so parent will share more with children httpd: Apache::Symbol Devel::Symdump Config lib MLDBM::Sync::SDBM_File +When FileUploadMax bytes is exceeded for a file upload, there will not be an odd error anymore resulting from $CGI::POST_MAX being triggered, instead the file upload input will simply be ignored via $CGI::DISABLE_UPLOADS. This gives the developer the opportunity to tell the user the the file upload was too big, as demonstrated by the ./site/eg/file_upload.asp example. To not let the web client POST a lot of data to your scripts as a form of a denial of service attack use the apache config LimitRequestBody for the max limits. You can think of PerlSetVar FileUploadMax as a soft limit, and apache's LimitRequestBody as a hard limit. --Under certain circumstances with file upload, it seems that IsClientConnected() would return an aborted client value from $r->connection->aborted, so the buffer output data would not be flushed to the client, and the HTML page would return to the browser empty. This would be under normal file upload use. One work-around was to make sure to initialize the $Request object before $Response->IsClientConnected is called, then $r->connection->aborted returns the right value. This problem was probably introduced with IsClientConnected() code changes starting in the 2.25 release. =item $VERSION = 2.27; $DATE="10/31/2001"; + Wrapped call to $r->connection->fileno in eval {} so to preserve backwards compatibility with older mod_perl versions that do not have this method defined. Thanks to Helmut Zeilinger for catching this. + removed ./dev directory from distribution, useless clutter + Removed dependency on HTTP::Date by taking code into Apache::ASP as Apache::ASP::Date. This relieves the dependency of Apache::ASP on libwww LWP libraries. If you were using HTTP::Date functions before without loading "use HTTP::Date;" on your own, you will have to do this now. + Streamlined code execution. Especially worked on $Response->IsClientConnected which gets called during a normal request execution, and got rid of IO::Select dependency. Some function style calls instead of OO style calls where private functions were being invokes that one would not need to override. - Fixed possible bug when flushing a data buffer where there is just a '0' in it. + Updated docs to note that StateCache config was deprecated as of 2.23. Removed remaining code that referenced the config. + Removed references to unused OrderCollections code. - Better Cache meta key, lower chance of collision with unrelated data since its using the full MD5 keyspace now + Optimized some debugging statements that resulted from recent development. + Tie::TextDir .04 and above is supported for StateDB and CacheDB settings with MLDBM::Sync .21. This is good for CacheDB where output is larger and there are not many versions to cache, like for XSLTCache, where the site is mostly static. + Better RESOURCES section to web site, especially with adding some links to past Apache::ASP articles & presentations. =item $VERSION = 2.25; $DATE="10/11/2001"; + Improved ./site/apps/search application, for better search results at Apache::ASP site. Also, reengineered application better, with more perl code moved to global.asa. Make use of MLDBM::Sync::SDBM_File, where search database before was engineering around SDBM_File's shortcomings. - Fix for SessionSerialize config, which broke in 2.23 Also, added t/session_serialize.t to test suite to catch this problem in the future. =item $VERSION = 2.23; $DATE="10/11/2001"; +Make sure a couple other small standard modules get loaded upon "PerlModule Apache::ASP", like Time::HiRes, Class::Struct, and MLDBM::Serializer::Data::Dumper. If not available these modules won't cause errors, but will promote child httpd RAM sharing if they are. -XMLSubs args parsing fix so an arg like z-index does not error under UseStrict. This is OK now: HTML -Only remove outermost These settings require that buffering be enabled, as Apache::ASP will parse through the buffer to parse the URLs. With SessionQueryParse on, it will just parse non-absolute URLs, but with SessionQueryParseMatch set to some server url regexp, like ^http://localhost , will also parse in the session id for URLs that match that. When testing, the performance hit from this parsing a script dropped from 12.5 hits/sec on my WinNT box to 11.7 hits per second for 1K of buffered output. The difference is .007 of my PII300's processing power per second. For 10K of output then, my guess is that this speed of script, would be slowed to 6.8 hits per second. This kind of performance hit would also slow a script running at 40 hits per second on a UNIX box to 31 hits/sec for 1K, and to 11 hits/sec for 10K parsed. Your mileage may vary and you will have to test the difference yourself. Get yourself a valid URL with a session-id in it, and run it through ab, or Socrates, with SessionQuery turned on, and then with SessionQueryParse set to see the difference. SessionQuery just enables of session id setting from the query string but will not auto parse urls. -If buffering, Content-Length will again be set. It broke, probably while I was tuning in the past couple versions. +UseStrict setting compiles all scripts including global.asa with "use strict" turned on for catching more coding errors. With this setting enabled, use strict errors die during compilation forcing Apache::ASP to try to recompile the script until successful. -Object use in includes like $Response->Write() no longer error with "use strict" programming. +SessionQuery config setting with $Server->URL($url, { %params } ) alpha API extensions to enable cookieless sessions. +Debugging not longer produces internal debugging by default. Set to -1,-2 for internal debugging for Debug settings 1 & 2. +Both StateSerializer & StateDB can be changed without affecting a live web site, by storing the configurations for $Application & $Session in an internal database, so that if $Session was created with SDBM_File for the StateDB (default), it will keep this StateDB setting until it ends. +StateSerializer config setting. Default Data::Dumper, can also be set to Storable. Controls how data is serialized before writing to $Application & $Session. +Beefed up the make test suite. +Improved the locking, streamlining a bit of the $Application / $Session setup process. Bench is up to 22 from 21 hits / sec on dev NT box. +Cut more fat for faster startup, now on my dev box I get 44 hits per sec Apache::ASP vs. 48 Embperl vs. 52 CGI via Apache::Registry for the HelloWorld Scripts. -Improved linking for the online site documentation, where a few links before were bad. =item $VERSION = 0.17; $DATE="11/15/99"; ++20%+ faster startup script execution, as measured by the HelloWorld bench. I cut a lot of the fat out of the code, and is now at least 20% faster on startup both with and without state. On my dev (NT, apache 1.3.6+mod_perl) machine, I now get: 42 hits per sec on Apache::ASP HelloWorld bench 46 hits per sec on Embperl (1.2b10) and 51 hits per sec for CGI Apache::Registry scripts Before Apache::ASP was clocking some 31 hits per sec. Apache::ASP also went from 75 to 102 hits per second on Solaris. +PerlTaintCheck On friendly. This is mod_perl's way of providing -T taint checking. When Apache::ASP is used with state objects like $Session or $Application, MLDBM must also be made taint friendly with: $MLDBM::RemoveTaint = 1; which could be put in the global.asa. Documented. +Added $Response->ErrorDocument($error_code, $uri_or_string) API extension which allows for setting of Apache's error document at runtime. This is really just a wrapper for Apache->custom_response() renamed so it syncs with the Apache ErrorDocument config setting. Updated documentation, and added error_document.htm example. =OrderCollections setting was added, but then REMOVED because it was not going to be used. It bound $Request->* collections/hashes to Tie::IxHash, so that data in those collections would be read in the order the browser sent it, when eaching through or with keys. -global.asa will be reloaded when changed. This broke when I optimized the modification times with (stat($file))[9] rather than "use File::stat; stat($file)->mtime" -Make Apache::ASP->Loader() PerlRestartHandler safe, had some unstrict code that was doing the wrong thing. -IncludesDir config now works with DynamicIncludes. +DebugBufferLength feature added, giving control to how much buffered output gets shown when debugging errors. ++Tuning of $Response->Write(), which processes all static html internally, to be almost 50% faster for its typical use, when BufferingOn is enabled, and CgiHeaders are disabled, both being defaults. This can show significant speed improvements for tight loops that render ASP output. +Auto linking of ./site/eg/ text to example scripts at web site. +$Application->GetSession($session_id) API extension, useful for managing active user sessions when storing session ids in $Application. Documented. -disable use of flock() on Win95/98 where it is unimplemented -@array context of $Request->Form('name') returns undef when value for 'name' is undefined. Put extra logic in there to make sure this happens. =item $VERSION = 0.16; $DATE="09/22/99"; -$Response->{Buffer} and PerlSetVar BufferingOn configs now work when set to 0, to unbuffer output, and send it out to the web client as the script generates it. Buffering is enabled by default, as it is faster, and allows a script to error cleanly in the middle of execution. +more bullet proof loading of Apache::Symbol, changed the way Apache::ASP loads modules in general. It used to check for the module to load every time, if it hadn't loaded successfully before, but now it just tries once per httpd, so the web server will have to be restarted to see new installed modules. This is just for modules that Apache::ASP relies on. Old modules that are changed or updated with an installation are still reloaded with the StatINC settings if so configured. +ASP web site wraps around

  tags now to override the other font used for the text
  areas.  The spacing was all weird in Netscape before
  for 
 sections.

 -Fixed Content-Length calculation when using the Clean
  option, so that the length is calculated after the HTML
  is clean, not before.  This would cause a browser to 
  hang sometimes.

 +Added IncludesDir config option that if set will also be
  used to check for includes, so that includes may easily be
  shared between applications.  By default only Global and 
  the directory the script is in are checked for includes.

  Also added IncludesDir as a possible configuration option
  for Apache::ASP->Loader()

 -Re-enabled the Application_OnStart & OnEnd events, after
  breaking them when implementing the AllowApplicationState
  config setting.

 +Better pre-fork caching ... StatINC & StatINCMatch are now 
  args for Apache::ASP->Loader(), so StatINC symbols loading
  may be done pre-fork and shared between httpds.  This lowers
  the child httpd init cost of StatINC.  Documented.

 +Made Apache::ASP Basic Authorization friendly so authentication
  can be handled by ASP scripts.  If AuthName and AuthType Apache
  config directives are set, and a $Response->{Status} is set to 
  401, a user will be prompted for username/password authentication
  and the entered data will show up in ServerVariables as:
    $env = $Request->ServerVariables
    $env->{REMOTE_USER} = $env->{AUTH_USER} = username
    $env->{AUTH_PASSWD} = password
    $env->{AUTH_NAME}   = your realm
    $env->{AUTH_TYPE}   = 'Basic'

  This is the same place to find auth data as if Apache had some 
  authentication handler deal with the auth phase separately.

 -MailErrorsTo should report the right file now that generates
  the error.

=item $VERSION = 0.15; $DATE="08/24/1999";

 --State databases like $Session, $Application are 
  now tied/untied to every lock/unlock triggered by read/write 
  access.  This was necessary for correctness issues, so that 
  database file handles are flushed appropriately between writes
  in a highly concurrent multi-process environment.

  This problem raised its ugly head because under high volume, 
  a DB_File can become corrupt if not flushed correctly.  
  Unfortunately, there is no way to flush SDBM_Files & DB_Files 
  consistently other than to tie/untie the databases every access.

  DB_File may be used optionally for StateDB, but the default is
  to use SDBM_File which is much faster, but limited to 1024 byte
  key/value pairs.

  For SDBM_Files before, if there were too many concurrent 
  writes to a shared database like $Application, some of the 
  writes would not be saved because another process
  might overwrite the changes with its own.

  There is now a 10 fold performance DECREASE associated
  with reading from and writing to files like $Session 
  and $Application.  With rough benchmarks I can get about
  100 increments (++) now per second to $Session->{count}, where
  before I could get 1000 increments / second.  

  You can improve this if you have many reads / writes happening
  at the same time, by placing locking code around the group like
  
	$Session->Lock();
	$Session->{count}++;
	$Session->{count}++;
	$Session->{count}++;
	$Session->UnLock();	

  This method will reduce the number of ties to the $Session database
  from 6 to 1 for this kind of code, and will improve the performance
  dramatically.

  Also, instead of using explicit $Session locking, you can 
  create an automatic lock on $Session per script by setting
  SessionSerialize in your config to 1.  The danger here is
  if you have any long running scripts, the user will have
  to wait for it to finish before another script can be run.

  To see the number of lock/unlocks or ties/unties to each database
  during a script execution, look at the last lines of debug output
  to your error log when Debug is set to 1.  This can help you
  performance tweak access to these databases.

 +Updated documentation with new config settings and
  API extensions.

 +Added AllowApplicationState config option which allows
  you to leave $Application undefined, and will not
  execute Application_OnStart or Application_OnEnd.
  This can be a slight performance increase of 2-3% if
  you are not using $Application, but are using $Session.

 +Added $Session->Lock() / $Session->UnLock() API routines
  necessary additions since access to session is not
  serialized by default like IIS ASP.  Also prompted
  by change in locking code which retied to SDBM_File
  or DB_File each lock.  If you $Session->Lock / UnLock
  around many read/writes, you will increase performance.

 +Added StateCache config which, if set will cache
  the file handle locks for $Application and an internal 
  database used for tracking $Session info.  This caching can 
  make an ASP application perform up to 10% faster,
  at a cost of each web server process holding 2 more 
  cached file handles open, per ASP application using
  this configuration.  The data written to or read from
  these state databases is not cached, just the locking 
  file handles are held open.

 -Added in much more locking in session manager 
  and session garbage collector to help avoid collisions
  between the two.  There were definite windows that the
  two would collide in, during which bad things could 
  happen on a high volume site.

 -Fixed some warnings in DESTROY and ParseParams()

=item $VERSION = 0.14; $DATE="07/29/1999";

 -CGI & StatINC or StatINCMatch would have bad results
  at times, with StatINC deleting dynamically compiled
  CGI subroutines, that were imported into other scripts
  and modules namespaces.

  A couple tweaks, and now StatINC & CGI play nice again ;)
  StatINCMatch should be safe to use in production with CGI. 
  This affects in particular environments that use file upload, 
  since CGI is loaded automatically by Apache::ASP to handle 
  file uploads.

  This fix should also affect other seemingly random 
  times when StatINC or StatINCMatch don't seem to do 
  the right thing.

 +use of ASP objects like $Response are now "use strict"
  safe in scripts, while UniquePackages config is set.

 +Better handling of "use strict" errors in ASP scripts.
  The error is detected, and the developer is pointed to the 
  Apache error log for the exact error.  

  The script with "use strict" errors will be recompiled again.  Its seems 
  though that "use strict" will only throw its error once, so that a script 
  can be recompiled with the same errors, and work w/o any use strict
  error messaging.  

=item $VERSION = 0.12; $DATE="07/01/1999";

 -Compiles are now 10 +times faster for scripts with lots of big
  embedded perl blocks <% #perl %>

  Compiles were slow because of an old PerlScript compatibility
  parsing trick where $Request->QueryString('hi')->{item}
  would be parsed to $Request->QueryString('hi') which works.
  I think the regexp that I was using had O(n^2) characteristics
  and it took a really big perl block to 10 +seconds to parse
  to understand there was a problem :(

  I doubt anyone needed this compatibility, I don't even see
  any code that looks like this in the online PerlScript examples,
  so I've commented out this parsing trick for now.  If you 
  need me to bring back this functionality, it will be in the 
  form of a config setting.

  For information on PerlScript compatibility, see the PerlScript
  section in the ASP docs.

 -Added UniquePackages config option, that if set brings back 
  the old method of compiling each ASP script into its own
  separate package.  As of v.10, scripts are compiled by default
  into the same package, so that scripts, dynamic includes & global.asa
  can share globals.  This BROKE scripts in the same ASP Application
  that defined the same sub routines, as their subs would redefine
  each other.  

  UniquePackages has scripts compiled into separate perl packages,
  so they may define subs with the same name, w/o fear of overlap.
  Under this settings, scripts will not be able to share globals.  

 -Secure field for cookies in $Response->Cookies() must be TRUE to 
  force cookie to be secure.  Before, it just had to be defined, 
  which gave wrong behavior for Secure => 0. 

 +$Response->{IsClientConnected} set to one by default.  Will
  work out a real value when I upgrade to apache 1.3.6.  This
  value has no meaning before, as apache aborts the perl code
  when a client drops its connection in earlier versions.

 +better compile time debugging of dynamic includes, with 
  Debug 2 setting

 +"use strict" friendly handling of compiling dynamic includes
  with errors

=item $VERSION = 0.11; $DATE="06/24/1999";

 +Lots of documentation updates

 +The MailHost config option is the smtp server used for 
  relay emails for the Mail* config options.

 +MailAlertTo config option used for sending a short administrative
  alert for an internal ASP error, server code 500.  This is the 
  compliment to MailErrorsTo, but is suited for sending a to a
  small text based pager.  The email sent by MailErrorsTo would
  then be checked by the web admin for quick response & debugging
  for the incident. 

  The MailAlertPeriod config specifies the time in minutes during 
  which only one alert will be sent, which defaults to 20.

 +MailErrorsTo config options sends the results of a 500 error
  to the email address specified as if Debug were set to 2.
  If Debug 2 is set, this config will not be on, as it is
  for production use only.  Debug settings less than 2 only 
  log errors to the apache server error log.

 -StatINCMatch / StatINC can be used in production and work
  even after a server graceful restart, which is essential for 
  a production server.

 -Content-Length header is set again, if BufferingOn is set, and
  haven't $Response->Flush()'d.  This broke when I introduce
  the Script_OnEnd event handler.

 +Optimized reloading of the GlobalPackage perl module upon changes, 
  so that scripts and dynamic includes don't have to be recompiled.  
  The global.asa will still have to be though.  Since we started
  compiling all routines into a package that can be named with
  GlobalPackage, we've been undeffing compiled scripts and includes
  when the real GlobalPackage changed on disk, as we do a full sweep
  through the namespace.  Now, we skip those subs that we know to 
  be includes or scripts. 

 -Using Apache::Symbol::undef() to undefine precompiled scripts
  and includes when reloading those scripts.  Doing just an undef() 
  would sometimes result in an "active subroutine undef" error.
  This bug came out when I started thrashing the StatINC system
  for production use.

 +StatINCMatch setting created for production use reloading of
  perl modules.  StatINCMatch allows StatINC reloading of a
  subset of all the modules defined in %INC, those that match
  $module =~ /$StatINCMatch/, where module is some module name
  like Class/Struct.pm

 +Reoptimized pod comment parsing.  I slowed it down to sync
  lines numbers in the last version, but found another corner I could cut.

=item $VERSION = 0.10; $DATE="05/24/1999";

 += improvement; - = bug fix

 +Added index.html file to ./eg to help people wade through
  the examples.  This one has been long overdue.

 +Clean config option, or setting $Response->{Clean} to 1 - 9,
  uses HTML::Clean to compress text/html output of ASP scripts.
  I like the Clean 1 setting which is lightweight, stripping 
  white space for about 10% compression, at a cost of less than
  a 5% performance penalty.

 +Using pod style commenting no longer confuses the line
  numbering.  ASP script line numbers are almost exactly match
  their compiled perl version, except that normal inline includes
  (not dynamic) insert extra text which can confuse line numbering.
  If you want perl error line numbers to entirely sync with your 
  ASP scripts, I would suggest learning how to use dynamic includes,
  as opposed to inline includes.

 -Wrapped StatINC reloading of libs in an eval, and capturing
  error for Debug 2 setting.  This makes changing libs with StatINC
  on a little more friendly when there are errors. 

 -$Request->QueryString() now stores multiple values for the 
  same key, just as $Request->Form() has since v.07.  In
  wantarray() context like @vals = $Request->QueryString('dupkey'),
  @vals will store whatever values where associated with dupkey
  in the query string like (1,2) from: ?dupkey=1&dupkey=2

 +The GlobalPackage config directive may be defined
  to explicitly set the perl module that all scripts and global.asa
  are compiled into.

 -Dynamic includes may be in the Global directory, just like
  normal includes.

 +Perl script generated from asp scripts should match line
  for line, seen in errors, except when using inline (default) 
  includes, pod comments, or <% #comment %> perl comments, which 
  will throw off the line counts by adding text, removing
  text, or having an extra newline added, respectively.

 -Script_OnEnd may now send output to the browser.  Before
  $main::Response->End() was being called at the end of the
  main script preventing further output.

++All scripts are compiled as routines in a namespace uniquely
  defined by the global.asa of the ASP application.  Thus,
  scripts, includes, and global.asa routines will share
  all globals defined in the global.asa namespace.   This means
  that globals between scripts will be shared, and globals
  defined in a global.asa will be available to scripts.

  Scripts used to have their own namespace, thus globals
  were not shared between them.

 +a -o $output_dir switch on the ./cgi/asp script allows
  it to execute scripts and write their output to an output
  directory.  Useful for building static html sites, based on
  asp scripts.  An example use would be:

    asp -b -o out *.asp

  Without an output directory, script output is written to STDOUT


=item $VERSION = 0.09; $DATE="04/22/1999";

 +Updated Makefile.PL optional modules output for CGI & DB_File

 +Improved docs on $Response->Cookies() and $Request->Cookies()

 +Added PERFORMANCE doc to main README, and added sub section
  on precompiling scripts with Apache::ASP->Loader()

 +Naming of CompileIncludes switched over to DynamicIncludes 
  for greater clarity.

 +Dynamic includes can now reference ASP objects like $Session
  w/o the $main::* syntax.  These subs are no longer anonymous
  subs, and are now compiled into the namespace of the global.asa package.

 +Apache::ASP->Loader() precompiles dynamic includes too. Making this work
  required fixing some subtle bugs / dependencies in the compiling process.

 +Added Apache::ASP->Loader() similar to Apache::RegistryLoader for
  precompiling ASP scripts.  Precompile a whole site at server 
  startup with one function call.

 +Prettied the error messaging with Debug 2.

 +$Response->Debug(@args) debugging extension, which
  allows a developer to hook into the module's debugging,
  and only have @args be written to error_log when Debug is greater
  than 0.

 -Put write locking code around State writes, like $Session
  and $Application.  I thought I fixed this bug a while ago.

 -API change: converted $Session->Timeout() and $Session->SessionID() 
  methods into $Session->{Timeout} and $Session->{SessionID} properties.
  The use of these properties as methods is deprecated, but 
  backwards compatibility will remain.  Updated ./eg/session.asp
  to use these new properties.

 +Implemented $Response->{PICS} which if set sends out a PICS-Label
  HTTP header, useful for ratings.

 +Implemented $Response->{CacheControl} and $Response->{Charset} members.
  By default, CacheControl is 'private', and this value gets sent out
  every request as HTTP header Cache-Control.  Charset appends itself
  onto the content type header.

 +Implemented $Request->BinaryRead(), $Request->{TotalBytes},
  documented them, and updated ./eg/form.asp for an example usage. 

 +Implemented $Response->BinaryWrite(), documented, and created
  and example in ./eg/binary_write.htm

 +Implemented $Server->MapPath() and created example of its use
  in ./eg/server.htm

 -$Request->Form() now reads file uploads correctly with 
  the latest CGI.pm, where $Request->Form('file_field') returns
  the actual file name uploaded, which can be used as a file handle
  to read in the data.  Before, $Request->Form('file_field') would
  return a glob that looks like *Fh::filename, so to get the file
  name, you would have to parse it like =~ s/^\*Fh\:\://,
  which you no longer have to do.  As long as parsing was done as
  mentioned, the change should be backwards compatible.

 +Updated  +enhanced documentation on file uploads.  Created extra
  comments about it as an FAQ, and under $Response->Form(), the latter
  being an obvious place for a developer to look for it.

 +Updated ./eg/file_upload.asp to show use of non file form data, 
  with which we had a bug before.

 +Finished retieing *STDIN to cached STDIN contents, so that 
  CGI input routines may be used transparently, along side with
  use of $Request->Form()

 +Cleaned up and optimized $Request code

 +Updated documentation for CGI input & file uploads.  Created
  file upload FAQ.

 +Reworked ./eg/cgi.htm example to use CGI input routines
  after doing a native read of STDIN.

 ++Added dynamic includes with 
  extension.  This style of include is compiled as an anonymous sub & 
  cached, and then executed with @args passed to the subroutine for 
  execution.  This is include may also be rewritten as a new API 
  extension: $Response->Include('file', @args)

 +Added ./eg/compiled_includes.htm example documenting new dynamic includes.

 +Documented SSI: native file includes, and the rest with filtering 
  to Apache::SSI

 +Turned the documentation of Filter config to value of Off so 
  people won't cut and paste the On config by default.

 +Added SecureSession config option, which forces session cookie to 
  be sent only under https secured www page requests.

 +Added StateDB config option allows use of DB_File for $Session, since 
  default use of SDBM_File is limited.  See StateDB in README.

 +file include syntax w/o quotes supported like 

 +Nested includes are supported, with includes including each other.
  Recursive includes are detected and errors out when an include has been 
  included 100 times for a script.  Better to quit early than 
  have a process spin out of control. (PORTABLE ? probably not)

 +Allow  notation w/o quotes around file names

 -PerlSetEnv apache conf setting now get passed through to 
  $Request->ServerVariables. This update has ServerVariables 
  getting data from %ENV instead of $r->cgi_env

 +README FAQ for PerlHandler errors


=item $VERSION = 0.08; $DATE="02/06/1999";

 ++SSI with Apache::Filter & Apache::SSI, see config options & ./eg files
  Currently filtering only works in the direction Apache::ASP -> Apache::SSI,
  will not work the other way around, as SSI must come last in a set of filters

 +SSI file includes may reference files in the Global directory, better 
  code sharing

 - <% @array... %> no longer dropped from code.

 +perl =pod comments are stripped from script before compiling, and associated
  PodComments configuration options.

 +Command line cgi/asp script takes various options, and allows execution
  of multiple asp scripts at one time.  This script should be used for
  command line debugging.  This is also the beginning of building
  a static site from asp scripts with the -b option, suppressing headers.

 +$Response->AddHeader('Set-Cookie') works for multiple cookies.

 -$Response->Cookies('foo', '0') works, was dropping 0 because of boolean test

 -Fixed up some config doc errors.


=item $VERSION = 0.07; $DATE="01/20/1999";

 -removed SIG{__WARN__} handler, it was a bad idea.

 -fixes file locking on QNX, work around poor flock porting

 +removed message about Win32::OLE on UNIX platforms from Makefile.PL

 -Better lock garbage collection.  Works with StatINC seamlessly.

 -Multiple select forms now work in array context with $Response->Form()
	@values = $Response->Form('multi');

 -Better CGI.pm compatibility with $r->header_out('Content-type'),
  improved garbage collection under modperl, esp. w/ file uploads


=item $VERSION = 0.06; $DATE="12/21/1998";

 +Application_OnStart & Application_OnEnd event handlers support.

 -Compatible with CGI.pm 2.46 headers() 

 -Compatible with CGI.pm $q = new CGI({}), caveat: does not set params 

 +use strict; followed by use of objects like $Session is fine.

 -Multiple cookies may be set per script execution.

 +file upload implemented via CGI.pm

 ++global.asa implemented with events Session_OnStart and Session_OnEnd
  working appropriately.

 +StateDir configuration directive implemented.
  StateDir allows the session state directory to be specified separately 
  from the Global directory, useful for operating systems with caching file 
  systems.

 +StateManager config directive.  StateManager specifies how frequently
  Sessions are cleaned up, with 10 (default) meaning that old Sessions
  will be cleaned up 10 times per SessionTimeout period (default 20 minutes).

 +$Application->SessionCount() implemented, non-portable method.
	: returns the number of currently active sessions

 -STOP button fix.  Users may hit STOP button during script 
  execution, and Apache::ASP will cleanup with a routine registered
  in Apache's $r->register_cleanup.  Works well supposedly.

 +PerlScript compatibility work, trying to make ports smoother.
	: Collection emulator, no ->{Count} property
	: $.*(.*)->{Item} parsed automatically, 
	  shedding the ->{Item} for Collection support (? better way ?)
	: No VBScript dates support, just HTTP RFC dates with HTTP::Date
	: Win32::OLE::in not supported, just use "keys %{$Collection}"	

 +./cgi/asp script for testing scripts from the command line
	: will be upgraded to CGI method of doing asp
	: is not "correct" in anyway, so not documented for now
	  but still useful

 +strips DOS carriage returns from scripts automatically, so that
  programs like FrontPage can upload pages to UNIX servers
  without perl choking on the extra \r characters.


=item $VERSION = 0.05; $DATE="10/19/1998";

 +Added PERFORMANCE doc, which includes benchmarks  +hints.

 +Better installation warnings and errors for other modules required. 

 -Turned off StatINC in eg/.htaccess, as not everyone installs Devel::Symdump

 -Fixed AUTOLOAD state bug, which wouldn't let you each through state
  objects, like %{$Session}, or each %$Session, (bug introduced in v.04)

 +Parses ASP white space better.  HTML output matches author's intent
  by better dealing with white space surrounding <% perl blocks %>

 -Scalar insertion code <%=$foo%> can now span many lines.

 +Added include.t test script for includes.

 +Script recompiles when included files change.

 +Files can be included in script with 
  SSI  syntax, needs to be
  done in ASP module to allow compilation of included code and html 
  into script.  Future chaining with Apache::SSI will allow static 
  html includes, and other SSI directives


=item $VERSION = 0.04; $DATE="10/14/1998";

 +Example script eg/cgi.htm demonstrating CGI.pm use for output.

 +Optimized ASP parsing, faster and more legible executing code
	: try 'die();' in code with setting PerlSetVar Debug 2

 +Cleaned up code for running with 'use strict'

 -Fixed directory handle leak on Solaris, from not closing after opendir()

 +StatINC overhaul.  StatINC setting now works as it should, with 
  the caveat that exported functions will not be refreshed.

 +NoState setting optimization, disallows $Application & $Session

 +$Application->*Lock() functions implemented

 -SoftRedirect setting for those who want scripts to keep running
  after a Redirect()

 +SessionSerialize setting to lock session while script is running
	: Microsoft ASP style session locking
	: For a session, scripts execute one at a time 
	: NOT recommended use, please see note.

 -MLDBM can be used for other things without messing up internal use
	: before if it was used with different DB's and serializers,
	  internal state could be lost.

 --State file locking.  Corruption worries, and loss of data no more.

 +CGI header support, developer can use CGI.pm for *output*, or just print()
	: print "Set-Cookie: test=cookie\n", and things will just work
	: use CGI.pm for output
	: utilizes $r->send_cgi_header(), thanks Doug!

 +Improved Cookie implementation, more flexible and complete
	- Domain cookie key now works
	: Expire times now taken from time(), and relative time in sec
	: Request->Cookies() reading more flexible, with wantarray()
	  on hash cookie values, %hash = $Request->Cookie('test');

 -make test module naming correction, was t.pm, now T.pm for Unix

 +POD / README cleanup, formatting and HTML friendly.


=item $VERSION = 0.03; $DATE="09/14/1998";

 +Installation 'make test' now works

 +ActiveX objects on Win32 implemented with $Server->CreateObject() 

 +Cookies implemented: $Response->Cookies() & $Request->Cookies()

 -Fixed $Response object API, converting some methods to object members.
  Deprecated methods, but backwards compatible.

 +Improved error messaging, debug output

 +$, influences $Response->Write(@strings) behavior

 +perl print() works, sending output to $Response object

 +$Response->Write() prints scalars, arrays, and hashes.  Before only scalars.

 +Begin implementation of $Server object.

 +Implemented $Response->{Expires} and $Response->{ExpiresAbsolute}

 +Added "PerlSetVar StatINC" config option

 +$0 is aliased to current script filename

 +ASP Objects ($Response, etc.) are set in main package
  Thus notation like $main::Response->Write() can be used anywhere.


=item $VERSION = 0.02; $DATE="07/12/1998";

 ++Session Manager, won't break under denial of service attack

 +Fleshed out $Response, $Session objects, almost full implementation.

 +Enormously more documentation.

 -Fixed error handling with Debug = 2.

 -Documentation fixed for pod2man support.  README now more man-like.

 -Stripped \r\n dos characters from installation files

 -755 mode set for session state directory when created

 -Loads Win32/OLE properly, won't break with UNIX


=item $VERSION = 0.01; $DATE="06/26/1998";

 Syntax Support
 --------------
 Initial release, could be considered alpha software.
 Allows developers to embed perl in html ASP style.

 
 
 
 <% for(1..10) { %>
 	counting: <%=$_%> 
<% } %> ASP Objects ----------- $Session, $Application, $Response, $Request objects available for use in asp pages. $Session & $Application data is preserved using SDBM files. $Session id's are tracked through the use of cookies. Security -------- Timeouts any attempt to use a session id that doesn't already exist. Should stop hackers, since there is no wire speed guessing cookies. =head1 LICENSE Copyright (c) 1998-2018, Josh Chamas All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Apache::ASP is a perl native port of Active Server Pages for Apache and mod_perl. =cut Apache-ASP-2.63/t/0000755000175000017500000000000013252400404011611 5ustar jobjobApache-ASP-2.63/t/xmlsubs.t0000644000175000017500000000115611721310312013473 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( XMLSubsMatch => 'my:\w+', NoState => 1, UseStrict => 1, Debug => 3, ); __END__ <% my $ref = { ok => 1 } ; %> ok =pod =cut <% $t->eok($Deep == 3, "Deep tag to call twice"); %> =pod 2}/> =cut Apache-ASP-2.63/t/include_code.inc0000644000175000017500000000002511721310312014713 0ustar jobjob# one line $t->ok(); Apache-ASP-2.63/t/collectionitem.t0000644000175000017500000000355311721310312015013 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self('CollectionItem' => 1, 'NoState' => 0); __END__ <% for('Form', 'QueryString') { # basic assignment & lookup my $self = $t->eok($Request->$_(), "no collection for $_ found"); $Request->$_('test', 'value'); $t->eok($self->{'test'} eq 'value', "count not set value"); $t->eok($Request->$_('test')->Item() eq 'value', "could not fetch value"); # $t->eok($Request->Form->('test')->Item() eq 'value', "could not fetch value"); $Request->{$_}{'undef_test'} = undef; $t->eok(! defined $Request->$_('undef_test')->Item(), "could not have undef value"); # array assignment & lookup $self->{'array'} = [1,0,2]; my @values = $Request->$_('array'); $t->eok(@values == 3, 'array block lookup test failed'); my $value = $Request->$_('array'); $t->eok($value->Item() == 1, 'array single lookup test failed'); # Item syntax $t->eok($Request->$_()->Item('test')->Item() eq 'value', '$Collection->Item(key) lookup syntax'); $Request->$_()->Item('test', 'value2'); $t->eok($self->{'test'} eq 'value2', '$Collection->Item(key, value) assignment syntax'); # Multi values & Count()/Item() testing $Request->{$_}{'multi'} = ['4','2','3']; my @items = $Request->$_('multi')->Item(); $t->eok($Request->$_('multi')->Count == 3, 'Multiple values ->Count()'); $t->eok($Request->$_('multi')->Item() == 4, 'First item of many, scalar context'); $t->eok($items[1] == 2, 'Middle item of many, array context'); # collection arrays start counting at 1? $t->eok($Request->$_('multi')->Item(1) == 4, 'Index access to multi Item()'); # Null values & Count() & Item() testing $t->eok($Request->$_('NULL')->Count() == 0, 'NULL Item Count == 0'); $t->eok(! defined $Request->$_('NULL')->Item(), 'NULL Item returns NULL'); } $Application->{contents} = 1; $t->eok($Application->Contents('contents'), '$Collection->Contents(key) lookup syntax'); %> Apache-ASP-2.63/t/session.t0000644000175000017500000000023211721310312013453 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( # Debug => 1, # StateDir => '/tmp/asp_test', ); __END__ <% $Response->Include('session.inc'); %> Apache-ASP-2.63/t/reload_global_asa.t0000644000175000017500000000122411721310312015404 0ustar jobjob use Apache::ASP::CGI; use lib qw(t .); use T; use strict; $SIG{__DIE__} = \&Carp::confess; chdir('t'); my $r = Apache::ASP::CGI->init('reload_global_asa.t'); my %config = ( UseStrict => 1, # Debug => -3, ); for(keys %config) { $r->dir_config->set($_, $config{$_}); } my $t = T->new; # will trigger error when reloading subs # critical to the test case local $^W = 1; my $ASP_1 = Apache::ASP->new($r); $t->eok(keys(%Apache::ASP::Compiled) >= 1, "nothing compiled"); %Apache::ASP::Compiled = (); # free compiled routines my $ASP_2 = Apache::ASP->new($r); # so to untie STDOUT $ASP_1->DESTROY; $ASP_2->DESTROY; $t->ok; $t->done; Apache-ASP-2.63/t/cache.t0000644000175000017500000001150411721310312013037 0ustar jobjob use Apache::ASP::CGI; use strict; $SIG{__DIE__} = \&Carp::confess; my @dbms = qw( MLDBM::Sync::SDBM_File DB_File GDBM_File ); my $dbm_ok; for my $dbm ( @dbms ) { eval "use $dbm"; if(! $@) { $dbm_ok = $dbm; # print STDERR $dbm_ok."\n"; last; } } return unless $dbm_ok; &Apache::ASP::CGI::do_self( CacheSize => '1K', # auto cleanup after test CacheDB => $dbm_ok, UseStrict => 1, NoState => 1, # Debug => -3, # CacheDir can be set separately from StateDir StateDir => '.state', CacheDir => '.cache', ); __END__ <% my $asp = $Server->{asp}; my $cache_lock = ".cache/cache/Response.lock"; my $reset_cache_counts = sub { map { $asp->{'cache_count_'.$_} = 0 } qw( fetch miss store expires last_modified_expires ) }; my $check_cache_counts = sub { my($error, %args) = @_; for my $key ( keys %args ) { my $asp_key = 'cache_count_'.$key; $t->eok($asp->{$asp_key} == $args{$key}, "$error cache test: $asp_key is $asp->{$asp_key}, should be $args{$key}" ); } }; my $out_length = 2000; my $script = qq[<\%\= "1234" x 500 %\>]; # BASIC for(1..3) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Expires => 3600, LastModified => time()-10, Key => $0, }); $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); } &$check_cache_counts("BASIC", fetch => 2, miss => 1, store => 1); &$reset_cache_counts; $t->eok(-e $cache_lock, "Cache lock test"); # EXPIRES PAST for(1..3) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Expires => -1, Key => $0, }); $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); } &$check_cache_counts("EXPIRES", expires => 3, store => 3); &$reset_cache_counts; # EXPIRES FUTURE, first is new, second should be cached, third should expire for(1..3) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Expires => 2, Key => [ 'EXPIRES FUTURE' ], }); if($_ == 2) { sleep 2; }; $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); }; &$check_cache_counts("EXPIRES FUTURE", miss => 1, fetch => 1, expires => 1, store => 2); &$reset_cache_counts; # LAST MODIFIED EXPIRE/CACHE for my $last_modified ( time + 10, Apache::ASP::Date::time2str(time + 10), time-10, Apache::ASP::Date::time2str(time-10) ) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Key => [ 'EXPIRES FUTURE' ], LastModified => $last_modified, }); $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); } &$check_cache_counts("LAST MODIFED EXPIRES", last_modified_expires => 2, store => 2, fetch => 2); &$reset_cache_counts; # CLEAR for (1,0,1,0,1) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Key => [ 'EXPIRES FUTURE' ], Clear => $_, }); $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); } &$check_cache_counts("CLEAR", store => 3, fetch => 2); &$reset_cache_counts; # KEY for (1,0,1,0,1) { my $out = $Response->TrapInclude({ File => \$script, Cache => 1, Key => { 'KEY TEST' => $_ }, }); $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); } &$check_cache_counts("CLEAR", miss => 2, store => 2, fetch => 3); &$reset_cache_counts; # NORMAL + RV for my $arg (1,0,1,0,1,0,1) { my @rv = $Response->Include({ File => 'cache_test.inc', Cache => 1, }, $arg, $arg); $Response->Debug("return values from cached include: ",@rv); $t->eok((grep($_ eq $arg, @rv)) == 2, "Return values from caching include"); my $out = $Response->{BinaryRef}; $$out =~ s/\s+//isg; $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); $Response->Clear; } &$check_cache_counts("CLEAR", miss => 2, store => 2, fetch => 5); &$reset_cache_counts; # KEY CHECK 2 for my $arg ({ arg => 1 }, { arg => 1 }, { arg => 1 }, { arg => 2 }) { my @rv = $Response->Include({ File => 'cache_test.inc', Cache => 1, Key => $arg }, $arg ); my $out = $Response->{BinaryRef}; $$out =~ s/\s+//isg; $t->eok(length($$out) == $out_length, "Output length from include should be $out_length, found: ".length($$out)); $Response->Clear; } &$check_cache_counts("CLEAR", miss => 2, store => 2, fetch => 2); &$reset_cache_counts; $asp->{r}->register_cleanup(sub { -e $cache_lock && die("cache lock $cache_lock still exists after cleanup") }); %> Apache-ASP-2.63/t/T.pm0000644000175000017500000000254011721310312012350 0ustar jobjob#!perl -w package T; use Carp qw(cluck); no strict 'vars'; sub new { my($class, $data, $input) = @_; $class ||= 'T'; bless { 'data' => $data, 'input' => $input, 't' => 0 }, $class; } sub skip { my $self = shift; $self->{t}++; $self->{buffer} .= "ok $self->{t} # skip\n"; } sub ok { $_[0]->{t}++; $_[0]->{buffer} .= "ok\n"; } *not = *not_ok; sub not_ok { my($self, $warn) = @_; if($warn) { warn "[failure] $warn"; } $self->{t}++; $self->{buffer} .= "not ok\n"; } sub add { $_[0]->{buffer} .= "$_[1]\n"; } sub test { my($self) = @_; my($k, $v); while(($k, $v) = each %{$self->{data}}) { $test = "$k=$v"; if($self->{input} =~ /\[\[$test\]\]/) { $self->ok(); } else { $self->not_ok(); print "$test data not found\n"; } } } sub done { my $self = shift; return if $self->{done}++; print "1..$self->{t}\n"; print $self->{buffer}; } sub do { my($class, $data, $input) = @_; my $self = new($class, $data, $input); $self->test(); $self->done(); 1; } *eok = *eval_ok; sub eval_ok { my($self, $test, $error) = @_; my $result = (ref($test) =~ /CODE/) ? eval { &$test } : eval { $test }; if($result) { $self->ok(); } else { my $tail = $@ ? ", $@" : ''; $self->not($error.$tail); } $result; } 1; Apache-ASP-2.63/t/include.t0000644000175000017500000000246311721310312013423 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self('NoState' => 1, Debug => 0); __END__ <% use lib '.'; use T; $t =T->new(); %> <% $Response->Include("include_asp.inc"); %> <% # normal shape of include command if('' =~ /^1/) { $t->ok(); } else { $t->not_ok; } #$Response->Debug($Server->{asp}); # should parse both in at once if('' =~ /^1/) { $t->ok(); } else { $t->not_ok; } # test again for multiple includes to mess # up the line numbering %><% #abnormal possible use of include command if( '' =~ /^1/) { $t->ok(); } else { $t->not_ok; } my $trapped = $Response->TrapInclude('include.inc'); $t->eok($$trapped eq '1', '$Response->TrapInclude()'); $Response->Include('include.inc'); my $ref = $Response->{BinaryRef}; $t->eok($$ref =~ /1/, '$Response->Include()'); $$ref =~ s/1//isg; # return values @rv = $Response->Include('include_return.inc'); $t->eok(@rv == 2 and $rv[0] == 1 and $rv[1] == 2, 'include return values'); if(-d '.') { # in case this is not true on some platforms eval { $Response->Include('.'); }; $t->eok($@ && ( $@ =~ /^no include \.dsfads/i ), "Error for include of directory"); } $t->done; %> Apache-ASP-2.63/t/xmlsubs_perlargs.t0000644000175000017500000000121711721310312015370 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( XMLSubsMatch => 'my:\w+', NoState => 1, UseStrict => 1, Debug => 3, # XMLSubsPerlArgs => 1, ); __END__ <% my $ref = { ok => 1 } ; %> ok =pod =cut <% $t->eok($Deep == 3, "Deep tag to call twice"); %> =pod 2}/> =cut Apache-ASP-2.63/t/cache_test.inc0000644000175000017500000000013411721310312014401 0ustar jobjob<% my(@args) = @_; $Response->Clear(); print "1111" x 500; return @args; %> Apache-ASP-2.63/t/stat_inc.t0000644000175000017500000000055411721310312013603 0ustar jobjobuse Apache::ASP::CGI; # only run test if Devel::Symdump is installed eval "use Devel::Symdump;"; my $stat_inc = $@ ? 0 : 1; &Apache::ASP::CGI::do_self(StatINC => $stat_inc); __END__ <% use lib '.'; use T; $t =T->new(); %> <% return unless $Server->Config('StatINC'); $t->eok($Apache::ASP::StatINCReady, 'Apache::ASP StatINC Startup'); %> <% $t->done; %> Apache-ASP-2.63/t/load.inc0000644000175000017500000000021711721310312013220 0ustar jobjob<% print "ok\n"; # $Response->AppendToLog("loader logging ok %!"); # $Response->Debug("loader debugging ok %!"); $main::TestLoad = 1; %> Apache-ASP-2.63/t/response_end.t0000644000175000017500000000017411721310312014461 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1); __END__ <% $t->ok; $Response->End; $t->not_ok; %> Apache-ASP-2.63/t/session_query_parse.t0000644000175000017500000000162411721310312016100 0ustar jobjob#!/usr/bin/perl use Apache::ASP::CGI::Test; use lib qw(t . ..); use T; use strict; my $t = T->new; my $r = Apache::ASP::CGI::Test->do_self ( UseStrict => 1, SessionQueryParse => 1, Global => 'null', ); my $header = $r->test_header_out; my $body = $r->test_body_out; my @tests = ( 'URL("somelink.asp?test3=value3", { test4 => "value4" }) %>'>
Apache-ASP-2.63/t/include_code2.inc0000644000175000017500000000002511721310312014775 0ustar jobjob# one line $t->ok(); Apache-ASP-2.63/t/include.inc0000644000175000017500000000000211721310312013714 0ustar jobjob1 Apache-ASP-2.63/t/raw.t0000644000175000017500000000016211721310312012563 0ustar jobjob use Apache::ASP::CGI; &Apache::ASP::CGI::do_self(Global => 'null', Debug => 0, NoState => 1); __END__ 1..1 ok Apache-ASP-2.63/t/end_xmlsubs_basic.inc0000644000175000017500000000015411721310312015765 0ustar jobjob1 2<% ; # the output of this script should just be 1 $Response->End; %>3 4 Apache-ASP-2.63/t/unique_packages.inc0000644000175000017500000000001611721310312015442 0ustar jobjob<% $t->ok; %> Apache-ASP-2.63/t/include_asp.inc0000644000175000017500000000012511721310312014565 0ustar jobjob<% # some script to include $t->ok; %> Apache-ASP-2.63/t/same_name/0000755000175000017500000000000013252400404013536 5ustar jobjobApache-ASP-2.63/t/same_name/test2/0000755000175000017500000000000013252400404014577 5ustar jobjobApache-ASP-2.63/t/same_name/test2/test.asp0000644000175000017500000000001711721310311016255 0ustar jobjob<% print 2; %> Apache-ASP-2.63/t/same_name/test1/0000755000175000017500000000000013252400404014576 5ustar jobjobApache-ASP-2.63/t/same_name/test1/test.asp0000644000175000017500000000001711721310311016254 0ustar jobjob<% print 1; %> Apache-ASP-2.63/t/null/0000755000175000017500000000000013252400404012563 5ustar jobjobApache-ASP-2.63/t/null/global.asa0000644000175000017500000000000111721310311014474 0ustar jobjob Apache-ASP-2.63/t/null/ok.inc0000644000175000017500000000003611721310311013662 0ustar jobjobprint "1..1\n"; <%= "ok\n" %> Apache-ASP-2.63/t/same_name.t0000644000175000017500000000124211721310312013717 0ustar jobjobuse Apache::ASP::CGI::Test; use lib qw(t .); use T; use strict; use Cwd qw(cwd); $SIG{__DIE__} = \&Carp::confess; my $t = T->new; my $cwd = cwd(); for my $test_num (1..2) { chdir($cwd) || die("can't chdir to $cwd"); my $r = Apache::ASP::CGI::Test->init($cwd.'/t/same_name/test'.$test_num.'/test.asp'); my %config = ( NoState => 1, GlobalPackage => 'SameName', # Debug => -3, ); for(keys %config) { $r->dir_config->set($_, $config{$_}); } my $rv = Apache::ASP->handler($r); $t->eok($r->test_body_out eq $test_num, "test $test_num output is: ".$r->test_body_out.", return value: $rv"); } $t->done; Apache-ASP-2.63/t/load_error.inc0000644000175000017500000000021011721310312014422 0ustar jobjob<% $not_scoped_variable = 1; # $Response->AppendToLog("loader logging ok %!"); # $Response->Debug("loader debugging ok %!"); %> Apache-ASP-2.63/t/closure.t0000644000175000017500000000130611721310312013447 0ustar jobjobuse Apache::ASP::CGI; use strict; use vars qw($Temp); $^W = 1; $main::Temp = 0; &Apache::ASP::CGI::do_self(UseStrict => 1, NoState => 1, Debug => 1); __END__ <% eval { $Response->Include('closure.inc'); }; my $error = $@; $t->eok($error, "include error"); $t->eok($error =~ /not stay shared/is ? 1 : 0, "not stay shared error"); # this part is to test that script with named subroutines do # no get cached so the perl compilation will increment $^W = 0; my $ASP = $Server->{asp}; $Response->TrapInclude('closure.inc'); $t->eok($ASP->{compile_perl_count} == 3, $ASP->{compile_perl_count}); $Response->TrapInclude('closure.inc'); $t->eok($ASP->{compile_perl_count} == 4, $ASP->{compile_perl_count}); %> Apache-ASP-2.63/t/asp-perl2.t0000644000175000017500000000043211721310312013577 0ustar jobjob use File::Basename qw(dirname); my $dirname = dirname($0); if($dirname) { chdir($dirname) || die("can't chdir to $dirname: $!"); } chdir('asp-perl') || die("can't chdir to asp-perl"); @ARGV = ('-b', 'ok.inc'); use lib qw(../../blib/lib ../../lib); do "../../asp-perl"; Apache-ASP-2.63/t/server_transfer.inc0000644000175000017500000000015611721310312015515 0ustar jobjob<% my @args = @_; $t->eok($args[0] eq 'TEST', 'Argument TEST passed through $Server->Transfer'); $t->done; %> Apache-ASP-2.63/t/server_mail.t0000644000175000017500000000203011721310312014276 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1, Debug => 3, # defaults to localhost for mail relay # but will lookup in Net::Config too for # other hosts MailHost => '127.0.0.1', ); __END__ <% use lib '.'; use T; $t =T->new(); %> <% # test for Net::SMTP, and skip if not installed eval "use Net::SMTP"; if($@) { return; } else { my $smtp = Net::SMTP->new('127.0.0.1'); unless($smtp) { return; } } $t->eok($Server->Mail({ # won't actually send the mail in test mode Test => 1, # make the address fairly legit, in case the SMTP # is validating in realtime To => "asptest\@chamas.com", # no from, since some mail gateways may not relay * addresses # so we allow for From not to be set while Test is set # From => "INSTALL_TEST\@apache-asp.org", Subject => "Test Email", Body => "Test Body", Debug => 0 }), "\$Server->Mail() failed in test mode, check that your mail server at 127.0.0.1 can relay email. " ); %> <% $t->done; %> Apache-ASP-2.63/t/no_cache.t0000644000175000017500000000121711721310312013533 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( GlobalPackage => "Test", # UniquePackages => 1, UseStrict => 0, Debug => 3, NoState => 1, NoCache => 1, ); __END__ <% $Response->Include(\"\n<\% \$var = 1; %\>\n"); $t->eok($var, "unique namespace script and include"); $t->eok($Test::var, "unique namespace script and include"); $test_value = 0; &include_test(1); &include_test(2); &include_test(3); $test_value = 0; &include_test(1); sub include_test { my($value) = shift; $main::Server->{asp}->CompileInclude('no_cache.inc'); $Test::t->eok($test_value == $value, "value load check"); } %> Apache-ASP-2.63/t/global.asa0000644000175000017500000000407511721310312013542 0ustar jobjob # script tag not needed, just in for IIS Compat test Apache-ASP-2.63/t/unique_packages.t0000644000175000017500000000202111721310312015132 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( GlobalPackage => "Test", UniquePackages => 1, UseStrict => 0, Debug => 3, NoState => 1, ); __END__ <% $Test::t->eok(! $t, "\$t defined in this namespace"); $Response->Include(\"\n<\% \$var = 1; %\>\n"); $Test::t->eok(!$var, "unique namespace script and include"); $Test::t->eok($Test::var, "unique namespace script and include"); my @compile_keys = keys %Apache::ASP::CompiledIncludes; $Test::t->eok(grep(/Test::.+::/, @compile_keys) == 1); $Test::t->eok(grep(/Test::/, @compile_keys) == 1); $Response->Include("unique_packages.inc"); @compile_keys = keys %Apache::ASP::CompiledIncludes; $Test::t->eok(grep(/Test::.+::/, @compile_keys) == 1); $Test::t->eok(grep(/Test::/, @compile_keys) == 2); # run test again to make sure caching worked $Response->Include("unique_packages.inc"); @compile_keys = keys %Apache::ASP::CompiledIncludes; $Test::t->eok(grep(/Test::.+::/, @compile_keys) == 1); $Test::t->eok(grep(/Test::/, @compile_keys) == 2); %> Apache-ASP-2.63/t/cgi_headers.t0000644000175000017500000000055211721310312014232 0ustar jobjobuse Apache::ASP::CGI::Test; use lib qw(t ../t); use T; my $r = Apache::ASP::CGI::Test->do_self(NoState => 1, CgiHeaders => 1, Debug => 0); my $t = T->new; my $ok; $t->eok($ok = $r->test_header_out =~ /Status: 200\n/s, "response header"); $t->eok($ok = $r->test_body_out =~ /^1..1\nok\s+$/s, "response body"); $t->done; __END__ Status: 200 <% $t->ok; %> Apache-ASP-2.63/t/inline_include_change.inc0000644000175000017500000000006511721310312016570 0ustar jobjob Apache-ASP-2.63/t/session_events/0000755000175000017500000000000013252400404014660 5ustar jobjobApache-ASP-2.63/t/session_events/global.asa0000644000175000017500000000040511721310312016602 0ustar jobjobsub Session_OnStart { $Response->Debug("Session_OnStart ".$Session->SessionID); $Application->{$Session->SessionID}++; } sub Session_OnEnd { $Response->Debug("Session_OnEnd ".$Session->SessionID); delete $Application->{$Session->SessionID}; } Apache-ASP-2.63/t/long_names.t0000644000175000017500000000236111721310312014117 0ustar jobjob use Apache::ASP::CGI; use File::Basename qw(dirname); use strict; use Cwd; # we build the long directory structure ourselves, and not # include it in the distribution because some tar programs # like Archive::Tar and solaris tar do not deal with long path # names very well # --jc 7/3/2002 # make sure we are building the files in the test directory my $cwd = cwd(); dirname($0) && chdir(dirname($0)); my $long_dir_name = 'long_directory_path_test'; my @long_dirs; for(1..6) { push(@long_dirs, $long_dir_name); my $curr_dir = join('/', @long_dirs); next if -e $curr_dir; my $old_umask = umask(0000); mkdir($curr_dir, 0755) || die("can't mkdir for $curr_dir: $!"); umask($old_umask); } my $long_dir = join('/', @long_dirs); length($long_dir) > 100 or die("$long_dir is not longer than 100"); -d $long_dir || die("$long_dir does not exist"); open(FILE, ">$long_dir/ok.inc") || die("can't write to $long_dir/ok.inc"); print FILE "1..1\nok\n"; close FILE; $main::LONG_FILE = "$long_dir/ok.inc"; -e $main::LONG_FILE || die("main::LONG_FILE does not exist\n"); chdir($cwd); &Apache::ASP::CGI::do_self( NoState => 1, Global => $long_dir, Debug => 0, ); __END__ <% $Response->Include("$main::LONG_FILE"); %> Apache-ASP-2.63/t/session.inc0000644000175000017500000000111211721310312013757 0ustar jobjob<% eval { $Session->Lock }; $t->eok($Session->Timeout > 1, "timeout check > 1"); $t->eok($Session->{Timeout} > 1, "timeout check > 1"); $t->eok(! $@, "\$Session->Lock: $@"); $t->eok(length($Session->{SessionID}) >= 8, "session id not long enough"); my $count = 0; for(1..3) { $Session->{count}++; $count++; $t->eok($count == $Session->{count}, 'failure to increment $Session->{count}'); } eval { $Session->UnLock() }; $t->eok(! $@, "\$Session->UnLock: $@"); $t->eok($Session->{count} == 3, "\$Session->{count} should equal 3 after locked critical section"); %> Apache-ASP-2.63/t/strict_error.t0000644000175000017500000000045711721310312014522 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(UseStrict => 1, NoState => 0, Debug => 3); __END__ <% eval { $Response->Include('strict_error.inc') }; my $error = $@; $t->eok($error, "no strict error"); $t->eok($error =~ /MyStrictError/ ? 1 : 0, "wrong strict error, should match MyStrictError"); %> Apache-ASP-2.63/t/asp-perl1.t0000644000175000017500000000046111721310312013600 0ustar jobjob use File::Basename qw(dirname); use Carp qw(cluck); #$SIG{__WARN__} = \&cluck; my $dirname = dirname($0); if($dirname) { chdir($dirname) || die("can't chdir to $dirname: $!"); } @ARGV = ('-b', '-f', 'asp-perl/asp.conf', 'asp-perl/ok.inc'); use lib qw(../blib/lib ../lib); do "../asp-perl"; Apache-ASP-2.63/t/no_cache.inc0000644000175000017500000000004311721310312014035 0ustar jobjob<% BEGIN { $test_value++ }; %> Apache-ASP-2.63/t/closure.inc0000644000175000017500000000010111721310312013745 0ustar jobjob<% my $x=1; sub closure { my $y = $x; $y; } return; %> Apache-ASP-2.63/t/cookies.t0000644000175000017500000000225411721310312013432 0ustar jobjobuse Apache::ASP::CGI::Test; use lib qw(t . ..); use T; use strict; my $t = T->new; my $r = Apache::ASP::CGI::Test->do_self( UseStrict => 1, CookieDomain => 'apache-asp.com', SecureSession => 1, CookiePath => '/eg/' ); my $header = $r->test_header_out; my $body = $r->test_body_out; my @cookie_tests = ( 'Set-Cookie: test=cookie; path=/', 'Set-Cookie: test2=value; expires=Wed, 06 Nov 2002 21:52:30 GMT; path=/path/; domain=test.com; secure', 'Set-Cookie: test3=key1=value1&key2=value2; path=/', 'Set-Cookie: session-id=[0-9a-f]+; path=/eg/; domain=apache-asp.com; secure', ); for my $cookie_test ( @cookie_tests ) { # $cookie_test =~ s/(\W)/$1/isg; $t->eok(($header =~ /$cookie_test/s) ? 1 : 0, "Cookies header test"); } $t->eok($body =~ /^\s*1\.\.1\nok\s*$/ ? 1 : 0, "Body test"); $t->done; __END__ <% $Response->{Cookies}{test} = "cookie"; $Response->{Cookies}{test2} = { Value => 'value', Path => "/path/", Secure => 1, Expires => "Wed, 06 Nov 2002 21:52:30 GMT", Domain => 'test.com', }; $Response->Cookies("test3", "key1", "value1"); $Response->Cookies("test3", "key2", "value2"); $t->ok; %> Apache-ASP-2.63/t/loops.t0000644000175000017500000000057511721310312013136 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1); __END__ <% use lib '.'; use T; $t =T->new(); %> <% my $count = 0; for(1..3) { $count++; } if($count == 3) { $t->ok; } else { $t->not_ok("for loop didn't work"); } $count = 0; while(1) { last if (++$count > 2); } if($count == 3) { $t->ok; } else { $t->not_ok("while loop didn't work"); } $t->done; %> Apache-ASP-2.63/t/raw_include.inc0000644000175000017500000000001011721310312014564 0ustar jobjob1..1 ok Apache-ASP-2.63/t/end_redirect_basic.inc0000644000175000017500000000021011721310312016062 0ustar jobjob1<% ; # the output of this script should just be '', or nothing $Response->Redirect('NULL.asp'); die("should never get here"); %> 2 Apache-ASP-2.63/t/load.t0000644000175000017500000000142611721310312012715 0ustar jobjobuse Apache::ASP::CGI; use lib '.'; use lib qw(t); use T; my $t = T->new(); use Carp; chdir('t'); $SIG{__DIE__} = \&Carp::confess; $main::TestLoad = 0; Apache::ASP->Loader('load.inc', undef, Debug => 1, Execute => 1); $t->eok($main::TestLoad, "failed to execute load.inc while loading"); my $error_mark; { # Apache::ASP->Loader() uses warn() aliased to Apache::ASP::Warn() to put out error messages $^W = 0; local *Apache::ASP::Warn = sub { my $log_output = join("", @_); if($log_output =~ /not_scoped_variable/is) { $error_mark = $log_output; } else { warn(@_); } }; $^W = 1; Apache::ASP->Loader('load_error.inc', undef, Debug => 1, UseStrict => 1); } $t->eok($error_mark, "failed to catch compile error of load_error.inc while loading"); $t->done; Apache-ASP-2.63/t/include_change.inc0000644000175000017500000000006511721310312015232 0ustar jobjob Apache-ASP-2.63/t/mail_error.t0000644000175000017500000000073711721310312014135 0ustar jobjob#!/usr/local/bin/perl use Apache::ASP::CGI; use strict; $^W = 1; &Apache::ASP::CGI::do_self(NoState => 1, UseStrict => 1); __END__ <% my $out = $Response->TrapInclude('Share::CORE/MailErrors.inc'); $t->eok(length($$out) > 50, "MailErrors.inc"); $t->eok(sub { $$out =~ /Subject: Apache::ASP Errors for t\Wmail_error\.t/s }, "MailError.inc Subject"); for my $key ( qw ( GLOBAL FILE QUERY FORM ) ) { $t->eok( sub { $$out =~ /$key/s }, "MailErrors.inc Field $key" ); } %> Apache-ASP-2.63/t/end_basic.inc0000644000175000017500000000015211721310312014206 0ustar jobjob1<% ; # the output of this script should just be 1 $Response->End; die("should never get here"); %> 2 Apache-ASP-2.63/t/end.t0000644000175000017500000000306111721310312012541 0ustar jobjob use Apache::ASP::CGI::Test; use strict; use File::Basename qw(basename dirname); sub my::null {}; my $dir = dirname($0); if($dir) { chdir($dir) || die "can't chdir to $dir"; } my %args = ( NoState => 1, XMLSubsMatch => 'my:\w+', Global => 'null', UseStrict => 1, # Debug => -1, ); my @tests = ( [ 'end_basic.inc', sub { $_->test_body_out eq '1' } ], [ 'end_clear.inc', sub { $_->test_body_out eq '' }, ], [ 'end_redirect_basic.inc', sub { $_->test_header_out =~ /Location: NULL/ and $_->test_body_out eq '' } ], [ 'end_redirect_soft.inc', sub { $_->test_header_out =~ /Location: NULL/ and $_->test_body_out =~ /^12/ }, { SoftRedirect => 1 } ], [ 'end_xmlsubs_basic.inc', sub { $_->test_body_out eq '1' } ], [ 'end_xmlsubs_redirect.inc', sub { $_->test_header_out =~ /Location: NULL/ and $_->test_body_out eq '' } ], ); print "1..".scalar(@tests)."\n"; for my $tester (@tests) { my($file, $test, $args) = @$tester; $args ||= {}; my $r = Apache::ASP::CGI::Test->init($file); $r->init_dir_config( %args, %$args ); my $status = Apache::ASP->handler($r); unless($status == 0) { $r->log_error("[failure] error status $status for $file"); next; } # print $r->test_header_out."\n\n"; # print $r->test_body_out."\n\n"; local $_ = $r; if(eval { &$test }) { print "ok\n"; } else { $r->log_error("[failure] $0 subtest $file failed, output:\n---\n".$r->OUT."\n---\n"); print "not ok\n"; } } Apache-ASP-2.63/t/strict_error.inc0000644000175000017500000000003111721310312015014 0ustar jobjob<% $MyStrictError++; %> Apache-ASP-2.63/t/transfer.inc0000644000175000017500000000023411721310312014124 0ustar jobjob <% $t->eok($0 =~ /transfer\.inc$/ ? 1 : 0, "\$0 is not correct: $0"); $Server->Transfer({ File => 'transfer2.inc' }); die("should never get here"); %> Apache-ASP-2.63/t/include_return.inc0000644000175000017500000000003311721310312015317 0ustar jobjob<% return(1, 2); %> Apache-ASP-2.63/t/dynamic_include_change.inc0000644000175000017500000000007311721310312016735 0ustar jobjob<% $Response->Include("include_change_piece.inc_temp"); %> Apache-ASP-2.63/t/asp_object.t0000644000175000017500000000146311721310312014110 0ustar jobjobuse Apache::ASP::CGI; use lib qw(t .); use T; use strict; $SIG{__DIE__} = \&Carp::confess; chdir('t'); my $r = Apache::ASP::CGI->init('asp_object.t'); my %config = ( # Debug => -3, NoState => 0, ); for(keys %config) { $r->dir_config->set($_, $config{$_}); } my $t = T->new; my $ASP_1 = Apache::ASP->new($r); #$ASP_1->Out($ASP_1); $t->eok($ASP_1->Session && $ASP_1->Application, "ASP Objects 1"); my $app_1 = $ASP_1->Application; my $ASP_2 = Apache::ASP->new($r); $t->eok($ASP_2->Session && $ASP_2->Application, "ASP Objects 2"); my $app_2 = $ASP_2->Application; $app_1->{Test} = 'OK'; $t->eok($app_2->{Test} eq 'OK', "Application data OK pre DESTROY"); $ASP_1->DESTROY; $t->eok($app_2->{Test} eq 'OK', "Application data OK post DESTROY"); $t->done; Apache-ASP-2.63/t/inode_names.t0000644000175000017500000000152011721310312014252 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1, InodeNames => 0, UseStrict => 1); __END__ <% use File::Basename qw(basename); use strict; my $ASP = $Server->{asp}; my $file_id1 = $ASP->FileId(basename($Server->File)); $t->eok(sub { $file_id1 =~ /^__ASP_inode_names_tx.{32}$/ }, "basename FileId()"); my $file_id2 = $ASP->FileId('abc'x200); $t->eok(sub { $file_id2 =~ /abcx/ and length($file_id1) < 120 }, "long name FileId()"); my $file_id3 = ''; if(my $stat = (stat('.'))[1]) { # need both here, inode_names is not cached at new() time $ASP->{r}->dir_config->set('InodeNames', 1); $ASP->{inode_names} = 1; $file_id3 = $ASP->FileId(basename($Server->File)); $t->eok(sub { $file_id3 =~ /DEV.+_INODE.+/ }, "InodeNames FileId()"); } $t->eok(length($ASP->{compile_checksum}) == 32, "Compile Checksum"); %> Apache-ASP-2.63/t/share.t0000644000175000017500000000113711721310312013077 0ustar jobjob#!/usr/local/bin/perl use Apache::ASP::CGI; #use lib qw(. ..); #use ASP; &Apache::ASP::CGI::do_self( # Debug => -1 NoState => 1, ); __END__ <% $t->eok($Apache::ASP::ShareDir, '$ShareDir variable not defined'); $t->eok($Server->MapInclude('Share::CORE/MailErrors.inc'), "MapInclude() for Share::CORE/MailErrors.inc should succeed"); $t->eok(! $Server->MapInclude('CORE/MailErrors.inc'), "MapInclude() for CORE/MailErrors.inc should not succeed without Share:: prefix"); $t->eok(! $Server->MapInclude('Share::CORE/NEVER EXIST'), "MapInclude() for Share::CORE/NEVER EXIST should fail"); %> Apache-ASP-2.63/t/include_change_piece.inc_temp0000644000175000017500000000000113132333454017424 0ustar jobjob2Apache-ASP-2.63/t/raw_include.t0000644000175000017500000000022611721310312014267 0ustar jobjob use Apache::ASP::CGI; &Apache::ASP::CGI::do_self(Global => 'null', NoState => 1, Debug => 0); __END__ <% $Response->Include('raw_include.inc'); %> Apache-ASP-2.63/t/application.t0000644000175000017500000000133211721310312014275 0ustar jobjob#!/usr/local/bin/perl use Apache::ASP::CGI; use strict; $SIG{__DIE__} = \&Carp::confess; &Apache::ASP::CGI::do_self( # Debug => -1 ); __END__ <% for(1..10) { $Application->UnLock; } $t->eok(sub { $Application->Lock }, '$Application->Lock'); $t->eok($Application->{Start}, 'Application_OnStart did not run'); my $count = 0; $Application->{count} = 0; for(1..3) { $Application->{count}++; $count++; $t->eok($count == $Application->{count}, 'failure to increment $Application->{count}'); } $t->eok(sub { $Application->UnLock }, '$Application->UnLock'); #$t->eok($Application->SessionCount(), '$Application->SessionCount()'); $t->eok($Application->GetSession($Session->{SessionID}), '$Application->GetSession()'); %> Apache-ASP-2.63/t/taint_check.t0000644000175000017500000000075311721310312014254 0ustar jobjob#!/usr/local/bin/perl -T # for some reason on my Solaris 5.00551 perl, doing # use Apache::ASP as opposed to use lib qw(.); use ASP # would make a difference between having an error and # not having one during "make test", really odd # # use Apache::ASP; # use lib qw(blib/lib lib); use Apache::ASP::CGI; use strict; #$SIG{__DIE__} = \&Carp::confess; # print STDERR $^]." $^V $PERL_VERSION --- \n"; &Apache::ASP::CGI::do_self(); __END__ <% $Response->Include('session.inc'); %> Apache-ASP-2.63/t/general.t0000644000175000017500000000033611721310312013412 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(); __END__ <%@ LANGUAGE="PerlScript" %> <% for(@Apache::ASP::Objects) { if(${$_}) { $t->ok; } else { $t->not_ok("object $_ not defined in ASP namespace"); } } %> Apache-ASP-2.63/t/session_serialize.t0000644000175000017500000000026111721310312015524 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( # Debug => 1 # StateDir => '/tmp/asp_test', SessionSerialize => 1, ); __END__ <% $Response->Include('session.inc'); %> Apache-ASP-2.63/t/include_change.t0000644000175000017500000000167511721310312014734 0ustar jobjobuse Apache::ASP::CGI; $SIG{__WARN__} = \&Carp::cluck; local $^W = 1; &Apache::ASP::CGI::do_self('NoState' => 1, Debug => 0, UseStrict => 0); __END__ <% use lib '.'; use T; $t =T->new(); %> <% for my $temp ( 1..2 ) { %> <% $Response->Debug("writing temp include piece of $temp"); open(PIECE, ">include_change_piece.inc_temp"); print PIECE $temp; close PIECE; sleep 1; for my $type ( qw( inline dynamic inline dynamic ) ) { $Response->Debug("--- temp: $temp, type: $type"); my $out = $Response->TrapInclude($type."_include_change.inc"); $$out =~ s/\s+$//isg; $t->eok(($$out eq $temp), "Failed to match output of $$out to expected $temp for type: $type"); $Response->Debug("--- output: $$out"); } %> <% } %> <% $t->eok($Server->{asp}{parse_file_count} == 6, "parse_file_count check failed"); $t->eok($Server->{asp}{parse_inline_count} == 2, "parse_inline_count check failed"); %> Apache-ASP-2.63/t/request.t0000644000175000017500000000056711721310312013473 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( NoState => 1 ); __END__ <% use lib '.'; use T; $t =T->new(); %> <% if(%{$Request->ServerVariables()}) { $t->ok(); } else { $t->not_ok('could not get the environment / server variables'); } # $Request->{Method}, defaults to GET $t->eok($Request->{Method} eq 'GET', "\$Request->{Method} eq 'GET'"); %> <% $t->done; %> Apache-ASP-2.63/t/server.t0000644000175000017500000000326211721310312013304 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1, Debug => 0); $SIG{__DIE__} = \&Carp::confess; __END__ <% use lib '.'; use T; $t =T->new(); %> <% my $encode = $Server->URLEncode("test data"); if($encode eq 'test%20data') { $t->ok(); } else { $t->not_ok('URLEncode not working'); } $Server->Config('Global', '.'); $t->eok(sub { $Server->Config('Global') eq '.' }, 'Global must be defined as . for test' ); my $config = $Server->Config; $t->eok($config->{Global} eq '.', 'Full config as hash'); $t->eok($Server->URL('test.asp', { 'test ' => ' value ' } ) eq 'test.asp?test%20=%20value%20', 'basic $Server->URL() encoding did not work' ); $t->eok($Server->URL('test.asp', { 'test' => ['value', 'value2'] }) eq 'test.asp?test=value&test=value2', 'multi params $Server->URL() encoding did not work' ); $t->eok($Server->URL('test.asp') eq 'test.asp', 'no args $Server->URL() encoding did not work' ); my $html = q(&"<>'abc); my $final = '&"<>'abc'; my $result = $Server->HTMLEncode($html); $t->eok($result eq $final, "\$Server->HTMLEncode('$html')"); my $ref_result = $Server->HTMLEncode(\$html); $t->eok(\$html eq $ref_result, "\$Server->HTMLEncode(\\\$html) should output same ref as going in"); $t->eok($html eq $final, "$html does not equal $final"); $t->eok($Server->MapInclude('server.t') eq './server.t', "Find executing script in Includes path"); $t->eok($Server->File =~ /server.t$/, "\$Server->File does not match"); #use Benchmark; #my $htmlbig = '&"<>' x 25000; #timethis(10, sub { my $copy = $htmlbig; $copy = $Server->HTMLEncode($copy) }); #timethis(10, sub { my $copy = $htmlbig; $Server->HTMLEncode(\$copy) }); $Server->Transfer('transfer.inc'); %> Apache-ASP-2.63/t/transfer2.inc0000644000175000017500000000013111721310312014202 0ustar jobjob <% $t->eok($0 =~ /transfer2\.inc$/ ? 1 : 0, "\$0 is not correct: $0"); $t->done; %> Apache-ASP-2.63/t/end_redirect_soft.inc0000644000175000017500000000015211721310312015761 0ustar jobjob1<% ; # output of this script should be '12' with a redirect $Response->Redirect('NULL.asp'); %>2 Apache-ASP-2.63/t/end_xmlsubs_redirect.inc0000644000175000017500000000023711721310312016507 0ustar jobjob1 2<% ; # the output of this script should just be '' with a Location: NULL.asp header $Response->Redirect('NULL.asp'); %>3 4 Apache-ASP-2.63/t/session_events.t0000644000175000017500000000517111721310312015046 0ustar jobjob#!/usr/local/bin/perl use lib qw(. .. t); use Apache::ASP::CGI; use T; use strict; use File::Basename qw(dirname basename); #$SIG{__DIE__} = \&Carp::confess; #$SIG{__WARN__} = \&Carp::cluck; $SIG{__WARN__} = sub { }; $0 =~ /^(.*)$/; $0 = $1; chdir(dirname($0)); $0 = basename($0); my $t = T->new(); my %config = ( 'NoState' => 0, 'SessionTimeout' => 20, 'Debug' => 0, 'SessionCount' => 1, 'Global' => 'session_events', 'SessionQuery' => 1, ); my $r = Apache::ASP::CGI->init($0); map { $r->dir_config->set($_, $config{$_}) } keys %config; my $ASP = Apache::ASP->new($r); $ASP->Session->{MARK} = 1; #print STDERR "HERE\n"; #sleep 5; my @sessions = keys %{$ASP->Application}; #&session_count_ok($ASP, scalar(@sessions)); # cleanup old sessions for my $session_id ( @sessions ) { next if ($session_id eq $ASP->Session->SessionID); my $Session = $ASP->Application->GetSession($session_id); $Session->Abandon; } $ASP->{Internal}{CleanupMaster} = undef; $ASP->CleanupGroups('PURGE'); $ASP->{Internal}{SessionCount} = 1; &session_count_ok($ASP, 1); $ASP->Session->Abandon; &session_count_ok($ASP, 1); $ASP->CleanupGroups('PURGE'); &session_count_ok($ASP, 0); $ASP->DESTROY; for(1..10) { $ASP = Apache::ASP->new($r); &session_count_ok($ASP, $_); $ASP->DESTROY; } $ASP = Apache::ASP->new($r); &session_count_ok($ASP, 11); $ASP->Session->Abandon; $ASP->CleanupGroups('PURGE'); &session_count_ok($ASP, 10); $ASP->DESTROY; # Session_OnEnd test repeat on expired session { my $abandon_session_id; $ASP = Apache::ASP->new($r); $ASP->Session->{WriteMark}++; $ASP->Session->Abandon(); $abandon_session_id = $ASP->Session->SessionID; # print STDERR $ASP->Session->SessionID."\n"; # do not PURGE cleanup here, let next script get initialized with old session id $ASP->DESTROY; local $ENV{QUERY_STRING} = 'session-id='.$abandon_session_id; $ASP = Apache::ASP->new($r); $t->eok($abandon_session_id ne $ASP->Session->SessionID, "abandoned session restored"); $ASP->Session->Abandon(); # print STDERR $ASP->Session->SessionID."\n"; $ASP->CleanupGroups('PURGE'); $ASP->DESTROY; $ASP = Apache::ASP->new($r); $t->eok($abandon_session_id ne $ASP->Session->SessionID, "abandoned session restored"); $ASP->Session->Abandon(); # print STDERR $ASP->Session->SessionID."\n"; $ASP->CleanupGroups('PURGE'); $ASP->DESTROY; } $t->done; ## helpers sub session_count_ok { my($ASP, $count) = @_; $t->eok($ASP->Application->SessionCount == $count, "$count sessions should have been counted, found ".$ASP->Application->SessionCount); } Apache-ASP-2.63/t/include_dir_error.t0000644000175000017500000000037711721310312015474 0ustar jobjobuse Apache::ASP::CGI; use strict; &Apache::ASP::CGI::do_self(NoState => 1); __END__ <% eval { $Response->TrapInclude('.'); }; $t->eok($@, "should be error"); eval { $Response->TrapInclude('include.inc'); }; $t->eok(! $@, "should not be error"); %> Apache-ASP-2.63/t/include_runtime.t0000644000175000017500000000065711721310312015171 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self('NoState' => 1); __END__ <% use lib '.'; use T; $t =T->new(); %> <% use vars qw($ok); $ok = 0; my $script = "<\% \$ok++; %\>"; $Response->Include(\$script); $t->eok($ok == 1, "Could not increment \$ok"); $script = "<\% my \$ok = 'ok'; %\><\%= \$ok %\>"; my $out = $Response->TrapInclude(\$script); $t->eok($$out eq 'ok', "Could not print 'ok' in runtime TrapInclude()"); %> Apache-ASP-2.63/t/asp-perl/0000755000175000017500000000000013252400404013334 5ustar jobjobApache-ASP-2.63/t/asp-perl/asp.conf0000644000175000017500000000022011721310311014754 0ustar jobjob use File::Basename qw(dirname); my $dirname = dirname($0); $main::ASP_CONF_MARK = 1; %Config = ( Global => '.', # Debug => -3, ); Apache-ASP-2.63/t/asp-perl/global.asa0000644000175000017500000000014011721310311015251 0ustar jobjobsub Script_OnStart { print "1..2\n"; if($main::ASP_CONF_MARK) { print "ok\n"; } } Apache-ASP-2.63/t/asp-perl/ok.inc0000644000175000017500000000001611721310311014431 0ustar jobjob<%= "ok\n" %> Apache-ASP-2.63/t/req_params_none.t0000644000175000017500000000043511721310312015146 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( NoState => 1); __END__ <% use lib '.'; use T; $t =T->new(); %> <% eval { my $Params = $Request->Params(); }; $t->eok($@ && ( $@ =~ /Request.*Params does not exist/i ), "Error message for NULL \$Request->Params"); %> <% $t->done; %> Apache-ASP-2.63/t/response.t0000644000175000017500000000272711721310312013641 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1); __END__ <% use lib '.'; use T; $t =T->new(); # IsClientConnected Tests $t->eok($Response->{IsClientConnected}, "\$Response->{IsClientConnected}"); $t->eok($Response->IsClientConnected, "\$Response->IsClientConnected"); $Server->{asp}{r}->connection->aborted(1); $Response->Flush; # updates {IsClientConnected} $t->eok(! $Response->{IsClientConnected}, "\$Response->{IsClientConnected} after aborted/Flush()"); $t->eok(! $Response->IsClientConnected, "\$Response->IsClientConnected after aborted"); # AddHeader() member setting my $date = &Apache::ASP::Date::time2str($time); $Response->AddHeader('expires', $date); $t->eok($Response->{ExpiresAbsolute} eq $date, "\$Response->AddHeader('Expires', ...) did not set ExpiresAbsolute member"); $Response->AddHeader('Content-type', 'text/plain'); $t->eok($Response->{ContentType} eq 'text/plain', "\$Response->AddHeader('Content-Type', ...) did not set ContentType member"); $Response->AddHeader('Cache-Control', 'no-cache'); $t->eok($Response->{CacheControl} eq 'no-cache', "\$Response->AddHeader('Cache-Control', ...) did not set CacheControl member"); # reset $Server->{asp}{r}->connection->aborted(0); $Response->{IsClientConnected} = 1; $t->eok($Response->IsClientConnected, "\$Response->IsClientConnected after reset"); $t->{t} += 3; $t->done; $Response->Write(""); %> ok ok <% print "ok\n"; # $Response->AppendToLog("logging ok"); # $Response->Debug("logging ok"); %> Apache-ASP-2.63/t/xmlsubsmatch.t0000644000175000017500000000046411721310312014511 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( XMLSubsMatch => '(aaa|bbb):(?:[a-z]|[0-9])+', NoState => 1, UseStrict => 1, BufferingOn => 0, # Debug => -3, ); __END__ <% sub aaa::a2z { $t->ok }; sub bbb::a2z { $t->ok }; %> asdfdsaf Apache-ASP-2.63/t/global_event_end.t0000644000175000017500000000021311721310312015256 0ustar jobjob#!/usr/bin/perl use Apache::ASP::CGI; &Apache::ASP::CGI::do_self(Global => 'global_event_end', NoState => 1); __END__ <% $t->not_ok; %> Apache-ASP-2.63/t/xmlsubs_aspargs.t0000644000175000017500000000205111721310312015206 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self( XMLSubsMatch => 'my:[\w\-]+', NoState => 1, UseStrict => 1, Debug => 0, XMLSubsPerlArgs => 'Off', ); __END__ <% my $ref = { ok => 1, ref => \'data' } ; %> ok <% $t->eok($Deep == 3, "Deep tag to call twice"); %> Apache-ASP-2.63/t/end_clear.inc0000644000175000017500000000015311721310312014214 0ustar jobjob1<% ; # the output of this script should just be '', or nothing $Response->Clear; $Response->End; %> 2 Apache-ASP-2.63/t/server_transfer.t0000644000175000017500000000034511721310312015207 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 1, Debug => 0, UseStrict=>1); $SIG{__DIE__} = \&Carp::confess; __END__ <% use lib '.'; use T; $t =T->new(); %> <% $Server->Transfer('server_transfer.inc', 'TEST'); %> Apache-ASP-2.63/t/global_event_end/0000755000175000017500000000000013252400404015100 5ustar jobjobApache-ASP-2.63/t/global_event_end/global.asa0000644000175000017500000000024511721310311017023 0ustar jobjob use vars qw($t); use lib qw(.); use T; sub Script_OnStart { $t = T->new; $t->ok; $Response->End; $t->not_ok; } sub Script_OnEnd { $t->done; } Apache-ASP-2.63/t/collection.t0000644000175000017500000000245611721310312014135 0ustar jobjobuse Apache::ASP::CGI; &Apache::ASP::CGI::do_self(NoState => 0); __END__ <% for('Form', 'QueryString') { %{$Request->{$_}} = (); # basic assignment & lookup my $self = $t->eok($Request->$_(), "no collection for $_ found"); $Request->$_('test', 'value'); $t->eok($self->{'test'} eq 'value', "count not set value"); $t->eok($Request->$_('test') eq 'value', "could not fetch value"); # array assignment & lookup $self->{'array'} = [1,0,2]; my @values = $Request->$_('array'); $t->eok(@values == 3, 'array block lookup test failed'); my $value = $Request->$_('array'); $t->eok($value == 1, 'array single lookup test failed'); # Count() & Key() tests $t->eok($Request->$_()->Count == 2, 'collection count failed'); my $key = $Request->$_()->Key(1); $t->eok($key eq 'array', "key lookup failed for 1st item, got $key of keys ". join(',', sort keys %{$Request->{$_}})); # Item syntax $t->eok($Request->$_()->Item('test') eq 'value', '$Collection->Item(key) lookup syntax'); $Request->$_()->Item('test', 'value2'); $t->eok($self->{'test'} eq 'value2', '$Collection->Item(key, value) assignment syntax'); } $Application->{contents} = 1; $t->eok($Application->Contents('contents'), '$Collection->Contents(key) lookup syntax'); %> Apache-ASP-2.63/MANIFEST0000644000175000017500000001232713252400404012504 0ustar jobjobASP.pm CHANGES MANIFEST Makefile.PL README asp-perl build/asp.conf build/build.sh build/build_ads.sh build/cgi.html build/changes.html build/config.html build/eg/index.html build/events.html build/faq.html build/global/SiteTags.pm build/global/ad.inc build/global/box.inc build/global/global.asa build/global/index_extra.inc build/global/testimonial.inc build/global/testimonials.inc build/global/top.inc build/index.html build/install.html build/kudos.html build/license.html build/objects.html build/perlscript.html build/resources.html build/sessions.html build/sites.html build/ssi.html build/style.html build/support.html build/syntax.html build/testimonials.html build/todo.html build/tuning.html build/xml.html editors/aasp.vim editors/mmm-asp-perl.el lib/Apache/ASP/ApacheCommon.pm lib/Apache/ASP/Application.pm lib/Apache/ASP/CGI.pm lib/Apache/ASP/CGI/Table.pm lib/Apache/ASP/CGI/Test.pm lib/Apache/ASP/Collection.pm lib/Apache/ASP/CollectionItem.pm lib/Apache/ASP/Date.pm lib/Apache/ASP/Error.pm lib/Apache/ASP/GlobalASA.pm lib/Apache/ASP/Lang/PerlScript.pm lib/Apache/ASP/Load.pm lib/Apache/ASP/Request.pm lib/Apache/ASP/Response.pm lib/Apache/ASP/STDERR.pm lib/Apache/ASP/Server.pm lib/Apache/ASP/Session.pm lib/Apache/ASP/Share/CORE.pm lib/Apache/ASP/Share/CORE/MailErrors.inc lib/Apache/ASP/Share/CORE/MailErrorsHTML.inc lib/Apache/ASP/StatINC.pm lib/Apache/ASP/State.pm lib/Apache/ASP/StateManager.pm lib/Bundle/Apache/ASP.pm lib/Bundle/Apache/ASP/Extra.pm make_httpd/build_httpds.sh site/apache_asp.gif site/apache_asp_small_trans.GIF site/apps/bookmarks/.htaccess site/apps/bookmarks/bookmarks.asp site/apps/bookmarks/dummy.asp site/apps/bookmarks/footer.inc site/apps/bookmarks/global.asa site/apps/bookmarks/header.inc site/apps/bookmarks/index.asp site/apps/search/.htaccess site/apps/search/global.asa site/apps/search/index.asp site/apps/search/source.asp site/articles/flow.gif site/articles/perlmonth1_intro.html site/articles/perlmonth2_build.html site/articles/perlmonth3_tune.html site/asptitlelogo.gif site/cgi.html site/changes.html site/cine.gr.gif site/communication_software.gif site/concept_online.gif site/config.html site/eg/.bhtaccess site/eg/.htaccess site/eg/DemoASP.pm site/eg/application.asp site/eg/asp.conf site/eg/binary_write.htm site/eg/cgi.htm site/eg/compile_error.inc site/eg/cookieless_session.asp site/eg/counting.htm site/eg/default.htm site/eg/dynamic_includes.htm site/eg/error_document.htm site/eg/file_upload.asp site/eg/filter.filter site/eg/footer.inc site/eg/form.asp site/eg/formfill.asp site/eg/global.asa site/eg/global_asa_demo.asp site/eg/header.inc site/eg/include.htm site/eg/index.htm site/eg/index.html site/eg/register_cleanup.asp site/eg/response.asp site/eg/row.inc site/eg/server.htm site/eg/server_variables.htm site/eg/session.asp site/eg/session_query_parse.asp site/eg/source.asp site/eg/source.inc site/eg/ssi_filter.ssi site/eg/syntax_error.asp site/eg/table.inc site/eg/template.xsl site/eg/test.gif site/eg/transfer.htm site/eg/xml_subs.asp site/eg/xml_subs_strict.asp site/eg/xslt.xml site/events.html site/faq.html site/index.html site/install.html site/kudos.html site/license.html site/nodecheck_button.gif site/objects.html site/oreilly_oscon2001_speaker.gif site/oscon2000_speaker.gif site/perlscript.html site/pixel.gif site/planetofmusic.com.gif site/powered_by_apache_asp.jpg site/powered_by_modperl.gif site/rectangle_power_perl.gif site/redhat_logo.gif site/resources.html site/robots.txt site/sessions.html site/sites.html site/ssi.html site/style.html site/support.html site/syntax.html site/testimonials.html site/todo.html site/top.inc site/tuning.html site/webtimelogo.jpg site/xml.html t/T.pm t/application.t t/asp-perl/asp.conf t/asp-perl/global.asa t/asp-perl/ok.inc t/asp-perl1.t t/asp-perl2.t t/asp_object.t t/cache.t t/cache_test.inc t/cgi_headers.t t/closure.inc t/closure.t t/collection.t t/collectionitem.t t/cookies.t t/dynamic_include_change.inc t/end.t t/end_basic.inc t/end_clear.inc t/end_redirect_basic.inc t/end_redirect_soft.inc t/end_xmlsubs_basic.inc t/end_xmlsubs_redirect.inc t/general.t t/global.asa t/global_event_end.t t/global_event_end/global.asa t/include.inc t/include.t t/include_asp.inc t/include_change.inc t/include_change.t t/include_change_piece.inc_temp t/include_code.inc t/include_code2.inc t/include_dir_error.t t/include_return.inc t/include_runtime.t t/inline_include_change.inc t/inode_names.t t/load.inc t/load.t t/load_error.inc t/long_names.t t/loops.t t/mail_error.t t/no_cache.inc t/no_cache.t t/null/global.asa t/null/ok.inc t/raw.t t/raw_include.inc t/raw_include.t t/reload_global_asa.t t/req_params_none.t t/request.t t/response.t t/response_end.t t/same_name.t t/same_name/test1/test.asp t/same_name/test2/test.asp t/server.t t/server_mail.t t/server_transfer.inc t/server_transfer.t t/session.inc t/session.t t/session_events.t t/session_events/global.asa t/session_query_parse.t t/session_serialize.t t/share.t t/stat_inc.t t/strict_error.inc t/strict_error.t t/taint_check.t t/transfer.inc t/transfer2.inc t/unique_packages.inc t/unique_packages.t t/xmlsubs.t t/xmlsubs_aspargs.t t/xmlsubs_perlargs.t t/xmlsubsmatch.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Apache-ASP-2.63/lib/0000755000175000017500000000000013252400404012114 5ustar jobjobApache-ASP-2.63/lib/Bundle/0000755000175000017500000000000013252400404013325 5ustar jobjobApache-ASP-2.63/lib/Bundle/Apache/0000755000175000017500000000000013252400404014506 5ustar jobjobApache-ASP-2.63/lib/Bundle/Apache/ASP.pm0000755000175000017500000000106711721310312015473 0ustar jobjobpackage Bundle::Apache::ASP; $VERSION = '1.10'; 1; __END__ =head1 NAME Bundle::Apache::ASP - Install Apache::ASP and required =head1 SYNOPSIS perl -MCPAN -e 'install Bundle::Apache::ASP' =head1 CONTENTS MLDBM - This is used for reading and writing multi-level hashes on disk Digest::MD5 - 32 byte hash algorithm for cookie session-id MLDBM::Sync - Enables safe concurrent access to MLDBM databases. Apache::ASP - A perl ASP port to Apache =head1 DESCRIPTION This bundle contains modules used by Apache::ASP. =head1 AUTHOR Joshua Chamas Apache-ASP-2.63/lib/Bundle/Apache/ASP/0000755000175000017500000000000013252400404015131 5ustar jobjobApache-ASP-2.63/lib/Bundle/Apache/ASP/Extra.pm0000644000175000017500000000243012336747511016570 0ustar jobjobpackage Bundle::Apache::ASP::Extra; $VERSION = '1.03'; 1; __END__ =head1 NAME Bundle::Apache::ASP::Extra - Install modules that provide additional functionality to Apache::ASP =head1 SYNOPSIS perl -MCPAN -e 'install Bundle::Apache::ASP::Extra' =head1 CONTENTS Bundle::Apache::ASP - Base for Apache::ASP installation CGI - Required for file upload, make test, and command line ./cgi/asp script HTML::Parser - Required for HTML::FillInForm HTML::Clean - Compress text/html with Clean config or $Response->{Clean} set to 1-9 Net::SMTP - Runtime errors can be mailed to the webmaster with MailErrorTo config Devel::Symdump - Used for StatINC setting, which reloads modules dynamically Apache::DBI - Cache database connections per process Compress::Zlib - Gzip compress HTML output on the fly Time::HiRes - Sub second timing of execution with Debug 3 or -3 enabled HTML::FillInForm - FormFill functionality which autofills HTML forms from form data HTML::SimpleParse - Required for SSI filtering with Apache::SSI XML::XSLT - Required for XSLT support. May also use XML::Sablotron and XML::LibXSLT for this, which are not part of this bundle. =head1 DESCRIPTION This bundle contains extra modules used by Apache::ASP. =head1 AUTHOR Joshua Chamas Apache-ASP-2.63/lib/Apache/0000755000175000017500000000000013252400403013274 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/0000755000175000017500000000000013252400404013720 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/Lang/0000755000175000017500000000000013252400404014601 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/Lang/PerlScript.pm0000644000175000017500000000021611721310312017222 0ustar jobjobpackage Apache::ASP::Lang::PerlScript; sub new { my($class, %args) = shift; bless \%args, $class; }; sub CommentStart { '#' }; 1; Apache-ASP-2.63/lib/Apache/ASP/Session.pm0000644000175000017500000001715411721310312015706 0ustar jobjob package Apache::ASP::Session; use Apache::ASP::State; use strict; no strict qw(refs); use vars qw(@ISA); @ISA = qw(Apache::ASP::Collection); # allow to pass in id so we can cleanup other sessions with # the session manager sub new { my($asp, $id, $perms, $no_error) = @_; my($state, %self, $started); my $internal = $asp->{Internal}; # if we are passing in the id, then we are doing a # quick session lookup and can bypass the normal checks # this is useful for the session manager and such if($id) { $internal->LOCK; $state = Apache::ASP::State::new($asp, $id, undef, $perms, $no_error); # $state->Set() || $asp->Error("session state get failed"); if($state) { tie %self, 'Apache::ASP::Session', { state=>$state, asp=>$asp, id=>$id, }; $internal->UNLOCK; return bless \%self; } else { $internal->UNLOCK; return; } } # lock down so no conflict with garbage collection $internal->LOCK(); if($id = $asp->SessionId()) { my $idata = $internal->{$id}; # $asp->Debug("internal data for session $id", $idata); if($idata && ! $idata->{'end'} ) { # user is authentic, since the id is in our internal hash if($idata->{timeout} > time()) { # refresh and unlock as early as possible to not conflict # with garbage collection $asp->RefreshSessionId($id); $state = Apache::ASP::State::new($asp, $id); $internal->UNLOCK(); # session not expired $asp->{dbg} && $asp->Debug("session not expired",{'time'=>time(), timeout=>$idata->{timeout}}); if($asp->{paranoid_session}) { local $^W = 0; # by testing for whether UA was set to begin with, we # allow a smooth upgrade to ParanoidSessions $state->WriteLock() if $asp->{session_serialize}; my $state_ua = $state->FETCH('_UA'); if(defined($state_ua) and $state_ua ne $asp->{'ua'}) { $asp->Log("[security] hacker guessed id $id; ". "user-agent ($asp->{'ua'}) does not match ($state_ua); ". "destroying session & establishing new session id" ); $state->Init(); undef $state; goto NEW_SESSION_ID; } } $started = 0; } else { # expired, get & reset $internal->{$id} = { %{$internal->{$id}}, 'end' => 1 }; $internal->UNLOCK(); # remove this section, allow lazy cleanup, this caused a bug # in which sessions cleared in this way, but didn't have their files cleaned up # would have their timeout restored later # # $asp->Debug("session $id timed out, clearing"); # $asp->{GlobalASA}->SessionOnEnd($id); # $internal->LOCK(); # delete $internal->{$id}; # $internal->UNLOCK(); # we need to create a new state now after the clobbering # with SessionOnEnd goto NEW_SESSION_ID; } } else { # never seen before, maybe session garbage collected already # or coming in from querystringed search engine # wish we could do more # but proxying + nat prevents us from securing via ip address goto NEW_SESSION_ID; } } else { # give user new session id, we must lock this portion to avoid # concurrent identical session key creation, this is the # only critical part of the session manager NEW_SESSION_ID: my($trys); for(1..10) { $trys++; $id = $asp->Secret(); if($internal->{$id}) { $id = ''; } else { last; } } $id && $asp->RefreshSessionId($id, {}); $asp->{Internal}->UNLOCK(); $asp->Log("[security] secret algorithm is no good with $trys trys") if ($trys > 3); $asp->Error("no unique secret generated") unless $id; $asp->{dbg} && $asp->Debug("new session id $id"); $asp->SessionId($id); $state = &Apache::ASP::State::new($asp, $id); # $state->Set() || $asp->Error("session state set failed"); if($asp->{paranoid_session}) { $asp->Debug("storing user-agent $asp->{'ua'}"); $state->STORE('_UA', $asp->{'ua'}); } $started = 1; } if(! $state) { $asp->Error("can't get state for id $id"); return; } $state->WriteLock() if $asp->{session_serialize}; $asp->Debug("tieing session $id"); tie %self, 'Apache::ASP::Session', { state=>$state, asp=>$asp, id=>$id, started=>$started, }; if($started) { $asp->{dbg} && $asp->Debug("clearing starting session"); if($state->Size > 0) { $asp->{dbg} && $asp->Debug("clearing data in old session $id"); %self = (); } } bless \%self; } sub TIEHASH { my($package, $self) = @_; bless $self; } # stub so we don't have to test for it in autoload sub DESTROY { my $self = shift; # wrapped in eval to suppress odd global destruction error messages # in perl 5.6.0, --jc 5/28/2001 return unless eval { $self->{state} }; $self->{state}->DESTROY; undef $self->{state}; %$self = (); } # don't need to skip DESTROY since we have it here # return if ($AUTOLOAD =~ /DESTROY/); sub AUTOLOAD { my $self = shift; my $AUTOLOAD = $Apache::ASP::Session::AUTOLOAD; $AUTOLOAD =~ s/^(.*)::(.*?)$/$2/o; $self->{state}->$AUTOLOAD(@_); } sub FETCH { my($self, $index) = @_; # putting these comparisons in a regexp was a little # slower than keeping them in these 'eq' statements if($index eq '_SELF') { $self; } elsif($index eq '_STATE') { $self->{state}; } elsif($index eq 'SessionID') { $self->{id}; } elsif($index eq 'Timeout') { $self->Timeout(); } else { $self->{state}->FETCH($index); } } sub STORE { my($self, $index, $value) = @_; if($index eq 'Timeout') { $self->Timeout($value); } else { $self->{state}->STORE($index, $value); } } # firstkey and nextkey skip the _UA key so the user # we need to keep the ua info in the session db itself, # so we are not dependent on writes going through to Internal # for this very critical informatioh. _UA is used for security # validation / the user's user agent. sub FIRSTKEY { my $self = shift; my $value = $self->{state}->FIRSTKEY(); if(defined $value and $value eq '_UA') { $self->{state}->NEXTKEY($value); } else { $value; } } sub NEXTKEY { my($self, $key) = @_; my $value = $self->{state}->NEXTKEY($key); if(defined($value) && ($value eq '_UA')) { $self->{state}->NEXTKEY($value); } else { $value; } } sub CLEAR { my $state = shift->{state}; my $ua = $state->FETCH('_UA'); my $rv = $state->CLEAR(); $ua && $state->STORE('_UA', $ua); $rv; } sub SessionID { my $self = shift; tied(%$self)->{id}; } sub Timeout { my($self, $minutes) = @_; if(tied(%$self)) { $self = tied(%$self); } if($minutes) { $self->{asp}{Internal}->LOCK; my($internal_session) = $self->{asp}{Internal}{$self->{id}}; $internal_session->{refresh_timeout} = $minutes * 60; $internal_session->{timeout} = time() + $minutes * 60; $self->{asp}{Internal}{$self->{id}} = $internal_session; $self->{asp}{Internal}->UNLOCK; } else { my($refresh) = $self->{asp}{Internal}{$self->{id}}{refresh_timeout}; $refresh ||= $self->{asp}{session_timeout}; $refresh / 60; } } sub Abandon { shift->Timeout(-1); } sub TTL { my $self = shift; $self = tied(%$self); # time to live is current timeout - time... positive means # session is still active, returns ttl in seconds my $timeout = $self->{asp}{Internal}{$self->{id}}{timeout}; my $ttl = $timeout - time(); } sub Started { my $self = shift; tied(%$self)->{started}; } # we provide these, since session serialize is not # the default... locking around writes will also be faster, # since there will be only one tie to the database and # one flush per lock set sub Lock { tied(%{$_[0]})->{state}->WriteLock(); } sub UnLock { tied(%{$_[0]})->{state}->UnLock(); } 1; Apache-ASP-2.63/lib/Apache/ASP/Request.pm0000644000175000017500000002207211721310312015706 0ustar jobjob package Apache::ASP::Request; use Apache::ASP::Collection; use strict; sub new { my $asp = shift; my $r = $asp->{r}; my $self = bless { asp => $asp, # content => undef, # Cookies => undef, # FileUpload => undef, # Form => undef, # QueryString => undef, # ServerVariables => undef, Method => $r->method || 'GET', TotalBytes => 0, }; # calculate whether to read POST data here my $request_binary_read = &config($asp, 'RequestBinaryRead', undef, 1); $asp->{request_binary_read} = $request_binary_read; # set up the environment, including authentication info my $env = { %{$r->subprocess_env}, %ENV }; if(&config($asp, 'AuthServerVariables')) { if(defined $r->get_basic_auth_pw) { my $c = $r->connection; #X: this needs to be extended to support Digest authentication $env->{AUTH_TYPE} = $c->auth_type; $env->{AUTH_USER} = $c->user; $env->{AUTH_NAME} = $r->auth_name; $env->{REMOTE_USER} = $c->user; $env->{AUTH_PASSWD} = $r->get_basic_auth_pw; } } $self->{'ServerVariables'} = bless $env, 'Apache::ASP::Collection'; # assign no matter what so Form is always defined my $form = {}; my %upload; my $headers_in = $self->{asp}{headers_in}; if($self->{Method} eq 'POST' and $request_binary_read) { $self->{TotalBytes} = defined($ENV{CONTENT_LENGTH}) ? $ENV{CONTENT_LENGTH} : $headers_in->get('Content-Length'); if($headers_in->get('Content-Type') =~ m|^multipart/form-data|) { # do the logic here so that the normal form POST processing will not # occur either $asp->{file_upload_process} = &config($asp, 'FileUploadProcess', undef, 1); if($asp->{file_upload_process}) { if($asp->{file_upload_temp} = &config($asp, 'FileUploadTemp')) { eval "use CGI;"; } else { # default leaves no temp files for prying eyes eval "use CGI qw(-private_tempfiles);"; } if($@) { $self->{asp}->Error("can't use file upload without CGI.pm: $@"); goto ASP_REQUEST_POST_READ_DONE; } # new behavior for file uploads when FileUploadMax is exceeded, # before it used to error abruptly, now it will simply skip the file # upload data local $CGI::DISABLE_UPLOADS = $CGI::DISABLE_UPLOADS; if($asp->{file_upload_max} = &config($asp, 'FileUploadMax')) { if($self->{TotalBytes} > $asp->{file_upload_max} ) { $CGI::DISABLE_UPLOADS = 1; } } $asp->{dbg} && $asp->Debug("using CGI.pm version ". (eval { CGI->VERSION } || $CGI::VERSION). " for file upload support" ); my %form; my $q = $self->{cgi} = new CGI; $asp->Debug($q->param); for(my @names = $q->param) { my @params = $q->param($_); $form{$_} = @params > 1 ? [ @params ] : $params[0]; if(ref($form{$_}) eq 'Fh') { my $fh = $form{$_}; binmode $fh if $asp->{win32}; $upload{$_} = $q->uploadInfo($fh); if($asp->{file_upload_temp}) { $upload{$_}{TempFile} = $q->tmpFileName($fh); $upload{$_}{TempFile} =~ s|^/+|/|; } $upload{$_}{BrowserFile} = "$fh"; $upload{$_}{FileHandle} = $fh; $upload{$_}{ContentType} = $upload{$_}{'Content-Type'}; # tie the file upload reference to a collection... %upload # may be many file uploads note. $upload{$_} = bless $upload{$_}, 'Apache::ASP::Collection'; $asp->{dbg} && $asp->Debug("file upload field processed for \$Request->{FileUpload}{$_}", $upload{$_}); } } $form = \%form; } else { $self->{asp}->Debug("FileUploadProcess is disabled, file upload data in \$Request->BinaryRead"); } } else { # Only tie to STDIN if we have cached contents # don't untie *STDIN until DESTROY, so filtered handlers # have an opportunity to use any cached contents that may exist if(my $len = $self->{TotalBytes}) { $self->{content} = $self->BinaryRead($len) || ''; tie(*STDIN, 'Apache::ASP::Request', $self); #AJAX POSTs are ``application/x-www-form-urlencoded; charset=UTF-8'' in Firefox3+ #by Richard Walsh Nov 25, 2008 (found in nabble) if($headers_in->get('Content-Type') =~ m|^application/x-www-form-urlencoded|) { $form = &ParseParams($self, \$self->{content}); } else { $form = {}; } } } } ASP_REQUEST_POST_READ_DONE: $self->{'Form'} = bless $form, 'Apache::ASP::Collection'; $self->{'FileUpload'} = bless \%upload, 'Apache::ASP::Collection'; my $query = $r->args(); my $parsed_query = $query ? &ParseParams($self, \$query) : {}; $self->{'QueryString'} = bless $parsed_query, 'Apache::ASP::Collection'; if(&config($asp, 'RequestParams')) { $self->{'Params'} = bless { %$parsed_query, %$form }, 'Apache::ASP::Collection'; } # do cookies now my %cookies; if(my $cookie = $headers_in->get('Cookie')) { my @parts = split(/;\s*/, ($cookie || '')); for(@parts) { my($name, $value) = split(/\=/, $_, 2); $name = &Unescape($self, $name); next if ($name eq $Apache::ASP::SessionCookieName); next if $cookies{$name}; # skip dup's $cookies{$name} = ($value =~ /\=/) ? &ParseParams($self, $value) : &Unescape($self, $value); } } $self->{Cookies} = bless \%cookies, 'Apache::ASP::Collection'; $self; } sub DESTROY { my $self = shift; if($self->{cgi}) { # make sure CGI file handles are freed $self->{cgi}->DESTROY(); $self->{cgi} = undef; } for(keys %{$self->{FileUpload}}) { my $upload = $self->{FileUpload}{$_}; $self->{Form}{$_} = undef; if($upload->{FileHandle}) { close $upload->{FileHandle}; # $self->{asp}->Debug("closing fh $upload->{FileHandle}"); } $self->{FileUpload}{$_} = undef; } %$self = (); } # just returns itself sub TIEHANDLE { $_[1] }; # just spill the cache into the scalar, so multiple reads are # fine... whoever is reading from the cached contents must # be reading the whole thing just once for this to work, # which is fine for CGI.pm sub READ { my $self = $_[0]; $_[1] ||= ''; $_[1] .= $self->{content}; $self->{ServerVariables}{CONTENT_LENGTH}; } sub BINMODE { }; # COLLECTIONS, normal, Cookies are special, with the dictionary lookup # directly aliased as this should be faster than autoloading sub Form { shift->{Form}->Item(@_) } sub FileUpload { shift->{FileUpload}->Item(@_) } sub QueryString { shift->{QueryString}->Item(@_) } sub ServerVariables { shift->{ServerVariables}->Item(@_) } sub Params { my $self = shift; $self->{Params} || die("\$Request->Params object does not exist, enable with 'PerlSetVar RequestParams 1'"); $self->{Params}->Item(@_); } sub BinaryRead { my($self, $length) = @_; my $data; return undef unless $self->{TotalBytes}; if(ref(tied(*STDIN)) && tied(*STDIN)->isa('Apache::ASP::Request')) { if($self->{TotalBytes}) { if(defined $length) { return substr($self->{content}, 0, $length); } else { return $self->{content} } } else { return undef; } } else { defined($length) || ( $length = $self->{TotalBytes} ); my $asp = $self->{asp}; my $r = $asp->{r}; if(! $ENV{MOD_PERL}) { my $rv = sysread(*STDIN, $data, $length, 0); $asp->{dbg} && $asp->Debug("read $rv bytes from STDIN for CGI mode, tried $length bytes"); } else { $r->read($data, $length); $asp->{dbg} && $asp->Debug("read ".length($data)." bytes, tried $length bytes"); } return $data; } } sub Cookies { my($self, $name, $key) = @_; if(! $name) { $self->{Cookies}; } elsif($key) { $self->{Cookies}{$name}{$key}; } else { # when we just have the name, are we expecting a dictionary or not my $cookie = $self->{Cookies}{$name}; if(ref $cookie && wantarray) { return %$cookie; } else { # CollectionItem support here one day, to not return # an undef object, CollectionItem needs tied hash support return $cookie; } } } sub ParseParams { my($self, $string) = @_; ($string = $$string) if ref($string); ## faster if we pass a ref for a big string my %params; defined($string) || return(\%params); my @params = split /[\&\;]/, $string, -1; # we have to iterate through the params here to collect multiple values for # the same param, say from a multiple select statement for my $pair (@params) { my($key, $value) = map { # inline for greater efficiency # &Unescape($self, $_) my $todecode = $_; $todecode =~ tr/+/ /; # pluses become spaces $todecode =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge; $todecode; } split (/\=/, $pair, 2); if(defined $params{$key}) { my $collect = $params{$key}; if(ref $collect) { # we have already collected more than one param for that key push(@{$collect}, $value); } else { # this is the second value for a key we've seen, start array $params{$key} = [$collect, $value]; } } else { # normal use, one to one key value pairs, just set $params{$key} = $value; } } \%params; } # unescape URL-encoded data sub Unescape { my $todecode = $_[1]; $todecode =~ tr/+/ /; # pluses become spaces $todecode =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge; $todecode; } *config = *Apache::ASP::config; 1; Apache-ASP-2.63/lib/Apache/ASP/CGI/0000755000175000017500000000000013252400404014322 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/CGI/Table.pm0000644000175000017500000000150511721310312015705 0ustar jobjob package Apache::ASP::CGI::Table; use Carp qw(confess); =pod =head1 NAME Apache::ASP::CGI::Table =head1 DESCRIPTION Layer for compatibility with Apache::Table objects while running in CGI or command line / test mode. =cut sub new { my $class = shift; bless {}, $class; } sub set { my($self, $key, $value) = @_; defined($key) || confess("no key to set value $value"); $self->{$key} = $value; } sub get { shift()->{shift()}; } sub unset { delete shift()->{shift()} }; sub clear { %{shift()} = (); }; sub add { my($self, $name, $value) = @_; my $old_value = $self->{$name}; if(ref $old_value) { push(@$old_value, $value); } elsif(defined $old_value) { $self->{$name} = [$old_value, $value]; } else { $self->{$name} = $value; } } sub merge { die("merge not implemented"); } 1; Apache-ASP-2.63/lib/Apache/ASP/CGI/Test.pm0000644000175000017500000000120511721310312015572 0ustar jobjobpackage Apache::ASP::CGI::Test; use Apache::ASP::CGI; @ISA = qw(Apache::ASP::CGI); use strict; sub init { my $self = shift->SUPER::init(@_); $self->OUT(''); $self; } sub print { my $self = shift; my $data = join('', map { ref($_) =~ /SCALAR/ ? $$_ : $_; } @_); my $out = $self->OUT || ''; $self->OUT($out.$data); } sub test_header_out { (shift->test_parse_out)[0]; } sub test_body_out { (shift->test_parse_out)[1]; } sub test_parse_out { my $self = shift; my $out = $self->OUT; if($out =~ /^(.*?)\s*\n\s*\n\s*(.*)$/s) { my($header, $body) = ($1, $2); } else { ($out, ''); } } 1; Apache-ASP-2.63/lib/Apache/ASP/GlobalASA.pm0000644000175000017500000001764411721310312016014 0ustar jobjob package Apache::ASP::GlobalASA; # GlobalASA Object # global.asa processes, whether or not there is a global.asa file. # if there is not one, the code is left blank, and empty routines # are filled in use strict; no strict qw(refs); use vars qw(%stash *stash @ISA @Routines); # these define the default routines that get parsed out of the # GLOBAL.ASA file @Routines = ( "Application_OnStart", "Application_OnEnd", "Session_OnStart", "Session_OnEnd", "Script_OnStart", "Script_OnEnd", "Script_OnParse", "Script_OnFlush" ); my $match_events = join('|', @Routines); sub new { my $asp = shift || die("no asp passed to GlobalASA"); my $filename = $asp->{global}.'/global.asa'; my $id = &Apache::ASP::FileId($asp, $asp->{global}, undef, 1); my $package = $asp->{global_package} ? $asp->{global_package} : "Apache::ASP::Compiles::".$id; $id .= 'x'.$package; # need to recompile when either file or namespace changes # make sure that when either the file or package changes, that we # update the global.asa compilation my $self = bless { asp => $asp, 'package' => $package, # filename => $filename, # id => $id, }; # assign early, since something like compiling reference the global asa, # and we need to do that in here $asp->{GlobalASA} = $self; $asp->{dbg} && $asp->Debug("GlobalASA package $self->{'package'}"); my $compiled = $Apache::ASP::Compiled{$id}; if($compiled && ! $asp->{stat_scripts}) { # $asp->{dbg} && $asp->Debug("no stat: GlobalASA already compiled"); $self->{'exists'} = $compiled->{'exists'}; $self->{'compiled'} = $compiled; # for event lookups return $self; } if($compiled) { # $asp->{dbg} && $asp->Debug("global.asa was cached for $id"); } else { $asp->{dbg} && $asp->Debug("global.asa was not cached for $id"); $compiled = $Apache::ASP::Compiled{$id} = { mtime => 0, 'exists' => 0 }; } $self->{compiled} = $compiled; my $exists = $self->{'exists'} = -e $filename; my $changed = 0; if(! $exists && ! $compiled->{'exists'}) { # fastest exit for simple case of no global.asa return $self; } elsif(! $exists && $compiled->{'exists'}) { # if the global.asa disappeared $changed = 1; } elsif($exists && ! $compiled->{'exists'}) { # if global.asa reappeared $changed = 1; } else { $self->{mtime} = $exists ? (stat(_))[9] : 0; if($self->{mtime} > $compiled->{mtime}) { # if the modification time is greater than the compile time $changed = 1; } } $changed || return($self); my $code = $exists ? ${$asp->ReadFile($filename)} : ""; my $strict = $asp->{use_strict} ? "use strict" : "no strict"; if($code =~ s/\]*\>((.*)\s+sub\s+($match_events).*)\<\/script\>/$1/isg) { $asp->Debug("script tags removed from $filename for IIS PerlScript compatibility"); } $code = ( "\n#line 1 $filename\n". join(" ;; ", "package $self->{'package'};", $strict, "use vars qw(\$".join(" \$",@Apache::ASP::Objects).');', "use lib qw($self->{asp}->{global});", $code, 'sub exit { $main::Response->End(); } ', "no lib qw($self->{asp}->{global});", '1;', ) ); $asp->{dbg} && $asp->Debug("compiling global.asa $self->{'package'} $id exists $exists", $self, '---', $compiled); $code =~ /^(.*)$/s; $code = $1; # turn off $^W to suppress warnings about reloading subroutines # which is a valid use of global.asa. We cannot just undef # all the events possible in global.asa, as global.asa can be # used as a general package library for the web application # --jc, 9/6/2002 local $^W = 0; # only way to catch strict errors here if($asp->{use_strict}) { local $SIG{__WARN__} = sub { die("maybe use strict error: ", @_) }; eval $code; } else { eval $code; } # if we have success compiling, then update the compile time if(! $@) { # if file mod times are bad, we need to use them anyway # for relative comparison, time() was used here before, but # doesn't work $compiled->{mtime} = $self->{mtime} || (stat($filename))[9]; # remember whether the file really exists $compiled->{'exists'} = $exists; # we cache whether the code was compiled so we can do quick # lookups before executing it my $routines = {}; local *stash = *{"$self->{'package'}::"}; for(@Routines) { if($stash{$_}) { $routines->{$_} = 1; } } $compiled->{'routines'} = $routines; $asp->Debug('global.asa routines', $routines); $self->{'compiled'} = $compiled; } else { $asp->CompileErrorThrow($code, "errors compiling global.asa: $@"); } $self; } sub IsCompiled { my($self, $routine) = @_; $self->{'compiled'}{routines}{$routine}; } sub ExecuteEvent { my($self, $event) = @_; if($self->{'compiled'}{routines}{$event}) { $self->{'asp'}->Execute($event); } } sub SessionOnStart { my $self = shift; my $asp = $self->{asp}; my $zero_sessions = 0; if($asp->{session_count}) { $asp->{Internal}->LOCK(); my $session_count = $asp->{Internal}{SessionCount} || 0; if($session_count <= 0) { $asp->{Internal}{SessionCount} = 1; $zero_sessions = 1; } else { $asp->{Internal}{SessionCount} = $session_count + 1; } $asp->{Internal}->UNLOCK(); } #X: would like to run application startup code here after # zero sessions is true, but doesn't seem to account for # case of busy server, then 10 minutes later user comes in... # since group cleanup happens after session, Application # never starts. Its only when a user times out his own # session, and comes back that this code would kick in. $asp->Debug("Session_OnStart", {session => $asp->{Session}->SessionID}); $self->ExecuteEvent('Session_OnStart'); } sub SessionOnEnd { my($self, $id) = @_; my $asp = $self->{asp}; my $internal = $asp->{Internal}; # session count tracking if($asp->{session_count}) { $internal->LOCK(); if((my $count = $internal->{SessionCount}) > 0) { $internal->{SessionCount} = $count - 1; } else { $internal->{SessionCount} = 0; } $internal->UNLOCK(); } # only retie session if there is a Session_OnEnd event to execute if($self->IsCompiled('Session_OnEnd')) { my $old_session = $asp->{Session}; my $dead_session; if($id) { $dead_session = &Apache::ASP::Session::new($asp, $id); $asp->{Session} = $dead_session; } else { $dead_session = $old_session; } $asp->{dbg} && $asp->Debug("Session_OnEnd", {session => $dead_session->SessionID()}); $self->ExecuteEvent('Session_OnEnd'); $asp->{Session} = $old_session; if($id) { untie %{$dead_session}; } } 1; } sub ApplicationOnStart { my $self = shift; $self->{asp}->Debug("Application_OnStart"); %{$self->{asp}{Application}} = (); $self->ExecuteEvent('Application_OnStart'); } sub ApplicationOnEnd { my $self = shift; my $asp = $self->{asp}; $asp->Debug("Application_OnEnd"); $self->ExecuteEvent('Application_OnEnd'); %{$self->{asp}{Application}} = (); # PROBLEM, since we are not resetting ASP objects # every execute now, useless code anyway # delete $asp->{Internal}{'application'}; # local $^W = 0; # my $tied = tied %{$asp->{Application}}; # untie %{$asp->{Application}}; # $tied->DESTROY(); # call explicit DESTROY # $asp->{Application} = &Apache::ASP::Application::new($self->{asp}) # || $self->Error("can't get application state"); } sub ScriptOnStart { my $self = shift; $self->{asp}{dbg} && $self->{asp}->Debug("Script_OnStart"); $self->ExecuteEvent('Script_OnStart'); } sub ScriptOnEnd { my $self = shift; $self->{asp}{dbg} && $self->{asp}->Debug("Script_OnEnd"); $self->ExecuteEvent('Script_OnEnd'); } sub ScriptOnFlush { my $self = shift; $self->{asp}{dbg} && $self->{asp}->Debug("Script_OnFlush"); $self->ExecuteEvent('Script_OnFlush'); } sub EventsList { @Routines; } 1; Apache-ASP-2.63/lib/Apache/ASP/Response.pm0000644000175000017500000007157112336747511016106 0ustar jobjob package Apache::ASP::Response; use Apache::ASP::Collection; use strict; no strict qw(refs); use vars qw(@ISA @Members %LinkTags $TextHTMLRegexp); @ISA = qw(Apache::ASP::Collection); use Carp qw(confess); use Data::Dumper qw(DumperX); use bytes; @Members = qw( Buffer Clean ContentType Expires ExpiresAbsolute Status ); # used for session id auto parsing %LinkTags = ( 'a' => 'href', 'area' => 'href', 'form' => 'action', 'frame' => 'src', 'iframe' => 'src', 'img' => 'src', 'input' => 'src', 'link' => 'href', ); $TextHTMLRegexp = '^text/html(;|$)'; sub new { my $asp = shift; my $r = $asp->{'r'}; my $out = ''; my $self = bless { asp => $asp, out => \$out, # internal extension allowing various scripts like Session_OnStart # to end the same response # Ended => 0, CacheControl => 'private', CH => &config($asp, 'CgiHeaders') || 0, # Charset => undef, Clean => &config($asp, 'Clean') || 0, Cookies => bless({}, 'Apache::ASP::Collection'), ContentType => 'text/html', 'Debug' => $asp->{dbg}, FormFill => &config($asp, 'FormFill'), IsClientConnected => 1, # PICS => undef, # Status => 200, # header_buffer => '', # header_done => 0, Buffer => &config($asp, 'BufferingOn', undef, 1), BinaryRef => \$out, CompressGzip => ($asp->{compressgzip} and ($asp->{headers_in}->get('Accept-Encoding') =~ /gzip/io)) ? 1 : 0, r => $r, headers_out => scalar($r->headers_out()), }; &IsClientConnected($self); # update now $self; } sub DeprecatedMemberAccess { my($self, $member, $value) = @_; $self->{asp}->Out( "\$Response->$member() deprecated. Please access member ". "directly with \$Response->{$member} notation" ); $self->{$member} = $value; } # defined the deprecated subs now, so we can loose the AUTOLOAD method # the AUTOLOAD was forcing us to keep the DESTROY around for my $member ( @Members ) { my $subdef = "sub $member { shift->DeprecatedMemberAccess('$member', shift); }"; eval $subdef; if($@) { die("error defining Apache::ASP::Response sub -- $subdef -- $@"); } } sub AddHeader { my($self, $name, $value) = @_; my $lc_name = lc($name); if($lc_name eq 'set-cookie') { $self->{r}->err_headers_out->add($name, $value); } else { # if we have a member API for this header, set that value instead # to avoid duplicate headers from being sent out if($lc_name eq 'content-type') { $self->{ContentType} = $value; } elsif($lc_name eq 'cache-control') { $self->{CacheControl} = $value; } elsif($lc_name eq 'expires') { $self->{ExpiresAbsolute} = $value; } else { $self->{headers_out}->set($name, $value); } } } sub AppendToLog { shift->{asp}->Log(@_); } sub Debug { my $self = shift; $self->{Debug} && $self->{asp}->Out("[$self->{asp}{basename}]", @_); }; sub BinaryWrite { $_[0]->Flush(); $_[0]->{asp}{dbg} && $_[0]->{asp}->Debug("binary write of ".length($_[1])." bytes"); &Write; } sub Clear { my $out = shift->{out}; $$out = ''; } sub Cookies { my($self, $name, $key, $value) = @_; if(defined($name) && defined($key) && defined($value)) { $self->{Cookies}{$name}{$key} = $value; } elsif(defined($name) && defined($key)) { # we are assigning cookie with name the value of key if(ref $key) { # if a hash, set the values in it to the keys values # we don't just assign the ref directly since for PerlScript # compatibility while(my($k, $v) = each %{$key}) { $self->{Cookies}{$name}{$k} = $v; } } else { $self->{Cookies}{$name}{Value} = $key; } } elsif(defined($name)) { # if the cookie was just stored as the name value, then we will # will convert it into its hash form now, so we can store other # things. We will probably be storing other things now, since # we are referencing the cookie directly my $cookie = $self->{Cookies}{$name} || {}; $cookie = ref($cookie) ? $cookie : { Value => $cookie }; $self->{Cookies}{$name} = bless $cookie, 'Apache::ASP::Collection'; } else { $self->{Cookies}; } } sub End { my $self = shift; # by not calling EndSoft(), but letting it be called naturally after # Execute() in hander(), we allow more natural Buffer flushing to occur # even if we are in a situation where Flush() has been made null like # in an XMLSubs or cached or trapped include # &EndSoft($self); eval { goto APACHE_ASP_EXECUTE_END; }; } sub EndSoft { my $self = shift; return if $self->{Ended}++; &Flush($self); } sub Flush { my $self = shift; my $asp = $self->{asp}; my $out = $self->{out}; local $| = 1; # Script_OnFlush event handler $asp->{GlobalASA}{'exists'} && $asp->{GlobalASA}->ScriptOnFlush(); # XSLT Processing, check for errors so PrettyError() can call Flush() if($asp->{xslt} && ! $asp->{errs}) { $asp->{dbg} && $asp->Debug("pre xslt $out length: ".length($$out)); $self->FlushXSLT; $asp->{dbg} && $asp->Debug("post xslt $out length: ".length($$out)); return if $asp->{errs}; } # FormFill if ($self->{FormFill} && ! $asp->{errs}) { $self->FormFill; return if $asp->{errs}; } if($self->{Clean} and $self->{ContentType} =~ /$TextHTMLRegexp/o) { # by checking defined, we just check once unless(defined $Apache::ASP::CleanSupport) { eval 'use HTML::Clean'; if($@) { $self->{asp}->Log("Error loading module HTML::Clean with Clean set to $self->{Clean}. ". "Make user you have HTML::Clean installed properly. Error: $@"); $Apache::ASP::CleanSupport = 0; } else { $Apache::ASP::CleanSupport = 1; } } # if we can't clean, we simply ignore if($Apache::ASP::CleanSupport) { my $h = HTML::Clean->new($out, $self->{Clean}); if($h) { $h->strip(); } else { $self->{asp}->Error("clean error: $! $@"); } } } ## Session query auto parsing for cookieless sessions if( $asp->{Session} and ! $asp->{session_cookie} and $asp->{session_url_parse} and ($self->{ContentType} =~ /^text/i) ) { $self->SessionQueryParse(); } if($self->{Ended}) { # log total request time just once at the end # and append to html like Cocoon, per user request my $total_time = sprintf('%7.5f', ( eval { &Time::HiRes::time() } || time() ) - $asp->{start_time}); $asp->{dbg} && $asp->Debug("page executed in $total_time seconds"); $asp->{total_time} = $total_time; if(&config($asp, 'TimeHiRes')) { if($self->{ContentType} =~ /$TextHTMLRegexp/o) { if(&config($asp, 'Debug')) { $$out .= "\n"; } } } } # HEADERS AFTER CLEAN, so content-length would be calculated correctly # if this is the first writing from the page, flush a newline, to # get the headers out properly if(! $self->{header_done}) { # if no headers and the script has ended, we know that the # the script has not been flushed yet, which would at least # occur with buffering on if($self->{Ended}) { # compression & content-length settings will kill filters # after Apache::ASP if(! $asp->{filter}) { # gzip the buffer if CompressGzip && browser accepts it && # the script is flushed once if($self->{CompressGzip} && $asp->LoadModule('Gzip','Compress::Zlib')) { $self->{headers_out}->set('Content-Encoding','gzip'); $$out = Compress::Zlib::memGzip($out); } $self->{headers_out}->set('Content-Length', length($$out)); } } &SendHeaders($self); } if($asp->{filter}) { print STDOUT $$out; } else { # just in case IsClientConnected is set incorrectly, still try to print # the worst thing is some extra error messages in the error_log ... # there have been spurious error reported with the IsClientConnected # code since it was introduced, and this will limit the errors ( if any are left ) # to the users explicitly using this functionality, --jc 11/29/2001 # # if($self->{IsClientConnected}) { if(! defined $self->{Status} or ($self->{Status} >= 200 and $self->{Status} < 400)) { $self->{r}->print($$out); } # } } # update after flushes only, expensive call $self->{Ended} || &IsClientConnected($self); # supposedly this is more efficient than undeffing, since # the string does not let go of its allocated memory buffer $$out = ''; 1; } sub FormFill { my $self = shift; my $asp = $self->{asp}; $asp->{dbg} && $asp->Debug("form fill begin"); $asp->LoadModule('FormFill', 'HTML::FillInForm') || return; my $ref = $self->{BinaryRef}; $$ref =~ s/(\]*\>.*?\<\/form\>)/ { my $form = $1; my $start_length = $asp->{dbg} ? length($form) : undef; eval { my $fif = HTML::FillInForm->new(); $form = $fif->fill( scalarref => \$form, fdat => $asp->{Request}{Form}, ); }; if($@) { $asp->CompileErrorThrow($form, "form fill failed: $@"); } else { $asp->{dbg} && $asp->Debug("form fill for form of start length $start_length ". "end length ".length($form)); } $form; } /iexsg; 1; } sub FlushXSLT { my $self = shift; my $asp = $self->{asp}; my $xml_out = $self->{BinaryRef}; return unless length($$xml_out); # could happen after a redirect $asp->{xslt_match} = &config($asp, 'XSLTMatch') || '^.'; return unless ($asp->{filename} =~ /$asp->{xslt_match}/); ## XSLT FETCH & CACHE $asp->{dbg} && $asp->Debug("xslt processing with $asp->{xslt}"); my $xsl_dataref = $self->TrapInclude($asp->{xslt}); $asp->{dbg} && $asp->Debug(length($$xsl_dataref)." bytes in XSL $xsl_dataref"); return if($asp->{errs}); ## XSLT XML RENDER eval { my $xslt_data = $asp->XSLT($xsl_dataref, $xml_out); $asp->{dbg} && $asp->Debug("xml_out $xml_out length ".length($$xml_out)." set to $xslt_data length ". length($$xslt_data)); ${$self->{BinaryRef}} = $$xslt_data; }; if($@) { $@ =~ s/^\s*//s; $asp->Error("XSLT/XML processing error: $@"); return; } 1; } sub IsClientConnected { my $self = shift; return(0) if ! $self->{IsClientConnected}; # must init Request first for the aborted test to be meaningful. # it seems that under mod_perl 1.25, apache 1.20 on a fast local network, # if $r->connection->aborted is checked on a file upload before $Request # is initialized, then aborted will return true, even under normal use. # This causes a file upload script to not render any output. It may be that this # check was done too fast for apache, where it might have still been setting # up the upload, so not to check the outbound client connection yet # unless($self->{asp}{Request}) { $self->{asp}->Out("need to init Request object before running Response->IsClientConnected"); return 1; } # IsClientConnected ? Might already be disconnected for busy site, if # a user hits stop/reload my $conn = $self->{r}->connection; my $is_connected = $conn->aborted ? 0 : 1; if($is_connected) { my $fileno = eval { $conn->fileno }; if(defined $fileno) { # sleep 3; # my $s = IO::Select->new($fileno); # $is_connected = $s->can_read(0) ? 0 : 1; # much faster than IO::Select interface() which calls # a few perl OO methods to construct & then can_read() my $bits = ''; vec($bits, $fileno, 1) = 1; $is_connected = select($bits, undef, undef, 0) > 0 ? 0 : 1; if(! $is_connected) { $self->{asp}{dbg} && $self->{asp}->Debug("client is no longer connected, detected via Apache->request->connetion->fileno"); } } } $self->{IsClientConnected} = $is_connected; if(! $is_connected) { $self->{asp}{dbg} && $self->{asp}->Debug("client is no longer connected"); } $is_connected; } # use the apache internal redirect? Thought that would be counter # to portability, but is still something to consider sub Redirect { my($self, $location) = @_; my $asp = $self->{asp}; my $r = $self->{r}; $asp->{dbg} && $asp->Debug('redirect called', {location=>$location}); # X: maybe this instead, so no session-id on normal redirects? # if($asp->{Session}) { # $location = $asp->{Server}->URL($location); if($asp->{Session} and $asp->{session_url_parse}) { $location = &SessionQueryParseURL($self, $location); $asp->{dbg} && $asp->Debug("new location after session query parsing $location"); } $r->headers_out->set('Location', $location); $self->{Status} = 302; $r->status(302); # Always SendHeaders() immediately for a Redirect() ... only in a SoftRedirect # will execution continue. Since we call SendHeaders here, instead of # Flush() a Redirect() will still work even in a XMLSubs call where Flush is # trapped to Null() &SendHeaders($self); # if we have soft redirects, keep processing page after redirect if(&config($asp, 'SoftRedirect')) { $asp->Debug("redirect is soft, headers already sent"); } else { # do we called End() or EndSoft() here? As of v 2.33, End() will # just jump to the end of Execute(), so if we were in a XMLSubs # and called End() after doing a Clear() there would still be # output the gets flushed out from before the XMLSubs, to prevent # this we clear the buffer now, and called EndSoft() in this case. # Finally we also call End() so we will jump out of the executing code. # &Clear($self); $self->{Ended} = 1; # just marked Ended so future EndSoft() cannot be called # &EndSoft($self); &End($self); } 1; } sub SendHeaders { my $self = shift; my $r = $self->{r}; my $asp = $self->{asp}; my $dbg = $asp->{dbg}; my $status = $self->{Status}; return if $self->{header_done}; $self->{header_done} = 1; $dbg && $asp->Debug('building headers'); $r->status($status) if defined($status); # for command line script return if &config($asp, 'NoHeaders'); if(defined $status and $status == 401) { $dbg && $asp->Debug("status 401, note basic auth failure realm ".$r->auth_name); # we can't send out headers, and let Apache use the 401 error doc # But this is fine, once authorization is OK, then the headers # will go out correctly, so things like sessions will work fine. $r->note_basic_auth_failure; return; } else { $dbg && defined $status && $self->{asp}->Debug("status $status"); } if(defined $self->{Charset}) { $r->content_type($self->{ContentType}.'; charset='.$self->{Charset}); } else { $r->content_type($self->{ContentType}); # add content-type } if(%{$self->{'Cookies'}}) { &AddCookieHeaders($self); # do cookies } # do the expiration time if(defined $self->{Expires}) { my $ttl = $self->{Expires}; $r->headers_out->set('Expires', &Apache::ASP::Date::time2str(time()+$ttl)); $dbg && $self->{asp}->Debug("expires in $self->{Expires}"); } elsif(defined $self->{ExpiresAbsolute}) { my $date = $self->{ExpiresAbsolute}; my $time = &Apache::ASP::Date::str2time($date); if(defined $time) { $r->headers_out->set('Expires', &Apache::ASP::Date::time2str($time)); } else { confess("Response->ExpiresAbsolute(): date format $date not accepted"); } } # do the Cache-Control header $r->headers_out->set('Cache-Control', $self->{CacheControl}); # do PICS header defined($self->{PICS}) && $r->headers_out->set('PICS-Label', $self->{PICS}); # don't send headers with filtering, since filter will do this for # all the modules once # doug sanctioned this one unless($r->headers_out->get("Content-type")) { # if filtering, we don't send out a header from ASP # this means that Filtered scripts can use CGI headers # we order the test this way in case Ken comes on # board with setting header_out, in which case the test # will fail early if(! $asp->{filter} && (! defined $status or $status >= 200 && $status < 400)) { $dbg && $asp->Debug("sending cgi headers"); if(defined $self->{header_buffer}) { # we have taken in cgi headers $r->send_cgi_header($self->{header_buffer} . "\n"); $self->{header_buffer} = undef; } else { unless($Apache::ASP::ModPerl2) { # don't need this for mod_perl2 it seems from Apache::compat $r->send_http_header(); } } } } 1; } # do cookies, try our best to emulate cookie collections sub AddCookieHeaders { my $self = shift; my $cookies = $self->{'Cookies'}; my $dbg = $self->{asp}{dbg}; # print STDERR Data::Dumper::DumperX($cookies); my($cookie_name, $cookie); for $cookie_name (sort keys %{$cookies}) { # skip key used for session id if($Apache::ASP::SessionCookieName eq $cookie_name) { confess("You can't use $cookie_name for a cookie name ". "since it is reserved for session management" ); } my($k, $v, @data, $header, %dict, $is_ref, $cookie, $old_k); $cookie = $cookies->{$cookie_name}; unless(ref $cookie) { $cookie->{Value} = $cookie; } $cookie->{Path} ||= '/'; for $k (sort keys %$cookie) { $v = $cookie->{$k}; $old_k = $k; $k = lc $k; # print STDERR "$k ---> $v\n\n"; if($k eq 'secure' and $v) { $data[4] = 'secure'; } elsif($k eq 'domain') { $data[3] = "$k=$v"; } elsif($k eq 'value') { # we set the value later, nothing for now } elsif($k eq 'expires') { my $time; # only the date form of expires is portable, the # time vals are nice features of this implementation if($v =~ /^\-?\d+$/) { # if expires is a perl time val if($v > time()) { # if greater than time now, it is absolute $time = $v; } else { # small, relative time, add to time now $time = $v + time(); } } else { # it is a string format, PORTABLE use $time = &Apache::ASP::Date::str2time($v); } my $date = &Apache::ASP::Date::time2str($time); $dbg && $self->{asp}->Debug("setting cookie expires", {from => $v, to=> $date} ); $v = $date; $data[1] = "$k=$v"; } elsif($k eq 'path') { $data[2] = "$k=$v"; } else { if(defined($cookie->{Value}) && ! (ref $cookie->{Value})) { # if the cookie value is just a string, its not a dict } else { # cookie value is a dict, add to it $cookie->{Value}{$old_k} = $v; } } } my $server = $self->{asp}{Server}; # for the URLEncode routine if(defined($cookie->{Value}) && (! ref $cookie->{Value})) { $cookie->{Value} = $server->URLEncode($cookie->{Value}); } else { my @dict; for my $k ( sort keys %{$cookie->{Value}} ) { my $v = $cookie->{Value}{$k}; push(@dict, $server->URLEncode($k) . '=' . $server->URLEncode($v)); } $cookie->{Value} = join('&', @dict); } $data[0] = $server->URLEncode($cookie_name) . "=$cookie->{Value}"; # have to clean the data now of undefined values, but # keeping the position is important to stick to the Cookie-Spec my @cookie; for(0..4) { next unless $data[$_]; push(@cookie, $data[$_]); } my $cookie_header = join('; ', @cookie); $self->{r}->err_headers_out->add('Set-Cookie', $cookie_header); $dbg && $self->{asp}->Debug({cookie_header=>$cookie_header}); } } # with the WriteRef vs. Write abstration, direct calls # to write might slow a little, but more common static # html calls to WriteRef will be saved the HTML copy sub Write { my $self = shift; my $dataref; if(@_ > 1) { $, ||= ''; # non-standard use, so init here my $data = join($,, @_); $dataref = \$data; } else { # $_[0] ||= ''; $dataref = defined($_[0]) ? \$_[0] : \''; } &WriteRef($self, $dataref); 1; } # \''; *Apache::ASP::WriteRef = *WriteRef; sub WriteRef { my($self, $dataref) = @_; # allows us to end a response, but still execute code in event # handlers which might have output like Script_OnStart / Script_OnEnd return if $self->{Ended}; # my $content_out = $self->{out}; if($self->{CH}) { # CgiHeaders may change the reference to the dataref, because # dataref is a read-only scalar ref of static data, and CgiHeaders # may need to change it $dataref = $self->CgiHeaders($dataref); } # add dataref to buffer ${$self->{out}} .= $$dataref; #Encode::_utf8_on(${$self->{out}}); #Encode::from_to(${$self->{out}}, "utf8", "iso-8859-1"); # do we flush now? not if we are buffering if(! $self->{'Buffer'} && ! $self->{'FormFill'}) { # we test for whether anything is in the buffer since # this way we can keep reading headers before flushing # them out &Flush($self); } 1; } *write = *Write; # alias printing to the response object sub TIEHANDLE { $_[1]; } *PRINT = *Write; sub PRINTF { my($self, $format, @list) = @_; my $output = sprintf($format, @list); $self->WriteRef(\$output); } sub CgiHeaders { my($self, $dataref) = @_; my $content_out = $self->{out}; # work on the headers while the header hasn't been done # and while we don't have anything in the buffer yet # # also added a test for the content type being text/html or # if($self->{CH} && ! $self->{header_done} && ! $$content_out && ($self->{ContentType} =~ /$TextHTMLRegexp/o)) { # -1 to catch the null at the end maybe my @headers = split(/\n/, $$dataref, -1); # first do status line my $status = $headers[0]; if($status =~ m|HTTP/\d\.\d\s*(\d*)|o) { $self->{Status} = $1; shift @headers; } while(@headers) { my $out = shift @headers; next unless $out; # skip the blank that comes after the last newline if($out =~ /^[^\s]+\: /) { # we are a header unless(defined $self->{header_buffer}) { $self->{header_buffer} .= ''; } $self->{header_buffer} .= "$out\n"; } else { unshift(@headers, $out); last; } } # take remaining non-headers & set the data to them joined back up my $data_left = join("\n", @headers); $dataref = \$data_left; } $dataref; } sub Null {}; sub TrapInclude { my($self, $file) = (shift, shift); my $out = ""; local $self->{out} = local $self->{BinaryRef} = \$out; local $self->{Ended} = 0; local *Apache::ASP::Response::Flush = *Null; $self->Include($file, @_); \$out; } sub Include { my $self = shift; my $file = shift; my $asp = $self->{asp}; my($cache, $cache_key, $cache_expires, $cache_clear); if(ref($file) && ref($file) eq 'HASH') { my $data = $file; $file = $data->{File} || $asp->Error("no File key passed to Include(), keys ".join(',', keys %$file)); $asp->{dbg} && $asp->Debug("file $file from HASH ref in Include()"); if($data->{Cache}) { $cache = 1; $cache_expires = $data->{'Expires'}; $cache_clear = $data->{'Clear'}; my $file_data = ''; if(ref($file)) { $file_data = 'INCLUDE SCALAR REF '.$$file; } else { my $real_file = $asp->SearchDirs($file); $file_data = 'INCLUDE FILE '.(stat($real_file))[9].' //\\ :: '.$real_file.' //\\ :: '.$file; } if($data->{Key}) { $cache_key = $file_data .' //\\ :: '.DumperX($data->{Key}); $asp->{dbg} && $asp->Debug("include cache key length ".length($cache_key)." with extra Key data"); } else { $asp->{dbg} && $asp->Debug("include cache key length ".length($file_data)); $cache_key = $file_data; } $cache_key .= ' //\\ COMPILE CHECKSUM :: '.$asp->{compile_checksum}; $cache_key .= ' //\\ ARGS :: '.DumperX(@_); if(! $cache_clear) { my $rv = $asp->Cache('Response', \$cache_key, undef, $data->{Expires}, $data->{LastModified}); if($rv) { if(! eval { ($rv->{RV} && $rv->{OUT}) }) { $asp->{dbg} && $self->Debug("cache item invalid: $@"); } else { $asp->{dbg} && $asp->Debug("found include $file output in cache"); $self->WriteRef($rv->{OUT}); my $rv_data = $rv->{RV}; return wantarray ? @$rv_data : $rv_data->[0]; } } } } } my $_CODE = $asp->CompileInclude($file); unless(defined $_CODE) { die("error including $file, not compiled: $@"); } $asp->{last_compile_include_data} = $_CODE; my $eval = $_CODE->{code}; # exit early for cached static file if(ref $eval eq 'SCALAR') { $asp->{dbg} && $asp->Debug("static file data cached, not compiled, length: ".length($$eval)); $self->WriteRef($eval); return; } $asp->{dbg} && $asp->Debug("executing $eval"); my @rc; if($cache) { my $out = ""; { local $self->{out} = local $self->{BinaryRef} = \$out; local $self->{Ended} = 0; local *Apache::ASP::Response::Flush = *Null; @rc = eval { &$eval(@_) }; $asp->{dbg} && $asp->Debug("caching $file output expires: ".($cache_expires || '')); $asp->Cache('Response', \$cache_key, { RV => [ @rc ], OUT => \$out }, $cache_expires); } $self->WriteRef(\$out); } else { @rc = eval { &$eval(@_) }; } if($@) { my $code = $_CODE; die "error executing code for include $code->{file}: $@; compiled to $code->{perl}"; } $asp->{dbg} && $asp->Debug("done executing include code $eval"); wantarray ? @rc : $rc[0]; } sub ErrorDocument { my($self, $error_code, $uri) = @_; $self->{'r'}->custom_response($error_code, $uri); } sub SessionQueryParse { my $self = shift; # OPTIMIZE MATCH: a is first in the sort, so this is fairly well optimized, # putting img up at the front doesn't seem to make a different in the speed my $tags_grep = join('|', sort keys %LinkTags); my $new_content = ''; # we are going to rebuild this content my $content_ref = $self->{out}; my $asp = $self->{asp}; $asp->{dbg} && $asp->Debug("parsing session id into url query strings"); # update quoted links in script location.href settings too # if not quoted, then maybe script expressions $$content_ref =~ s/(\[^\<]*location\.href\s*\=[\"\'])([^\"\']+?)([\"\']) /$1.&SessionQueryParseURL($self, $2).$3 /isgex; while(1) { # my emacs perl mode doesn't like ${$doc->{content}} last unless ($$content_ref =~ s/ ^(.*?) # html head \< # start \s*($tags_grep)\s+ # tag itself ([^>]+) # descriptors \> # end //isxo ); my($head, $tag, $temp_attribs) = ($1, lc($2), $3); my $element = "<$2 $temp_attribs>"; my %attribs; while($temp_attribs =~ s/^\s*([^\s=]+)\s*\=?//so) { my $key = lc $1; my $value; if($temp_attribs =~ s/^\s*\"([^\"]*)\"\s*//so) { $value = $1; } elsif ($temp_attribs =~ s/^\s*\'([^\']*)\'\s*//so) { # apparently browsers support single quoting values $value = $1; } elsif($temp_attribs =~ s/^\s*([^\s]*)\s*//so) { # sometimes there are mal-formed URL's $value = $1; $value =~ s/\"//sgo; } $attribs{$key} = $value; } # GET URL from tag attribs finally my $rel_url = $attribs{$LinkTags{$tag}}; # $asp->Debug($rel_url, $element, \%attribs); if(defined $rel_url) { my $new_url = &SessionQueryParseURL($self, $rel_url); # escape all special characters so they are not interpreted if($new_url ne $rel_url) { $rel_url =~ s/([\W])/\\$1/sg; $element =~ s|($LinkTags{$tag}\s*\=\s*[\"\']?)$rel_url|$1$new_url|isg; # $asp->Debug("parsed new element $element"); } } $new_content .= $head . $element; } # $asp->Debug($$content_ref); $new_content .= $$content_ref; $$content_ref = $new_content; 1; } sub SessionQueryParseURL { my($self, $rel_url) = @_; my $asp = $self->{asp}; my $match = $asp->{session_url_parse_match}; if( # if we have match expression, try it ($match && $rel_url =~ /$match/) # then if server path, check matches cookie space || ($rel_url =~ m|^/| and $rel_url =~ m|^$asp->{cookie_path}|) # then do all local paths, matching NOT some URI PROTO || ($rel_url !~ m|^[^\?\/]+?:|) ) { my($query, $new_url, $frag); if($rel_url =~ /^([^\?]+)(\?([^\#]*))?(\#.*)?$/) { $new_url = $1; $query = defined $3 ? $3 : ''; $frag = $4; } else { $new_url = $rel_url; $query = ''; } # for the split, we do not need to handle other entity references besides & # because &, =, and ; should be the only special characters in the query string # and the only of these characters that are represented by an entity reference # is & as & ... the rest of the special characters that might be encoded # in a URL should be URI escaped # --jc 2/10/2003 my @new_query_parts; map { (! /^$Apache::ASP::SessionCookieName\=/) && push(@new_query_parts, $_); } split(/&|&/, $query); my $new_query = join('&', @new_query_parts, $Apache::ASP::SessionCookieName.'='.$asp->{session_id} ); $new_url .= '?'.$new_query; if($frag) { $new_url .= $frag; } $asp->{dbg} && $asp->Debug("parsed session into $new_url"); $new_url; } else { $rel_url; } } *config = *Apache::ASP::config; 1; Apache-ASP-2.63/lib/Apache/ASP/Application.pm0000644000175000017500000000313111721310312016514 0ustar jobjob package Apache::ASP::Application; use Apache::ASP::State; use Apache::ASP::Collection; use strict; no strict qw(refs); use vars qw(@ISA); @ISA = qw(Apache::ASP::Collection Apache::ASP::State); use Fcntl qw(:flock O_RDWR O_CREAT ); sub new { my($asp) = @_; my(%self); unless( tie( %self,'Apache::ASP::State', $asp, 'application', 'server', ) ) { $asp->Error("can't tie to application state"); return; } bless \%self; } sub Lock { shift->SUPER::LOCK }; sub UnLock { shift->SUPER::UNLOCK }; sub SessionCount { my $asp = tied(%{$_[0]})->{asp}; if($asp->{session_count}) { $asp->{Internal}{SessionCount}; } else { undef; } } sub GetSession { my($self, $id) = @_; my $asp = tied(%$self)->{'asp'}; unless(defined $id and $id) { $asp->Warn("session id not defined"); return; } unless(length($id) >= 8) { $asp->Warn("session id must be of at least 8 in length"); return; } if($asp->{Session} and $asp->{Session}->SessionID() eq $id) { return $asp->{Session}; } else { my $new_session = Apache::ASP::Session::new($asp, $id, O_RDWR, 'NOERR'); if($new_session) { if ($asp->{get_session_last}) { my $session_obj = tied %{$asp->{get_session_last}}; $asp->{dbg} && $asp->Debug("freeing last session $asp->{get_session_last} $session_obj"); $session_obj && $session_obj->DESTROY; } $asp->{get_session_last} = $new_session; $asp->RegisterCleanup(sub { my $session_obj = tied %$new_session; $session_obj && $session_obj->DESTROY; }); } $new_session; } } 1; Apache-ASP-2.63/lib/Apache/ASP/Share/0000755000175000017500000000000013252400404014762 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/Share/CORE.pm0000644000175000017500000000005511721310312016045 0ustar jobjob # placeholder for the CORE.pm namespace 1; Apache-ASP-2.63/lib/Apache/ASP/Share/CORE/0000755000175000017500000000000013252400404015512 5ustar jobjobApache-ASP-2.63/lib/Apache/ASP/Share/CORE/MailErrorsHTML.inc0000644000175000017500000000066312336747511020775 0ustar jobjob<% my %args = @_; %> Subject: Apache::ASP Errors for <%= $args{FILE} %> <% for my $key ( qw( GLOBAL FILE REMOTE_ADDR REMOTE_USER HTTP_HEADERS QUERY FORM RAW ) ) { next unless defined $args{$key}; %> <% } %>
<%= $key %>:
<%= $args{$key} %>
<%= $args{COMPILE_ERROR} || '' %> Apache-ASP-2.63/lib/Apache/ASP/Share/CORE/MailErrors.inc0000644000175000017500000000217612336747511020311 0ustar jobjob <%; my %args = @_; my $Form = $Request->Form; my $Query = $Request->QueryString; my $Env = $Request->ServerVariables; my $Raw = $Server->HTMLEncodeByValue($Request->BinaryRead); $Raw =~ s/([^\n]{50,70})(.)/$1\n$2/gi; my $http_out = join("\n", map { "$_= ".$Server->HTMLEncodeByValue($Env->{$_}) } sort keys %$Env ); $http_out =~ s/([^\n]{50,70})(.)/$1\n$2/gi; my $query_out = join("\n", map { "$_= ".$Server->HTMLEncodeByValue($Query->{$_}) } sort keys %$Query ); $query_out =~ s/([^\n]{50,70})(.)/$1\n$2/gi; my $form_out = join("\n", map { "$_= ".$Server->HTMLEncodeByValue($Form->{$_}) } sort keys %$Form ); $form_out =~ s/([^\n]{50,70})(.)/$1\n$2/gi; my %client_data = ( GLOBAL => $Server->Config('Global') || '.', FILE => $Server->File, REMOTE_ADDR => $Env->{REMOTE_ADDR}, REMOTE_USER => $Env->{REMOTE_USER}, HTTP_HEADERS => $http_out || '', QUERY => $query_out || '', FORM => $form_out || '', RAW => $Raw || '', ); $Response->Include('Share::CORE/MailErrorsHTML.inc', %args, %client_data); %> Apache-ASP-2.63/lib/Apache/ASP/StateManager.pm0000644000175000017500000004544112337417341016654 0ustar jobjob package Apache::ASP; # quickly decomped out of Apache::ASP so we could load the routines only # when we are managing State objects use Apache::ASP::State; use strict; use vars qw( $CleanupGroups $SessionIDLength $SessionTimeout $StateManager $DefaultStateDB $DefaultStateSerializer ); $SessionTimeout = 20; $StateManager = 10; # Some OS's have hashed directory lookups up to 16 bytes, so we leave room # for .lock extension ... nevermind, security is more important, back to 32 # $SessionIDLength = 11; $SessionIDLength = 32; $DefaultStateDB = 'SDBM_File'; $DefaultStateSerializer = 'Data::Dumper'; sub InitState { my $self = shift; my $r = $self->{r}; my $global_asa = $self->{GlobalASA}; ## STATE INITS # what percent of the session_timeout's time do we garbage collect # state files and run programs like Session_OnEnd and Application_OnEnd $self->{state_manager} = &config($self, 'StateManager', undef, $Apache::ASP::StateManager); # state is the path where state files are stored, like $Session, $Application, etc. $self->{state_dir} = &config($self, 'StateDir', undef, $self->{global}.'/.state'); $self->{state_dir} =~ tr///; # untaint $self->{session_state} = &config($self, 'AllowSessionState', undef, 1); $self->{state_serialize} = &config($self, 'ApplicationSerialize'); if($self->{state_db} = &config($self, 'StateDB')) { # StateDB - Check StateDB module support $Apache::ASP::State::DB{$self->{state_db}} || $self->Error("$self->{state_db} is not supported for StateDB, try: " . join(", ", keys %Apache::ASP::State::DB)); $self->{state_db} =~ /^(.*)$/; # untaint $self->{state_db} = $1; # untaint # load the state database module && serializer $self->LoadModule('StateDB', $self->{state_db}); } if($self->{state_serializer} = &config($self, 'StateSerializer')) { $self->{state_serializer} =~ tr///; # untaint $self->LoadModule('StateSerializer', $self->{state_serializer}); } # INTERNAL tie to the application internal info my %Internal; tie(%Internal, 'Apache::ASP::State', $self, 'internal', 'server') || $self->Error("can't tie to internal state"); my $internal = $self->{Internal} = bless \%Internal, 'Apache::ASP::State'; $self->{state_serialize} && $internal->LOCK; # APPLICATION create application object $self->{app_state} = &config($self, 'AllowApplicationState', undef, 1); if($self->{app_state}) { # load at runtime for CGI environments, preloaded for mod_perl require Apache::ASP::Application; ($self->{Application} = &Apache::ASP::Application::new($self)) || $self->Error("can't get application state"); $self->{state_serialize} && $self->{Application}->Lock; } else { $self->{dbg} && $self->Debug("no application allowed config"); } # SESSION if we are tracking state, set up the appropriate objects my $session; if($self->{session_state}) { ## SESSION INITS $self->{cookie_path} = &config($self, 'CookiePath', undef, '/'); $self->{cookie_domain} = &config($self, 'CookieDomain'); $self->{paranoid_session} = &config($self, 'ParanoidSession'); $self->{remote_ip} = eval { $r->connection()->remote_ip() }; # may not exist in Apache 2.4 $self->{remote_ip} ||= eval { $r->useragent_ip() }; # should exist in Apache 2.4, best for end user agent IP address $self->{remote_ip} ||= eval { $r->connection()->client_ip() }; # if useragent_ip not defined for Apache 2.4, try this one $self->{session_count} = &config($self, 'SessionCount'); # cookieless session support, cascading values $self->{session_url_parse_match} = &config($self, 'SessionQueryParseMatch'); $self->{session_url_parse} = $self->{session_url_parse_match} || &config($self, 'SessionQueryParse'); $self->{session_url_match} = $self->{session_url_parse_match} || &config($self, 'SessionQueryMatch'); $self->{session_url} = $self->{session_url_parse} || $self->{session_url_match} || &config($self, 'SessionQuery'); $self->{session_url_force} = &config($self, 'SessionQueryForce'); $self->{session_serialize} = &config($self, 'SessionSerialize'); $self->{secure_session} = &config($self, 'SecureSession'); $self->{http_only_session} = &config($self, 'HTTPOnlySession'); # session timeout in seconds since that is what we work with internally $self->{session_timeout} = &config($self, 'SessionTimeout', undef, $SessionTimeout) * 60; $self->{'ua'} = $self->{headers_in}->get('User-Agent') || 'UNKNOWN UA'; # refresh group by some increment smaller than session timeout # to withstand DoS, bruteforce guessing attacks # defaults to checking the group once every 2 minutes $self->{group_refresh} = int($self->{session_timeout} / $self->{state_manager}); # Session state is dependent on internal state # load at runtime for CGI environments, preloaded for mod_perl require Apache::ASP::Session; $session = $self->{Session} = &Apache::ASP::Session::new($self) || $self->Die("can't create session"); $self->{state_serialize} && $session->Lock(); } else { $self->{dbg} && $self->Debug("no sessions allowed config"); } # update after long state init, possible with SessionSerialize config $self->{Response}->IsClientConnected(); # POSTPOSE STATE EVENTS, so we can delay the Response object creation # until after the state objects are created if($session) { my $last_session_timeout; if($session->Started()) { # we only want one process purging at a time if($self->{app_state}) { $internal->LOCK(); if(($last_session_timeout = $internal->{LastSessionTimeout} || 0) < time()) { $internal->{'LastSessionTimeout'} = $self->{session_timeout} + time; $internal->UNLOCK(); $self->{Application}->Lock; my $obj = tied(%{$self->{Application}}); if($self->CleanupGroups('PURGE')) { $last_session_timeout && $global_asa->ApplicationOnEnd(); $global_asa->ApplicationOnStart(); } $self->{Application}->UnLock; } $internal->UNLOCK(); } $global_asa->SessionOnStart(); } if($self->{app_state}) { # The last session timeout should only be updated every group_refresh period # another optimization, rand() so not all at once either $internal->LOCK(); $last_session_timeout ||= $internal->{'LastSessionTimeout'}; if($last_session_timeout < $self->{session_timeout} + time + (rand() * $self->{group_refresh} / 2)) { $self->{dbg} && $self->Debug("updating LastSessionTimeout from $last_session_timeout"); $internal->{'LastSessionTimeout'} = $self->{session_timeout} + time() + $self->{group_refresh}; } $internal->UNLOCK(); } } $self; } # Cleanup a state group, by default the group of the current session # We do this currently in DESTROY, which happens after the current # script has been executed, so that cleanup doesn't happen until # after output to user # # We always exit unless there is a $Session defined, since we only # cleanup groups of sessions if sessions are allowed for this script sub CleanupGroup { my($self, $group_id, $force) = @_; return unless $self->{Session}; my $asp = $self; # bad hack for some moved around code $force ||= 0; # GET GROUP_ID my $state; unless($group_id) { $state = $self->{Session}{_STATE}; $group_id = $state->GroupId(); } # we must have a group id to work with $asp->Error("no group id") unless $group_id; my $group_key = "GroupId" . $group_id; # cleanup timed out sessions, from current group my $internal = $asp->{Internal}; $internal->LOCK(); my $group_check = $internal->{$group_key} || 0; unless($force || ($group_check < time())) { $internal->UNLOCK(); return; } # set the next group_check, randomize a bit to unclump the group checks, # for 20 minute session timeout, had rand() / 2 + .5, but it was still # too clumpy, going with pure rand() now, even if a bit less efficient my $next_check = int($asp->{group_refresh} * rand()) + 1; $internal->{$group_key} = time() + $next_check; $internal->UNLOCK(); ## GET STATE for group $state ||= &Apache::ASP::State::new($asp, $group_id); my $ids = $state->GroupMembers() || []; # don't return so we can't delete the empty group later # return unless scalar(@$ids); $asp->{dbg} && $asp->Debug("group check $group_id, next in $next_check sec"); my $id = $self->{Session}->SessionID(); my $deleted = 0; $internal->LOCK(); $asp->{dbg} && $asp->Debug("checking group ids", $ids); for my $id (@$ids) { eval { # if($id eq $_) { # $asp->{dbg} && $asp->Debug("skipping delete self", {id => $id}); # next; # } # we lock the internal, so a session isn't being initialized # while we are garbage collecting it... we release it every # time so we don't starve session creation if this is a large # directory that we are garbage collecting my $idata = $internal->{$id}; # do this check in case this data is corrupt, and not deserialized, correctly unless(ref($idata) && (ref($idata) eq 'HASH')) { $idata = {}; } my $timeout = $idata->{timeout} || 0; unless($timeout) { # we don't have the timeout always, since this session # may just have been created, just in case this is # a corrupted session (does this happen still ??), we give it # a timeout now, so we will be sure to clean it up # eventualy $idata->{timeout} = time() + $asp->{session_timeout}; $internal->{$id} = $idata; $asp->Debug("resetting timeout for $id to $idata->{timeout}"); return; # no next in eval {} } # only delete sessions that have timed out unless($timeout < time()) { $asp->{dbg} && $asp->Debug("$id not timed out with $timeout"); return; # no next in eval {} } # UPDATE & UNLOCK, as soon as we update internal, we may free it # definately don't lock around SessionOnEnd, as it might take # a while to process # set the timeout for this session forward so it won't # get garbage collected by another process $asp->{dbg} && $asp->Debug("resetting timeout for deletion lock on $id"); $internal->{$id} = { %{$internal->{$id}}, 'timeout' => time() + $asp->{session_timeout}, 'end' => 1, }; # unlock many times in case we are locked above this loop for (1..3) { $internal->UNLOCK() } $asp->{GlobalASA}->SessionOnEnd($id); $internal->LOCK; # set up state my($member_state) = Apache::ASP::State::new($asp, $id); if(my $count = $member_state->Delete()) { $asp->{dbg} && $asp->Debug("deleting session", { session_id => $id, files_deleted => $count, }); $deleted++; delete $internal->{$id}; } else { $asp->Error("can't delete session id: $id"); return; # no next in eval {} } }; if($@) { $asp->Error("error for cleanup of session id $id: $@"); } } $internal->UNLOCK(); #### LEAVE DIRECTORIES, NASTY RACE CONDITION POTENTIAL ## NOW PRUNE ONLY DIRECTORIES THAT WE DON'T NEED TO KEEP ## FOR PERFORMANCE # REMOVE DIRECTORY, LOCK # if the directory is still empty, remove it, lock it # down so no new sessions will be created in it while we # are testing if($deleted == @$ids) { if ($state->GroupId !~ /^[0]/) { $asp->{Internal}->LOCK(); my $ids = $state->GroupMembers(); if(@{$ids} == 0) { $self->Log("purging stale group ".$state->GroupId.", which should only happen ". "after Apache::ASP upgrade to beyond 2.09"); $state->DeleteGroupId(); } $asp->{Internal}->UNLOCK(); } } $deleted; } sub CleanupGroups { my($self, $force) = @_; return unless $self->{Session}; my $cleanup = 0; my $state_dir = $self->{state_dir}; my $internal = $self->{Internal}; $force ||= 0; $self->Debug("forcing groups cleanup") if ($self->{dbg} && $force); # each apache process has an internal time in which it # did its last check, once we have passed that, we check # $Internal for the last time the check was done. We # break it up in this way so that locking on $Internal # does not become another bottleneck for scripts if($force || ($Apache::ASP::CleanupGroups{$state_dir} || 0) < time()) { # /8 to keep it less bursty... since we check groups every group_refresh/2 # we'll average 1/4 of the groups everytime we check them on a busy server $Apache::ASP::CleanupGroups{$state_dir} = time() + $self->{group_refresh}/8; $self->{dbg} && $self->Debug("testing internal time for cleanup groups"); if($self->CleanupMaster) { $internal->LOCK(); if($force || ($internal->{CleanupGroups} < (time - $self->{group_refresh}/8))) { $internal->{CleanupGroups} = time; $cleanup = 1; } $internal->UNLOCK; } } return unless $cleanup; # clean cache, so caching won't affect CleanupGroups() being called multiple times $self->{internal_cached_keys} = undef; # only one process doing CleanupGroup at a time now, so OK # lock around, necessary when keeping empty group directories my $groups = $self->{Session}{_SELF}{'state'}->DefaultGroups(); $self->{dbg} && $self->Debug("groups ", $groups); my($sum_active, $sum_deleted); $internal->LOCK(); my $start_cleanup = time; for(@{$groups}) { $sum_deleted = $self->CleanupGroup($_, $force); if ($start_cleanup > time) { # every second, take a breather in the lock management # so that sessions can be created, and the like, so for # long purges, the application will get sticky in 1 second # bursts $start_cleanup = time; $internal->UNLOCK; $internal->LOCK; last unless $self->CleanupMaster; } } $internal->UNLOCK(); $self->{dbg} && $self->Debug("cleanup groups", { deleted => $sum_deleted }) if $self->{dbg}; # boolean true at least for master $sum_deleted || 1; } sub CleanupMaster { my $self = shift; my $internal = $self->{Internal}; $internal->LOCK; my $master = $internal->{CleanupMaster} || { ServerID => '', PID => 0, Checked => 0, }; my $is_master = (($master->{ServerID} eq $ServerID) and ($master->{PID} eq $$)) ? 1 : 0; $self->{dbg} && $self->Debug(current_master => $master, is_master => $is_master ); my $stale_time = $is_master ? $self->{group_refresh} / 4 : $self->{group_refresh} / 2 + int($self->{group_refresh} * rand() / 2) + 1; $stale_time += $master->{Checked}; if($stale_time < time()) { $internal->{CleanupMaster} = { ServerID => $ServerID, PID => $$, Checked => time() }; $internal->UNLOCK; # flush write $self->{dbg} && $self->Debug("$stale_time time is stale, is_master $is_master", $master); # we are only worried about multiprocess NFS here ... if running not # in mod_perl mode, probably just CGI mounted on local disk # Only do this while in DESTROY() mode too, so we avoid Application_OnStart # hang behavior. if($^O !~ /Win/ && $ENV{MOD_PERL} && $self->{DESTROY}) { $self->Debug("sleep for acquire master check in case of shared state"); sleep(1); } my $master = $internal->{CleanupMaster}; # recheck after flush my $is_master = (($master->{ServerID} eq $ServerID) and ($master->{PID} eq $$)) ? 1 : 0; $self->{dbg} && $self->Debug("is_master $is_master after update $ServerID - $$"); $is_master; } elsif($is_master) { $master->{Checked} = time(); $internal->{CleanupMaster} = $master; $internal->UNLOCK; $self->{dbg} && $self->Debug("$stale_time time is fresh, is_master $is_master", $master); 1; # is master } else { $internal->UNLOCK; $self->{dbg} && $self->Debug("$stale_time time is fresh, is_master $is_master", $master); 0; # not master } } # combo get / set sub SessionId { my($self, $id) = @_; if(defined $id) { unless($self->{session_url_force}) { # don't set the cookie when we are just using SessionQuery* configs my $secure = $self->{secure_session} ? '; secure' : ''; my $httponly = $self->{http_only_session} ? '; HttpOnly' : ''; my $domain = $self->{cookie_domain} ? '; domain='.$self->{cookie_domain} : ''; $self->{r}->err_headers_out->add('Set-Cookie', "$SessionCookieName=$id; path=$self->{cookie_path}".$domain.$secure.$httponly); } $self->{session_id} = $id; } else { # if we have already parsed it out, return now # quick session_id caching, mostly for use with # cookie less url building $self->{session_id} && return $self->{session_id}; my $session_cookie = 0; unless($self->{session_url_force}) { # don't read the cookie when we are just using SessionQuery* configs my $cookie = $self->{r}->headers_in->{"Cookie"} || ''; my(@parts) = split(/\;\s*/, $cookie); for(@parts) { my($name, $value) = split(/\=/, $_, 2); if($name eq $SessionCookieName) { $id = $value; $session_cookie = 1; $self->{dbg} && $self->Debug("session id from cookie: $id"); last; } } } my $session_from_url; if(! defined($id) && $self->{session_url}) { $id = delete $self->{Request}{QueryString}{$SessionCookieName}; # if there was more than one session id in the query string, then just # take the first one ref($id) =~ /ARRAY/ and ($id) = @$id; $id && $self->{dbg} && $self->Debug("session id from query string: $id"); $session_from_url = 1; } # SANTIZE the id against hacking if(defined $id) { if($id =~ /^[0-9a-z]{8,32}$/s) { # at least 8 bytes, but less than 32 bytes $self->{session_id} = $id; } else { $self->Log("passed in session id $id failed checks sanity checks"); $id = undef; } } if ($session_from_url && defined $id) { $self->SessionId($id); } if(defined $id) { $self->{session_id} = $id; $self->{session_cookie} = $session_cookie; } } $id; } sub Secret { my $self = shift; # have enough data in here that even if srand() is seeded for the purpose # of debugging an external program, should have decent behavior. my $data = $self . $self->{remote_ip} . rand() . time() . $self->{global} . $self->{'r'} . $self->{'filename'}. $$ . $ServerID; my $secret = substr(md5_hex($data), 0, $SessionIDLength); # by having [0-1][0-f] as the first 2 chars, only 32 groups now, which remains # efficient for inactive sites, even with empty groups $secret =~ s/^(.)/0/; $secret; } sub RefreshSessionId { my($self, $id, $reset) = @_; $id || $self->Error("no id for refreshing"); my $internal = $self->{Internal}; $internal->LOCK; my $idata = $internal->{$id}; my $refresh_timeout = $reset ? $self->{session_timeout} : $idata->{refresh_timeout} || $self->{session_timeout}; $idata->{'timeout'} = time() + $refresh_timeout; $internal->{$id} = $idata; $internal->UNLOCK; $self->{dbg} && $self->Debug("refreshing $id with timeout $idata->{timeout}"); 1; } 1; Apache-ASP-2.63/lib/Apache/ASP/ApacheCommon.pm0000644000175000017500000000156711721310312016616 0ustar jobjobpackage Apache::ASP::ApacheCommon; eval { # Try new Apache2 module requests first require Apache2::RequestRec; require Apache2::RequestUtil; require Apache2::RequestIO; require Apache2::Response; require APR::Table; require APR::Pool; require Apache2::Connection; require Apache2::ServerUtil; require Apache2::ServerRec; require Apache2::SubRequest; require Apache2::Log; }; # per Warren Young, to work with mod_perls of 1.99_07 and _09 vintage if($@) { eval { # Alternative if above fails because system is old, but not # so old that it's incompatible. require Apache::RequestRec; require Apache::RequestUtil; require Apache::RequestIO; require Apache::Response; require APR::Table; require APR::Pool; require Apache::Connection; require Apache::ServerUtil; require Apache::SubRequest; require Apache::Log; }; } 1; Apache-ASP-2.63/lib/Apache/ASP/CGI.pm0000644000175000017500000001356311721310312014665 0ustar jobjob package Apache::ASP::CGI; # this package emulates an Apache request object with a CGI backend use Apache::ASP; use Apache::ASP::Request; use Class::Struct; use Apache::ASP::CGI::Table; use strict; no strict qw(refs); use vars qw($StructsDefined @END); $StructsDefined = 0; sub do_self { my $class = shift; if(defined($class)) { if(ref $class or $class =~ /Apache::ASP::CGI/) { # we called this OO style } else { unshift(@_, $class); $class = undef; } } my %config = @_; $class ||= 'Apache::ASP::CGI'; my $r = $class->init($0, @ARGV); $r->dir_config->set('CgiDoSelf', 1); $r->dir_config->set('NoState', 0); # init passed in config for(keys %config) { $r->dir_config->set($_, $config{$_}); } &Apache::ASP::handler($r); $r; } sub init { my($class, $filename, @args) = @_; $filename ||= $0; # for('Class/Struct.pm') { # next if require $_; # die("can't load the $_ library. please make sure you installed it"); # } # we define structs here so modperl users don't incur a runtime / memory unless($StructsDefined) { $StructsDefined = 1; &Class::Struct::struct( 'Apache::ASP::CGI::connection' => { 'remote_ip' => "\$", 'auth_type' => "\$", 'user' => "\$", 'aborted' => "\$", 'fileno' => "\$", } ); &Class::Struct::struct( 'Apache::ASP::CGI' => { 'connection'=> 'Apache::ASP::CGI::connection', 'content_type' => "\$", 'current_callback' => "\$", 'dir_config'=> "Apache::ASP::CGI::Table", 'env' => "\%", 'filename' => "\$", 'get_basic_auth_pw' => "\$", 'headers_in' => "Apache::ASP::CGI::Table", 'headers_out'=> "Apache::ASP::CGI::Table", 'err_headers_out' => "Apache::ASP::CGI::Table", 'subprocess_env' => "Apache::ASP::CGI::Table", 'method' => "\$", 'sent_header' => "\$", 'OUT' => "\$", } ); } # create struct my $self = new(); if(defined $ENV{GATEWAY_INTERFACE} and $ENV{GATEWAY_INTERFACE} =~ /^CGI/) { # nothing, don't need CGI object anymore } else { # command line my %args = @args; $ENV{QUERY_STRING} = join('&', map { "$_=$args{$_}" } keys %args); } $self->connection(Apache::ASP::CGI::connection->new); $self->dir_config(Apache::ASP::CGI::Table->new); $self->err_headers_out(Apache::ASP::CGI::Table->new); $self->headers_out(Apache::ASP::CGI::Table->new); $self->headers_in(Apache::ASP::CGI::Table->new); $self->subprocess_env(Apache::ASP::CGI::Table->new); my $env = $self->subprocess_env; %$env = %ENV; $self->filename($filename); $self->connection->remote_ip($ENV{REMOTE_HOST} || $ENV{REMOTE_ADDR} || '0.0.0.0'); $self->connection->aborted(0); $self->current_callback('PerlHandler'); # $self->headers_in->set('Cookie', $ENV{HTTP_COOKIE}); for my $env_key ( sort keys %ENV ) { if($env_key =~ /^HTTP_(.+)$/ or $env_key =~ /^(CONTENT_TYPE|CONTENT_LENGTH)$/) { my $env_header_in = $1; my $header_key = join('-', map { ucfirst(lc($_)) } split(/\_/, $env_header_in)); $self->headers_in->set($header_key, $ENV{$env_key}); } } # we kill the state for now stuff for now, as it's just leaving .state # directories everywhere you run this stuff defined($self->dir_config->get('NoState')) || $self->dir_config->set('NoState', 1); $self->method($ENV{REQUEST_METHOD} || 'GET'); for my $env_key ( keys %ENV ) { $self->env($env_key, $ENV{$env_key}); } $self->env('SCRIPT_NAME') || $self->env('SCRIPT_NAME', $filename); # fix truncated output in standalone CGI mode under Win32 binmode(STDOUT); bless $self, $class; } sub init_dir_config { my($self, %config) = @_; my $dir_config = $self->dir_config; %$dir_config = %config; $dir_config; } sub status { my($self, $status) = @_; if(defined($status)) { $self->headers_out->set('status', $status); } else { $self->headers_out->get('status'); } } sub cgi_env { %{$_[0]->env} ; } sub send_http_header { my($self) = @_; my($k, $v, $header); $self->sent_header(1); $header = "Content-Type: " .$self->content_type()."\n"; for my $headers ($self->headers_out, $self->err_headers_out) { while(($k, $v) = each %$headers) { next if ($k =~ /^content\-type$/i); if(ref $v) { # if ref, then we have an array for cgi_header_out for cookies for my $value (@$v) { $value ||= ''; $header .= "$k: $value\n"; } } else { $v ||= ''; $header .= "$k: $v\n"; } } } $header .= "\n"; $self->print($header); } sub send_cgi_header { my($self, $header) = @_; $self->sent_header(1); my(@left); for(split(/\n/, $header)) { my($name, $value) = split(/\:\s*/, $_, 2); if($name =~ /content-type/i) { $self->content_type($value); } else { push(@left, $_); } } $self->print(join("\n", @left, '')); $self->send_http_header(); } sub print { shift; local $| = 1; print STDOUT map { ref($_) =~ /SCALAR/ ? $$_ : $_; } @_; } sub args { my $self = shift; if(wantarray) { my $params = Apache::ASP::Request->ParseParams($ENV{QUERY_STRING}); %$params; } else { $ENV{QUERY_STRING}; } } *content = *args; sub log_error { my($self, @args) = @_; print STDERR @args, "\n"; } sub register_cleanup { push(@END, $_[1]); } # gets called when the $r get's garbage collected sub END { for ( @END ) { next unless $_; if(ref($_) && /CODE/) { my $rv = eval { &$_ }; if($@) { Apache::ASP::CGI->log_error("[ERROR] error executing register_cleanup code $_: $@"); } } } } sub soft_timeout { 1; }; sub lookup_uri { die('cannot call $Server->MapPath in CGI mode'); } sub custom_response { die('$Response->ErrorDocument not implemented for CGI mode'); } 1; Apache-ASP-2.63/lib/Apache/ASP/Collection.pm0000644000175000017500000000352011721310312016346 0ustar jobjob package Apache::ASP::Collection; use Apache::ASP::CollectionItem; use strict; sub Contents { my($self, $key) = @_; if(defined $key) { $self->Item($key); } else { $self; } } sub Item { my($self, $key, $value) = @_; my @rv; my $item_config = $main::Server->Config('CollectionItem'); if(defined $value) { if(ref($self->{$key}) and $self->{$key} =~ /HASH/) { # multi leveled collection go two levels down $rv[0] = $self->{$key}{$value}; } else { return $self->{$key} = $value; } } elsif(defined $key) { my $value = $self->{$key}; if (defined $value) { if(wantarray || $item_config) { @rv = (ref($value) =~ /ARRAY/o) ? @{$value} : ($value); } else { @rv = (ref($value) =~ /ARRAY/o) ? ($value->[0]) : ($value); } } else { $rv[0] = $value; } } else { # returns hash to self by default, so compat with # $Request->Form() & such null collection calls. return $self; } # coming from the collections we need this like # $Request->QueryString('foo')->Item() syntax, but is incompatible # with $Request->QueryString('foo') syntax if ($item_config) { $rv[0] = Apache::ASP::CollectionItem->new(\@rv); } wantarray ? @rv : $rv[0]; } sub Count { my $self = shift; scalar(keys %$self); } sub Key { my($self, $index) = @_; my @keys = sort(keys %$self); $keys[$index-1]; } sub SetProperty { my($self, $property, $key, $value) = @_; if($property =~ /property/io) { # do this to avoid recursion die("can't get the property $property for $self"); } else { $self->$property($key, $value); } } sub GetProperty { my($self, $property, $key) = @_; if($property =~ /property/io) { # do this to avoid recursion die("can't get the property $property for $self"); } else { $self->$property($key); } } 1; Apache-ASP-2.63/lib/Apache/ASP/Load.pm0000644000175000017500000000674011721310312015141 0ustar jobjobpackage Apache::ASP::Load; use Apache::ASP; use Apache::ASP::CGI::Table; use strict; no strict qw(refs); use vars qw(@Days @Months $AUTOLOAD $LOADED $COUNT); @Days = qw(Sun Mon Tue Wed Thu Fri Sat); @Months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); # we need a different class from Apache::ASP::CGI because we don't # want to force use of CGI & Class::Struct when loading ASP in Apache # also a nasty bug doesn't allow us to eval require's or use's, we # get a can't start_mutex sub new { my($file) = @_; bless { current_callback => 'PerlHandler', filename => $file, remote_ip => '127.0.0.1', user => undef, method => 'GET', NoState => 1, headers_in => Apache::ASP::CGI::Table->new, headers_out => Apache::ASP::CGI::Table->new, dir_config => Apache::ASP::CGI::Table->new, subprocess_env => Apache::ASP::CGI::Table->new, }; } sub AUTOLOAD { $AUTOLOAD =~ s/^(.*)::([^:]*)$/$2/; shift->{$AUTOLOAD}; } sub log_error { shift; my @times = localtime; printf STDERR ('[%s %s %02d %02d:%02d:%02d %d] [error] %s'."\n", $Days[$times[6]], $Months[$times[4]], $times[3], $times[2], $times[1], $times[0], $times[5] + 1900, join('', @_), ); } sub connection { shift; } sub Run { shift if(ref $_[0] or $_[0] eq 'Apache::ASP'); local $SIG{__WARN__} = \&Apache::ASP::Warn; my($file, $match, %args) = @_; unless(-e $file) { warn("$file does not exist for loading"); return; } $match ||= '.*'; # compile all by default # recurse down directories and compile the scripts if(-d $file && ! -l $file) { $file =~ s|/$||; opendir(DIR, $file) || die("can't open $file for reading: $!"); my @files = readdir(DIR); close DIR; unless(@files) { Apache::ASP::Load->log_error("[asp] $$ [WARN] can't read files in $file"); return; } my $top; if(! defined $LOADED) { $top = 1; } defined $LOADED or (local $LOADED = 0); defined $COUNT or (local $COUNT = 0); for(@files) { chomp; next if /^\.\.?$/; &Run("$file/$_", $match, %args); } if($top) { Apache::ASP::Load->log_error("[asp] $$ (re)compiled $LOADED scripts of $COUNT loaded for $file"); } return; } # now the real work unless($file =~ /$match/) { if($args{Debug} and $args{Debug} < 0) { Apache::ASP::Load->log_error("skipping compile of $file no match $match"); } return; } unless($file =~ /$match/) { if($args{Debug} < 0) { warn("skipping compile of $file no match $match"); } return; } my $r = Apache::ASP::Load::new($file); for my $key ( qw( Debug StatINC StatINCMatch ), @{Apache::ASP->CompileChecksumKeys} ) { $r->dir_config->set($key, $args{$key}); } $r->dir_config->set('NoState', 1); # RegisterIncludes created for precompilation, on by default here $r->dir_config->set('RegisterIncludes', 1); if ((defined $args{'RegisterIncludes'})) { $r->dir_config->set('RegisterIncludes', $args{'RegisterIncludes'}); } eval { $COUNT++; my $asp = Apache::ASP->new($r); # if StatINC* is configured, run on first script if(($COUNT == 1) && ($asp->config('StatINC') || $asp->config('StatINCMatch'))) { $asp->StatINC; } my $rv = $asp->CompileInclude($asp->{'basename'}) || die($@); if($args{'Execute'}) { local $^W = 0; local *Apache::ASP::Response::Flush = sub {}; $asp->Run; } $asp->DESTROY; $LOADED++; }; $@ && warn($@); return $LOADED; } 1; Apache-ASP-2.63/lib/Apache/ASP/Error.pm0000644000175000017500000001600411721310312015345 0ustar jobjob package Apache::ASP; sub ProcessErrors { my $self = shift; my $r = $self->{r}; my $status; # just to make sure we have everything we need for the errors templates $self->InitPackageGlobals; if($self->{dbg} >= 2) { $self->PrettyError(); $status = 200; } else { if($self->Response->{header_done}) { $self->{r}->print(""); } # debug of 2+ and mail_errors_to are mutually exclusive, # since debugging 2+ is for development, and you don't need to # be emailed the error, if its right in your browser $self->{mail_alert_to} = &config($self,'MailAlertTo') || 0; $self->{mail_errors_to} = &config($self,'MailErrorsTo') || 0; $self->{mail_errors_to} && $self->MailErrors(); $self->{mail_alert_to} && $self->MailAlert(); $status = 500; } } sub PrettyError { my($self) = @_; my $response = $self->{Response}; my $out = $response->{out}; $response->{ContentType} = 'text/html'; $$out = $self->PrettyErrorHelper(); $response->Flush(); 1; } sub PrettyErrorHelper { my $self = shift; my $response_buffer = $self->{Response}{out}; $self->{Response}->Clear(); my $errors_out = ''; my @eval_error_lines = (); if($self->{errors_output}[0]) { my($url, $file); $errors_out = join("\n
  • ", '', map { $self->Escape($_) } @{$self->{errors_output}}); # link in the line number to the compiled program $self->Debug("errors out $errors_out"); if($errors_out =~ s|\s+at\s+(.*?)\s+line\s+(\d+)| { my($file, $line_no) = ($1, $2); if($file =~ /\)/) { " at $file line $line_no"; } else { $url = $self->{Server}->URLEncode($file.' '.$line_no); " at $file line $line_no"; } } |exs ) { push(@eval_error_lines, $url); } } my $out = < Errors Output
      $errors_out
    Debug Output
      @{[join("\n
    1. ", '', map { $_ } @{$self->{debugs_output}}) ]}
    OUT
        ;
    
        # could be looking at a compilation error, then set the script to what
        # we were compiling (maybe global.asa), else its our real script
        # with probably a runtime error
        my $script;     
        if($self->{compile_error}) {    
    	$script = ${$self->{compile_eval}};
        }
        
        if($$response_buffer) {
    	my $length = &config($self, 'DebugBufferLength') || 100;
    	$out .= "Last $length Bytes of Buffered Output\n\n";
    	$out .= $self->Escape(substr($$response_buffer, -1 * $length));
    	$out .= "\n\n";
        }
    
        my $error_desc;
        if($script) {
    	$error_desc = "Compiled Data with Error";
        } else {
    	$error_desc = "ASP to Perl Script";
    	my $run_perl_script = $self->{run_perl_script};
    	$script = $run_perl_script ? $$run_perl_script : '';
        }
        $out .= "$error_desc \n\n";
    
        my($file_context, $lineno) = ('', 0);
        for(split(/\n/, $script)) {
    	my($lineprint, $lineurl,$frag);
    	if ($_ =~ /^#\s*line (\d+) (.+)$/){
    	    $lineno = $1;
    	    $file_context = $2;
    	    $lineurl = '  -';
    	} elsif (($lineno == 0)) {
    	    $lineurl = '  -';
    	} else {
    	    $frag = $self->{Server}->URLEncode($file_context.' '.$lineno);
    	    $lineurl = "".sprintf('%3d', $lineno)."";
    	    $lineno++;
    	}
    	$frag ||= '';
    	grep($frag eq $_, @eval_error_lines) && 
    	  ($lineurl = "$lineurl");
    	unless(&config($self, 'CommandLine')) {
    	    $_ = $self->Escape($_);
    	}
    
    	$out .= "$lineurl: $_\n";
        }
    
        $out .= <
    
    \n An error has occured with the Apache::ASP script just run. If you are the developer working on this script, and cannot work through this problem, please try researching it at the Apache::ASP web site, specifically the FAQ section. Failing that, check out your support options, and if necessary include this debug output with any query. OUT ; $out; } sub MailErrors { my $self = shift; # email during register cleanup so the user doesn't have # to wait, and possible cancel the mail by pressing "STOP" $self->Log("registering error mail to $self->{mail_errors_to} for cleanup phase"); my $body_ref; eval { # there was a "use strict" + warn error while compiling this template local $^W = 0; $body_ref = $self->Response->TrapInclude('Share::CORE/MailErrors.inc', COMPILE_ERROR => $self->PrettyErrorHelper ); }; if($@) { $self->Error("error creating error mail in MailErrors(): $@"); return; } my($subject,$body); if($$body_ref =~ /^\s+Subject:\s*(.*?)\s*\n\s*(.*)$/is) { ($subject,$body) = ($1,$2); } else { ($subject,$body) = ('Apache::ASP::Error', $$body_ref); } $self->{Server}->RegisterCleanup ( sub { for(1..3) { my $success = $self->SendMail ({ To => $self->{mail_errors_to}, From => &config($self, 'MailFrom') || $self->{mail_errors_to}, Subject => $subject, Body => $body, 'Content-Type' => 'text/html', }); if($success) { last; } else { $self->Error("can't send errors mail to $self->{mail_errors_to}"); } } }); } sub MailAlert { my $self = shift; unless($self->{mail_alert_period}) { $self->{mail_alert_period} = &config($self, 'MailAlertPeriod', undef, 20); } # if we have the internal database defined, check last time the alert was # sent, and if the alert period is up, send again if(defined $self->{Internal}) { my $time = time; if(defined $self->{Internal}{mail_alert_time}) { my $alert_in = $self->{Internal}{mail_alert_time} + $self->{mail_alert_period} * 60 - $time; if($alert_in <= 0) { $self->{Internal}{mail_alert_time} = $time; } else { # not time to send an alert again $self->Debug("will alert again in $alert_in seconds"); return 1; } } else { $self->{Internal}{mail_alert_time} = $time; } } else { $self->Log("mail alerts will be sent every time. turn NoState off so that ". "alerts can be sent only every $self->{mail_alert_period} minutes"); } my $host = ''; if($self->LoadModules('MailAlert', 'Net::Domain')) { $host = Net::Domain::hostname(); } # email during register cleanup so the user doesn't have # to wait, and possible cancel the mail by pressing "STOP" $self->Log("registering alert mail to $self->{mail_alert_to} for cleanup phase"); $self->{Server}->RegisterCleanup ( sub { for(1..3) { my $success = $self->SendMail({ To => $self->{mail_alert_to}, From => &config($self, 'MailFrom', undef, $self->{mail_alert_to}), Subject => join('-', 'ASP-ALERT', $host), Body => "$self->{global}-$ENV{SCRIPT_NAME}", }); if($success) { last; } else { $self->Error("can't send alert mail to $self->{mail_alert_to}"); } } }); } 1; Apache-ASP-2.63/lib/Apache/ASP/Server.pm0000644000175000017500000001104012336747511015537 0ustar jobjob package Apache::ASP::Server; use strict; use vars qw($OLESupport); sub new { bless {asp => $_[0]}; } sub CreateObject { my($self, $name) = @_; my $asp = $self->{asp}; # dynamically load OLE at request time, especially since # at server startup, this seems to fail with "start_mutex" error # # no reason to preload this unix style when module loads # because in win32, threaded model does not need this prefork # parent httpd compilation # unless(defined $OLESupport) { eval 'use Win32::OLE'; if($@) { $OLESupport = 0; } else { $OLESupport = 1; } } unless($OLESupport) { die "OLE-active objects not supported for this platform, ". "try installing Win32::OLE"; } unless($name) { die "no object to create"; } Win32::OLE->new($name); } sub Execute { my $self = shift; $self->{asp}{Response}->Include(@_); } sub File { shift->{asp}{filename}; } sub Transfer { my $self = shift; my $file = shift; # find the file we are about to execute, and alias $0 to it my $file_found; if(ref($file)) { if($file->{File}) { $file_found = $self->{asp}->SearchDirs($file->{File}); } } else { $file_found = $self->{asp}->SearchDirs($file); } my $file_final = defined($file_found) ? $file_found : $0; local *0 = \$file_final; $self->{asp}{Response}->Include($file, @_); $self->{asp}{Response}->End; } # shamelessly ripped off from CGI.pm, by Lincoln D. Stein. sub URLEncode { my $toencode = $_[1]; $toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/esg; $toencode; } sub HTMLDecode { my($self, $decode) = @_; $decode=~s/>/>/sg; $decode=~s/<//>/sg; $$data_ref =~ s//>/sg; $toencode =~ s/{asp}{dbg} && $self->{asp}->Debug("RegisterCleanup() called", caller()); push(@{$self->{asp}{cleanup}}, $code); } else { $self->{asp}->Error("$code need to be a perl sub reference, see README"); } } sub MapInclude { my($self, $file) = @_; $self->{asp}->SearchDirs($file); } sub MapPath { my($self, $path) = @_; my $subr = $self->{asp}{r}->lookup_uri($path); $subr ? $subr->filename : undef; } *SendMail = *Mail; sub Mail { shift->{asp}->SendMail(@_); } sub URL { my($self, $url, $params) = @_; $params ||= {}; if($url =~ s/\?(.*)$//is) { my $old_params = $self->{asp}{Request}->ParseParams($1); $old_params ||= {}; $params = { %$old_params, %$params }; } my $asp = $self->{asp}; if($asp->{session_url} && $asp->{session_id} && ! $asp->{session_cookie}) { my $match = $asp->{session_url_match}; if( # if we have match expression, try it ($match && $url =~ /$match/) # then if server path, check matches cookie space || ($url =~ m|^/| and $url =~ m|^$asp->{cookie_path}|) # then do all local paths, matching NOT some URI PROTO || ($url !~ m|^[^\?\/]+?:|) ) { # this should overwrite an incorrectly passed in data $params->{$Apache::ASP::SessionCookieName} = $asp->{session_id}; } } my($k,$v, @query); # changed to use sort so this function outputs the same URL every time for my $k ( sort keys %$params ) { my $v = $params->{$k}; # inline the URLEncode function for speed $k =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/egs; my @values = (ref($v) and ref($v) eq 'ARRAY') ? @$v : ($v); for my $value ( @values ) { $value =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/egs; push(@query, $k.'='.$value); } } if(@query) { $url .= '?'.join('&', @query); } $url; } sub XSLT { my($self, $xsl_data, $xml_data) = @_; $self->{asp}->XSLT($xsl_data, $xml_data); } sub Config { shift->{asp}->config(@_); } 1; Apache-ASP-2.63/lib/Apache/ASP/State.pm0000644000175000017500000002242511721310312015340 0ustar jobjobpackage Apache::ASP::State; use MLDBM; use MLDBM::Sync 0.25; use MLDBM::Sync::SDBM_File; use SDBM_File; use Data::Dumper; use strict; no strict qw(refs); use vars qw(%DB %CACHE $DefaultGroupIdLength); use Fcntl qw(:flock O_RDWR O_CREAT); $DefaultGroupIdLength = 2; # Database formats supports and their underlying extensions %DB = ( SDBM_File => ['.pag', '.dir'], DB_File => [''], 'MLDBM::Sync::SDBM_File' => ['.pag', '.dir'], GDBM_File => [''], 'Tie::TextDir' => [''], ); # About locking, we use a separate lock file from the SDBM files # generated because locking directly on the SDBM files occasionally # results in sdbm store errors. This is less efficient, than locking # to the db file directly, but having a separate lock file works for now. # # If there is no $group given, then the $group will be extracted from # the $id as the first 2 letters of that group. # # If the group and the id are the same length, then what was passed # was just a group id, and the object is being created for informational # purposes only. So, we don't create a lock file in this case, as this # is not a real State object # sub new { my($asp, $id, $group) = @_; if($id) { $id =~ tr///; } else { $asp->Error("no id: $id passed into new State"); return; } # default group is first 2 characters of id, simple hashing if($group) { $group =~ tr///; } else { $group = substr($id, 0, $DefaultGroupIdLength) } unless($group) { $asp->Error("no group defined for id $id"); return; } my $state_dir = $asp->{state_dir}; my $group_dir = $state_dir.'/'.$group; my $lock_file = $group_dir.'/'.$id.'.lock'; my $file = $group_dir.'/'.$id; # we only need SDBM_File for internal, and its faster so use it my($state_db, $state_serializer); if($id eq 'internal') { $state_db = $Apache::ASP::DefaultStateDB; $state_serializer = $Apache::ASP::DefaultStateSerializer; } elsif($asp->{Internal} && (length($id) > $DefaultGroupIdLength)) { # don't get data for dummy group id sessions my $internal = $asp->{Internal}; my $idata = $internal->{$id}; if(! $idata->{state_db} || ! $idata->{state_serializer}) { $state_db = $idata->{state_db} || $asp->{state_db} || $Apache::ASP::DefaultStateDB; $state_serializer = $idata->{state_serializer} || $asp->{state_serializer} || $Apache::ASP::DefaultStateSerializer; # INIT StateDB && StateSerializer if hitting for the first time # only if real id like a session id or application if(length($id) > $DefaultGroupIdLength) { my $diff = 0; if(($idata->{state_db} || $Apache::ASP::DefaultStateDB) ne $state_db) { $idata->{state_db} = $state_db; $diff = 1; } if(($idata->{state_serializer} || $Apache::ASP::DefaultStateSerializer) ne $state_serializer) { $idata->{state_serializer} = $state_serializer; $diff = 1; } if($diff) { $asp->{dbg} && $asp->Debug("setting internal data for state $id", $idata); $internal->{$id} = $idata; } } } else { # this state has already been created $state_db = $idata->{state_db}; $state_serializer = $idata->{state_serializer}; } } else { # cache layer doesn't need internal ($state_db, $state_serializer) = ($asp->{state_db}, $asp->{state_serializer}); } my $self = bless { asp=>$asp, dbm => undef, 'dir' => $group_dir, id => $id, file => $file, group => $group, group_dir => $group_dir, reads => 0, state_dir => $state_dir, writes => 0, }; # short circuit before expensive directory tests for group stub if ($group eq $id) { return $self; } if($asp->config('StateAllWrite')) { $asp->{dbg} and $asp->{state_all_write} = 1; $self->{dir_perms} = 0777; $self->{file_perms} = 0666; } elsif($asp->config('StateGroupWrite')) { $asp->{dbg} and $asp->{state_group_write} = 1; $self->{dir_perms} = 0770; $self->{file_perms} = 0660; } else { $self->{dir_perms} = 0750; $self->{file_perms} = 0640; } # push(@{$self->{'ext'}}, @{$DB{$self->{state_db}}}); # $self->{asp}->Debug("db ext: ".join(",", @{$self->{'ext'}})); # create state directories my @create_dirs; unless(-d $state_dir) { push(@create_dirs, $state_dir); } # create group directory unless(-d $group_dir) { push(@create_dirs, $group_dir); } if(@create_dirs) { $self->UmaskClear; for my $create_dir (@create_dirs) { # $create_dir =~ tr///; # this doesn't work to untaint with perl 5.6.1, use old method $create_dir =~ /^(.*)$/s; $create_dir = $1; if(mkdir($create_dir, $self->{dir_perms})) { $asp->{dbg} && $asp->Debug("creating state dir $create_dir"); } else { my $error = $!; -d $create_dir || $self->{asp}->Error("can't create group dir $create_dir: $error"); } } $self->UmaskRestore; } # INIT MLDBM::Sync DBM { local $MLDBM::UseDB = $state_db || 'SDBM_File'; local $MLDBM::Serializer = $state_serializer || 'Data::Dumper'; # clear current tied relationship first, if any $self->{dbm} = undef; local $SIG{__WARN__} = sub {}; my $error; $self->{file} =~ /^(.*)$/; # untaint $self->{file} = $1; local $MLDBM::RemoveTaint = 1; $self->{dbm} = &MLDBM::Sync::TIEHASH('MLDBM', $self->{file}, O_RDWR|O_CREAT, $self->{file_perms}); $asp->{dbg} && $asp->Debug("creating dbm for file $self->{file}, db $MLDBM::UseDB, serializer: $MLDBM::Serializer"); $error = $! || 'Undefined Error'; if(! $self->{dbm}) { $self->{asp}->Error(qq{ Cannot tie to file $self->{file}, $error !! Make sure you have the permissions on the directory set correctly, and that your version of Data::Dumper is up to date. Also, make sure you have set StateDir to to a good directory in the config file. StateDir defaults to Global/.state }); } } $self; } sub Init { shift->{dbm}->CLEAR(); } sub Size { shift->{dbm}->SyncSize; } sub Delete { shift->{dbm}->CLEAR(); } sub WriteLock { shift->{dbm}->Lock; } sub ReadLock { shift->{dbm}->ReadLock; } sub UnLock { shift->{dbm}->UnLock; } sub DeleteGroupId { my $self = shift; my $group_dir = $self->{group_dir}; if(-d $group_dir) { $self->{asp}{Internal}->LOCK; if(rmdir($group_dir)) { $self->{asp}->Debug("deleting group dir $group_dir"); } else { $self->{asp}->Log("cannot delete group dir $group_dir: $!"); } $self->{asp}{Internal}->UNLOCK; } } sub GroupId { shift->{group}; } sub GroupMembers { my $self = shift; local(*DIR); my(%ids, @ids); unless(opendir(DIR, $self->{group_dir})) { $self->{asp}->Log("opening group $self->{group_dir} failed: $!"); return []; } for(readdir(DIR)) { next if /^\.\.?$/; $_ =~ /^(.*?)(\.[^\.]+)?$/; next unless $1; $ids{$1}++; } # need to explicitly close directory, or we get a file # handle leak on Solaris closedir(DIR); # since not all sessions have their own dbms now, find session ids in $Internal too if(my $internal = $self->{asp}{Internal}) { my $cached_keys = {}; unless($cached_keys = $self->{asp}{internal_cached_keys}) { map { if(/^([0-9a-f]{2})/) { $cached_keys->{$1}{$_}++ } } keys %$internal; $self->{asp}{internal_cached_keys} = $cached_keys; } if(my $group_keys = $cached_keys->{$self->{group}}) { %ids = ( %ids, %$group_keys ); } } @ids = keys %ids; \@ids; } sub DefaultGroups { my $self = shift; my(@ids); local *STATEDIR; opendir(STATEDIR, $self->{state_dir}) || $self->{asp}->Error("can't open state dir $self->{state_dir}"); my $time = time; for(readdir(STATEDIR)) { next if /^\./; next unless (length($_) eq $DefaultGroupIdLength); push(@ids, $_); } closedir STATEDIR; \@ids; } sub UmaskClear { my $self = shift; return if $self->{asp}{win32}; $self->{umask_restore} = umask(0000); } sub UmaskRestore { my $self = shift; return if $self->{asp}{win32}; if(defined $self->{umask_restore}) { umask($self->{umask_restore}); } } sub DESTROY { my $self = shift; return unless %{$self}; return if $self->{destroyed}++; $self->{dbm} && eval { $self->{dbm}->DESTROY }; $self->{dbm} = undef; } # don't need to skip DESTROY since we have it defined # return if ($AUTOLOAD =~ /DESTROY/); sub AUTOLOAD { my $self = shift; my $AUTOLOAD = $Apache::ASP::State::AUTOLOAD; $AUTOLOAD =~ s/^(.*)::(.*?)$/$2/o; my $value; $value = $self->{dbm}->$AUTOLOAD(@_); $value; } sub TIEHASH { my $type = shift; # dual tie contructor, if we receive a State object to tie # then just return it, otherwise construct a new object # before tieing if((ref $_[0]) =~ /State/) { $_[0]; } else { bless &new(@_), $type; } } sub FETCH { my($self, $index) = @_; my $value; if($index eq '_FILE') { $value = $self->{file}; } elsif($index eq '_SELF') { $value = $self; } else { $value = $self->{dbm}->FETCH($index); $self->{reads}++; } $value; } sub STORE { my $self = shift; # don't worry about overhead of Umask* routines, the STORE # being called is much heavier $self->UmaskClear; my $rv = $self->{dbm}->STORE(@_); $self->UmaskRestore; $self->{writes}++; $rv; } sub LOCK { my $self = tied(%{$_[0]}); $self->{dbm}->Lock(); } sub UNLOCK { my $self = tied(%{$_[0]}); $self->{dbm}->UnLock(); } 1; Apache-ASP-2.63/lib/Apache/ASP/StatINC.pm0000644000175000017500000001503411721310312015523 0ustar jobjob package Apache::ASP; # quickly decomped out of Apache::ASP just to optionally load # it at runtime for CGI programs ( which shouldn't need it anyway ) # will still precompile this for mod_perl use strict; use vars qw( $StatINCReady $StatINCInit %Stat $StatStartTime ); $StatStartTime = time(); # Apache::StatINC didn't quite work right, so writing own sub StatINCRun { my $self = shift; my $stats = 0; # include necessary libs, without nice error message... # we only do this once if successful, to speed up code a bit, # and load success bool into global. otherwise keep trying # to generate consistent error messages unless($StatINCReady) { my $ready = 1; for('Devel::Symdump') { eval "use $_"; if($@) { $ready = 0; $self->Error("You need $_ to use StatINC: $@ ... ". "Please download it from your nearest CPAN"); } } $StatINCReady = $ready; } return unless $StatINCReady; # make sure that we have pre-registered all the modules before # this only happens on the first request of a new process unless($StatINCInit) { $StatINCInit = 1; $self->Debug("statinc init"); $self->StatRegisterAll(); } while(my($key,$file) = each %INC) { if($self->{stat_inc_match} && defined $Stat{$file}) { # we skip only if we have already registered this file # we need to register the codes so we don't undef imported symbols next unless ($key =~ /$self->{stat_inc_match}/); } next unless (-e $file); # sometimes there is a bad file in the %INC my $mtime = (stat($file))[9]; # its ok if this block is CPU intensive, since it should only happen # when modules get changed, and that should be infrequent on a production site if(! defined $Stat{$file}) { $self->{dbg} && $self->Debug("loading symbols first time", { $key => $file}); $self->StatRegister($key, $file, $mtime); } elsif($mtime > $Stat{$file}) { $self->{dbg} && $self->Debug("reloading", {$key => $file}); $stats++; # count files we have reloaded $self->StatRegisterAll(); # we need to explicitly re-register a namespace that # we are about to undef, in case any imports happened there # since last we checked, so we don't delete duplicate symbols $self->StatRegister($key, $file, $mtime); my $class = &File2Class($key); my $sym = Devel::Symdump->new($class); my $function; my $is_global_package = $class eq $self->{GlobalASA}{'package'} ? 1 : 0; my @global_events_list = $self->{GlobalASA}->EventsList; for $function ($sym->functions()) { my $code = \&{$function}; if($function =~ /::O_[^:]+$/) { $self->Debug("skipping undef of troublesome $function"); next; } if($Apache::ASP::Codes{$code}{count} > 1) { $self->Debug("skipping undef of multiply defined $function: $code"); next; } if($is_global_package) { # skip undef if id is an include or script if($function =~ /::__ASP_/) { $self->Debug("skipping undef compiled ASP sub $function"); next; } if(grep($function eq $class."::".$_, @global_events_list)) { $self->Debug("skipping undef global event $function"); next; } if($Apache::ASP::ScriptSubs{$function}) { $self->Debug("skipping undef script subroutine $function"); next; } } $self->{dbg} && $self->Debug("undef code $function: $code"); undef(&$code); # method for perl 5.6.1 delete $Apache::ASP::Codes{$code}; undef($code); # older perls } # extract the lib, just incase our @INC went away (my $lib = $file) =~ s/$key$//g; push(@INC, $lib); # don't use "use", since we don't want symbols imported into ASP delete $INC{$key}; $self->Debug("loading $key with require"); eval { require($key); }; if($@) { $INC{$key} = $file; # make sure we keep trying to reload it $self->Error("can't require/reload $key: $@"); next; } # if this was the same module as the global.asa package, # then we need to reload the global.asa, since we just # undef'd the subs if($is_global_package) { # we just undef'd the global.asa routines, so these too # must be recompiled $self->Debug("reloading global.asa file after clearing package namespace"); delete $Apache::ASP::Compiled{$self->{GlobalASA}{'id'}}; &Apache::ASP::GlobalASA::new($self); } $self->StatRegister($key, $file, $mtime); # we want to register INC now in case any new libs were # added when this module was reloaded $self->StatRegisterAll(); } } $stats; } sub StatRegister { my($self, $key, $file, $mtime) = @_; # keep track of times $Stat{$file} = $mtime; # keep track of codes, don't undef on codes # with multiple refs, since these are exported my $class = &File2Class($key); # we skip Apache stuff as on some platforms (RedHat 6.0) # Apache::OK seems to error when getting its code ref # these shouldn't be reloaded anyway, as they are internal to # modperl and should require a full server restart if($class eq 'Apache' or $class eq 'Apache::Constants') { $self->Debug("skipping StatINC register of $class"); return; } $self->{dbg} && $self->Debug("stat register of $key $file $class"); if($class eq 'CGI') { # must compensate for its autoloading behavior, and # precompile all the routines, so we can register them # and not delete them later CGI->compile(':all'); } my $sym = Devel::Symdump->new($class); my $function; for $function ($sym->functions()) { my $code = \&{$function}; unless($code =~ /CODE/) { $self->Debug("no code ref for function $function"); next; } # don't update if we already have this code defined for this func. next if $Apache::ASP::Codes{$code}{funcs}{$function}; # $self->Debug("code $code for $function"); $Apache::ASP::Codes{$code}{count}++; $Apache::ASP::Codes{$code}{libs}{$key}++; $Apache::ASP::Codes{$code}{funcs}{$function}++; } 1; } sub StatRegisterAll { my $self = shift; # we make sure that all modules that are loaded are registered # so we don't undef exported subroutines, when we reload my($key, $file); while(($key,$file) = each %INC) { next if defined $Stat{$file}; next unless -e $file; # we use the module load time to init, in case it was # pulled in with PerlModule, and has changed since, # so it won't break with a graceful restart $self->StatRegister($key, $file, $StatStartTime - 1); } 1; } sub File2Class { my $file = shift; return $file unless $file =~ s,\.pm$,,; $file =~ s,/,::,g; $file; } 1; Apache-ASP-2.63/lib/Apache/ASP/STDERR.pm0000644000175000017500000000062111721310312015255 0ustar jobjobpackage Apache::ASP::STDERR; # don't know what this code is used for, but keeping # it around in case I find out! --jc 4/20/2002 use strict; # alias printing to the response object sub TIEHANDLE { bless { asp => $_[1] }; } sub PRINT { shift->{asp}->Out(@_); } sub PRINTF { my($self, $format, @list) = @_; my $output = sprintf($format, @list); $self->{asp}->Out($output); } 1; Apache-ASP-2.63/lib/Apache/ASP/Date.pm0000644000175000017500000001364411721310312015140 0ustar jobjobpackage Apache::ASP::Date; # This package code was taken from HTTP::Date, written by Gisle Aas # Copyright 1995-1997, Gisle Aas # This library is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require 5.002; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(time2str str2time); @EXPORT_OK = qw(time2iso time2isoz); use Time::Local (); use strict; use vars qw(@DoW @MoY %MoY); #@DoW = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); @DoW = qw(Sun Mon Tue Wed Thu Fri Sat); @MoY = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); # Build %MoY hash my $i = 0; foreach(@MoY) { $MoY{lc $_} = $i++; } my($current_month, $current_year) = (localtime)[4, 5]; sub time2str (;$) { my $time = shift; $time = time unless defined $time; my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($time); sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT", $DoW[$wday], $mday, $MoY[$mon], $year+1900, $hour, $min, $sec); } sub str2time ($;$) { local($_) = shift; return undef unless defined; my($default_zone) = @_; # Remove useless weekday, if it exists s/^\s*(?:sun|mon|tue|wed|thu|fri|sat)\w*,?\s*//i; my($day, $mon, $yr, $hr, $min, $sec, $tz, $aorp); my $offset = 0; # used when compensating for timezone PARSEDATE: { # Then we are able to check for most of the formats with this regexp ($day,$mon,$yr,$hr,$min,$sec,$tz) = /^\s* (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* ([-+]?\d{2,4}|GMT|gmt)? # timezone \s*$ /x and last PARSEDATE; # Try the ctime and asctime format ($mon, $day, $hr, $min, $sec, $tz, $yr) = /^\s* # allow intial whitespace (\w{1,3}) # month \s+ (\d\d?) # day \s+ (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds \s+ (?:(GMT|gmt)\s+)? # optional GMT timezone (\d+) # year \s*$ # allow trailing whitespace /x and last PARSEDATE; # Then the Unix 'ls -l' date format ($mon, $day, $yr, $hr, $min, $sec) = /^\s* (\w{3}) # month \s+ (\d\d?) # day \s+ (?: (\d\d\d\d) | # year (\d{1,2}):(\d{2}) # hour:min (?::(\d\d))? # optional seconds ) \s*$ /x and last PARSEDATE; # ISO 8601 format '1996-02-29 12:00:00 -0100' and variants ($yr, $mon, $day, $hr, $min, $sec, $tz) = /^\s* (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|:|T|-) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d))? # optional seconds )? # optional clock \s* ([-+]?\d\d?:?(:?\d\d)? |Z|z)? # timezone (Z is "zero meridian", i.e. GMT) \s*$ /x and last PARSEDATE; # Windows 'dir' 11-12-96 03:52PM ($mon, $day, $yr, $hr, $min, $aorp) = /^\s* (\d{2}) # numerical month - (\d{2}) # day - (\d{2}) # year \s+ (\d\d?):(\d\d)([apAP][mM]) # hour:min AM or PM \s*$ /x and last PARSEDATE; # If it is not recognized by now we give up return undef; } # Translate month name to number if ($mon =~ /^\d+$/) { # numeric month return undef if $mon < 1 || $mon > 12; $mon--; } else { $mon = lc $mon; return undef unless exists $MoY{$mon}; $mon = $MoY{$mon}; } # If the year is missing, we assume some date before the current, # because these date are mostly present on "ls -l" listings. unless (defined $yr) { $yr = $current_year; $yr-- if $mon > $current_month; } # Then we check if the year is acceptable return undef if $yr > 99 && $yr < 1900; # We ignore these years $yr += 100 if $yr < 50; # a stupid thing to do??? $yr -= 1900 if $yr >= 1900; # The $yr is now relative to 1900 (as expected by timelocal()) # timelocal() seems to go into an infinite loop if it is given out # of range parameters. Let's check the year at least. # Epoch counter maxes out in year 2038, assuming "time_t" is 32 bit return undef if $yr > 138; return undef if $yr < 70; # 1970 is Unix epoch # Compensate for AM/PM if ($aorp) { $aorp = uc $aorp; $hr = 0 if $hr == 12 && $aorp eq 'AM'; $hr += 12 if $aorp eq 'PM' && $hr != 12; } # Make sure things are defined for ($sec, $min, $hr) { $_ = 0 unless defined } # Should we compensate for the timezone? $tz = $default_zone unless defined $tz; return eval {Time::Local::timelocal($sec, $min, $hr, $day, $mon, $yr)} unless defined $tz; # We can calculate offset for numerical time zones if ($tz =~ /^([-+])?(\d\d?):?(\d\d)?$/) { $offset = 3600 * $2; $offset += 60 * $3 if $3; $offset *= -1 if $1 && $1 ne '-'; } eval{Time::Local::timegm($sec, $min, $hr, $day, $mon, $yr) + $offset}; } # And then some bloat because I happen to like the ISO 8601 time # format. sub time2iso (;$) { my $time = shift; $time = time unless defined $time; my($sec,$min,$hour,$mday,$mon,$year) = localtime($time); sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year+1900, $mon+1, $mday, $hour, $min, $sec); } sub time2isoz (;$) { my $time = shift; $time = time unless defined $time; my($sec,$min,$hour,$mday,$mon,$year) = gmtime($time); sprintf("%04d-%02d-%02d %02d:%02d:%02dZ", $year+1900, $mon+1, $mday, $hour, $min, $sec); } 1; Apache-ASP-2.63/lib/Apache/ASP/CollectionItem.pm0000644000175000017500000000101411721310312017161 0ustar jobjob package Apache::ASP::CollectionItem; use strict; # for support of $Request->QueryString->('foo')->Item() syntax sub new { my($package, $rv) = @_; my @items = @$rv; bless { 'Item' => $items[0], 'Items' => \@items, 'Count' => defined $items[0] ? scalar(@items) : 0, }, $package; } sub Count { shift->{Count} }; sub Item { my($self, $index) = @_; my $items = $self->{Items}; if(defined $index) { $items->[$index-1]; } else { wantarray ? @$items : $items->[0]; } } 1; Apache-ASP-2.63/CHANGES0000644000175000017500000000247412337417341012363 0ustar jobjob$MODULE=Apache::ASP; $VERSION = 2.63; $DATE="2014/05/20" + fixed $r->connection()->remote_ip() to use useragent_ip(), then client_ip() access for Apache 2.4 + Added section ``raw'' to MailErrors.inc to debug POSTs without form fields - MailErrorsHTML now uses monospaced fonts for errors. Easier on the eyes and more informative - Added a clumsy regex to avoid header longer than 70 chars - removed deprecated "Extra" module references from Makefile.PL and Bundle::Apache::ASP::Extra, including Apache::Filter, Apache::SSI, Bundle::XML, XML::Sablotron, and Tie::TextDir $MODULE=Apache::ASP; $VERSION = 2.62; $DATE="2011/08/16" - Fixed 'application/x-www-form-urlencoded' for AJAX POSTs post Firefox 3.x + First sourceforge.net hosted version + Incremented version number to actually match SVN branch tag + Switched to Big-endian date format in the documentation. Less chance of misunderstandings $MODULE=Apache::ASP; $VERSION = 2.61; $DATE="05/24/2008" Please see README for changes for past versions. + = improvement; - = bug fix; (d) = documentation - updated for more recent mod_perl 2 environment to trigger correct loading of modules + loads modules in a backwards compatible way for older versions of mod_perl 1.99_07 to 1.99_09 + license changes from GPL to Perl Artistic License Apache-ASP-2.63/site/0000755000175000017500000000000013252400404012312 5ustar jobjobApache-ASP-2.63/site/ssi.html0000644000175000017500000003261013252377727014025 0ustar jobjob Apache::ASP::Ssi
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
    % SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    SSI
    SSI is great! One of the main features of server side includes is to include other files in the script being requested. In Apache::ASP, this is implemented in a couple ways, the most crucial of which is implemented in the file include. Formatted as
     <!--#include file=filename.inc-->
    
    ,the .inc being merely a convention, text from the included file will be inserted directly into the script being executed and the script will be compiled as a whole. Whenever the script or any of its includes change, the script will be recompiled.
    Includes go a great length to promote good decomposition and code sharing in ASP scripts, but they are still fairly static. As of version .09, includes may have dynamic runtime execution, as subroutines compiled into the global.asa namespace. The first way to invoke includes dynamically is
     <!--#include file=filename.inc args=@args-->
    
    If @args is specified, Apache::ASP knows to execute the include at runtime instead of inlining it directly into the compiled code of the script. It does this by compiling the script at runtime as a subroutine, and caching it for future invocations. Then the compiled subroutine is executed and has @args passed into its as arguments.
    This is still might be too static for some, as @args is still hardcoded into the ASP script, so finally, one may execute an include at runtime by utilizing this API extension
       $Response->Include("filename.inc", @args);
    
    which is a direct translation of the dynamic include above.
    Although inline includes should be a little faster, runtime dynamic includes represent great potential savings in httpd memory, as includes are shared between scripts keeping the size of each script to a minimum. This can often be significant saving if much of the formatting occurs in an included header of a www page.
    By default, all includes will be inlined unless called with an args parameter. However, if you want all your includes to be compiled as subs and dynamically executed at runtime, turn the DynamicIncludes config option on as documented above.

    Apache::SSI for mod_perl 1.3.x only SSI with mod_filter in Apache 2

    Apache::SSI for mod_perl 1.3.x only

    One of the things missing above is the 
    
     <!--#include virtual=filename.cgi-->
    
    tag. This and many other SSI code extensions are available by filtering Apache::ASP output through Apache::SSI via the Apache::Filter and the Filter config options, available in mod_perl 1.3.x / Apache 1.3.x. Unfortunately this functionality is not available with mod_perl 2 / Apache 2.
    For more information on how to wire Apache::ASP and Apache::SSI together, please see the Filter config option documented above. Also please see Apache::SSI for further information on the capabilities it offers.

    SSI with mod_filter in Apache 2

    Apache 2 offers chained filters.  It may be possible to chain filters to
    Apache::ASP output through mod_filter for SSI processing:
    
      http://httpd.apache.org/docs/2.1/mod/mod_filter.html
    
     
    Apache-ASP-2.63/site/eg/0000755000175000017500000000000013252400404012705 5ustar jobjobApache-ASP-2.63/site/eg/default.htm0000755000175000017500000000010311721310312015035 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl Apache-ASP-2.63/site/eg/error_document.htm0000755000175000017500000000126411721310312016451 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% if(! $ENV{MOD_PERL}) { print "ERROR: \$Response->ErrorDocument() is not implemented in CGI mode\n"; $Response->End; } %> <% my $file = DemoASP->new->{file}; $Response->Status('404'); my $padding = ' ' x 1000; # IE Error page busting ( 512 bytes needed ) $Response->ErrorDocument('404', <Custom 404 Error This is a custom response for the 404 error, that this script just created, utilizing the \$Response->ErrorDocument(\$error_code, \$uri) method.

    view this file's source $padding ERROR ; %> This should not be printed Apache-ASP-2.63/site/eg/asp.conf0000644000175000017500000000125713252362627014362 0ustar jobjob # base config for all site/eg asp scripts %Config = ( Debug => 3, MailHost => 'localhost', TimeHiRes => 1, XMLSubsMatch => 'my:\w+', GlobalPackage => 'Apache::ASP::Demo', BufferingOn => 1, FileUploadMax => 200000, FileUploadTemp => 1, StateDir => '/tmp/aspcgidemo', ); if($0 =~ /asp$/) { $Config{NoState} = 0; } else { $Config{NoState} = 1; } if($0 =~ /xml_subs_strict.asp/) { $Config{XMLSubsStrict} = 1; } if($0 =~ /\.xml$/) { $Config{XSLT} = 'template.xsl', $Config{XSLTCache} = 1, $Config{CacheDir} = '/tmp/aspcgidemo_cache'; } if($0 =~ /session_query_parse/) { $Config{SessionQueryParse} = 1; } if($0 =~ /cgi.htm/) { $Config{CgiHeaders} = 1; } Apache-ASP-2.63/site/eg/.htaccess0000644000175000017500000000445613252363046014526 0ustar jobjob# Note this file was used for Apache 1.3.0 # Please see the readme, for what exactly the config variables do. PerlSetVar Global . PerlSetVar GlobalPackage Apache::ASP::Demo PerlSetVar StateDir /tmp/asp_demo PerlSetVar StatINC 0 PerlSetVar StatINCMatch 0 PerlSetVar Clean 0 PerlSetVar DynamicIncludes 1 PerlSetVar FileUploadMax 200000 PerlSetVar FileUploadTemp 1 PerlSetVar SessionQueryParse 0 PerlSetVar SessionQuery 1 #PerlSetVar Debug 2 PerlSetVar Debug -3 PerlSetVar StateCache 0 PerlSetVar SessionCount 1 PerlSetVar TimeHiRes 1 PerlSetVar CompressGzip 0 PerlSetVar UseStrict 1 #PerlSetVar CacheDB DB_File PerlSetVar CacheDB MLDBM::Sync::SDBM_File # .asp files for Session state enabled SetHandler perl-script PerlHandler Apache::ASP PerlSetVar CookiePath / PerlSetVar SessionTimeout 5 PerlSetVar RegisterIncludes 1 PerlSetVar XMLSubsMatch my:\w+ PerlSetVar AllowApplicationState 1 PerlSetVar AllowSessionState 1 # PerlSetVar StateSerializer Storable # PerlSetVar StateDB DB_File # PerlSetVar StatScripts 0 # .htm files for the ASP parsing, but not the $Session object # NoState turns off $Session & $Application SetHandler perl-script PerlHandler Apache::ASP PerlSetVar NoState 1 PerlSetVar BufferingOn 1 PerlSetVar NoCache 1 PerlSetVar DebugBufferLength 250 SetHandler perl-script PerlHandler Apache::ASP PerlSetVar NoState 1 PerlSetVar XSLT template.xsl PerlSetVar XSLTCache 1 ForceType text/plain # .ssi for full ssi support, with Apache::Filter SetHandler perl-script PerlHandler Apache::ASP Apache::SSI PerlSetVar Global . PerlSetVar Filter On SetHandler perl-script PerlHandler Apache::ASP Apache::ASP PerlSetVar Global . PerlSetVar Filter On SetHandler perl-script PerlHandler Apache::ASP PerlSetVar CookiePath / PerlSetVar SessionTimeout 1 PerlSetVar SessionQueryParseMatch ^http://localhost SetHandler perl-script PerlHandler Apache::ASP PerlSetVar CookiePath / PerlSetVar SessionTimeout 5 PerlSetVar RegisterIncludes 1 PerlSetVar XMLSubsMatch my:\w+ PerlSetVar XMLSubsStrict 1 Apache-ASP-2.63/site/eg/transfer.htm0000755000175000017500000000021411721310312015240 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% $Response->Clear; $Request->{QueryString}{transfer} = 1; $Server->Transfer('counting.htm'); %> Apache-ASP-2.63/site/eg/session_query_parse.asp0000755000175000017500000000254111721310312017516 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% $Response->{Expires} = -100; %> Here we are going to demo another cookieless session implementation. Unlike the one at session.asp, you as the developer do NOT need to tag specific URLs with $Server->URL().

    Instead what happens is that Apache::ASP will automatically parse through the script output looking for all local URLs, and those URLs matching the SessionQueryParseMatch config, currently set to <%=$Server->Config('SessionQueryParseMatch')%> ... These URLs will then have the current $Session->SessionID inserted into their query strings.

    So turn off the cookies and see what happens! You should notice that all local URLs, including the link to {file} %>>itself, now have the session id carried by the query strings.

    The current session id is: <%=$Session->SessionID%>
    The current count is: <%=++$Session->{Count}%>

    Here are some other links that may or may not have the session id parsed in depending whether they match SessionQueryParseMatch:

    Apache-ASP-2.63/site/eg/xml_subs.asp0000755000175000017500000000410211721310312015243 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl This is a demonstration of the XMLSubsMatch extension which allows for the developer to construct a set of custom XML style tags for use in ASP scripts. These tags could be used to render entire XML documents, or even simply give some nice short cuts for use when site building.

    =pod This part just to demo embedding normal ASP constructs in the XMLsubs, which was no easy trick to implement! =cut Currently, XMLSubsMatch is set to: <% $Response->Write('['); %> <%=$Server->Config('XMLSubsMatch')%> <% $Response->Write(']'); %>

    Whatever tags XMLSubsMatch matches of the form

    <%=
    $Server->HTMLEncode('
     
       text
     
      -- or --
     
    ')%>
    will be parsed into perl subroutines of matchtag name with arguments and text passed in, so these subs would be called respectively for the above XMLMatchSubs:
    <%=$Server->HTMLEncode('
    &matchtag( { param1 => "value1", param2=>"value2" }, \'text\' );
      -- and --
    &matchtag( { param1 => "value1", param2=>"value2" }, \'\');
    ')
    %>
    Note that XMLSubs tags of the form foo:bar will be changed into a call to &foo::bar(), so that the XML concept of tag prefix namespaces is translated to the concept of perl packages.

    XML Subs Demo

    Another table here to demo embedded XMLSubs tags: Double Table to Show Embedded Tags

    And another embedded: Another table. Triply embedded XMLSubs my:table table.

    <% for("yellow", "red", "blue") { %> Colored Box

    <% } %>

    The my::* perl subs defining the XMLSubs are located in the global.asa.

    Apache-ASP-2.63/site/eg/.bhtaccess0000644000175000017500000000014411721310312014641 0ustar jobjobAddType application/x-httpd-cgi .htm .html .asp AddType text/plain .inc .asa .htaccess Apache-ASP-2.63/site/eg/footer.inc0000644000175000017500000000014411721310312014672 0ustar jobjob

    view this file's source Apache-ASP-2.63/site/eg/xml_subs_strict.asp0000755000175000017500000000361411721310312016642 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl This is a demonstration of the XMLSubsMatch extension which allows for the developer to construct a set of custom XML style tags for use in ASP scripts. These tags could be used to render entire XML documents, or even simply give some nice short cuts for use when site building.

    <% if($Server->Config('XMLSubsStrict')) { %> Further, the XMLSubsStrict setting has been set.

    <% } %> Currently, XMLSubsMatch is set to: <% $Response->Write('['); %> <%=$Server->Config('XMLSubsMatch')%> <% $Response->Write(']'); %>

    Whatever tags XMLSubsMatch matches of the form

    <%=
    $Server->HTMLEncode('
     
       text
     
      -- or --
     
    ')%>
    will be parsed into perl subroutines of matchtag name with arguments and text passed in, so these subs would be called respectively for the above XMLMatchSubs:
    <%=$Server->HTMLEncode('
    &matchtag( { param1 =>"value1", param2=>"value2" }, \'text\' );
      -- and --
    &matchtag( { param1 =>"value1", param2=>"value2" }, \'\');
    ')
    %>
    Note that XMLSubs tags of the form foo:bar will be changed into a call to &foo::bar(), so that the XML concept of tag prefix namespaces is translated to the concept of perl packages.

    XML Subs Demo

    The bgcolor=red param should have been skipped because it was not surrounded with quotes like bgcolor="red" or bgcolor='red'

    The color='red' param is OK here as it had the correct syntax.

    The my::* perl subs defining the XMLSubs are located in the global.asa.

    Apache-ASP-2.63/site/eg/source.inc0000644000175000017500000000235111721310312014676 0ustar jobjob <% $Response->{Clean} = 0; use File::Basename; my $file = $Request->QueryString('file'); if($file) { ## print contents of file here local *FILE; my $basefile = &File::Basename::basename($file); $basefile =~ s/[^a-z\.\_]//sg; unless(open(FILE, $basefile)) { print "Can't read $basefile\n"; $Response->End(); } local $/ = undef; my $data = ; close FILE; $data =~ s|^\#\!\/[^\n]+\n||sg; $data =~ s/^\s+//s; $data =~ s/\s+$//s; my $escaped = $Server->HTMLEncode($data); $escaped =~ s/(<%=?)(.*?)(%>)/ "$1$2<\/font>$3<\/font><\/b>"; /egsx; $escaped =~ s/(<\!\-\-\s*\#include\s*file\s*\=)(.*?)(\-\->)/ "$1$2<\/font>$3<\/font><\/b>"; /egsx; $escaped =~ s/(<\/?)([\w-]+:[\w-]+)/$1\$2<\/b>\<\/font\>/isg; $escaped =~ s/(<\/?)([a-z]+)/$1\$2<\/b>\<\/font\>/isg; %>

    Source of file <%=$file%>:

    <%= $escaped %>
    
    <% } else { $Response->Write("No file to be displayed"); } %> Apache-ASP-2.63/site/eg/compile_error.inc0000644000175000017500000000016511721310312016240 0ustar jobjob This next code block contains invalid perl code that will generate a compile time error. <% invalid perl code; %> Apache-ASP-2.63/site/eg/form.asp0000755000175000017500000000110011721310312014345 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl
    Your Name:
    <% if($Request->Form('name')) { %> Your name is <%=$Request->Form('name')%> <% } %>
    The following are the contents of the data returned from doing a binary read of the form data:

    <%=$Request->BinaryRead($Request->{TotalBytes})%> Apache-ASP-2.63/site/eg/server_variables.htm0000755000175000017500000000142511721310312016757 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl

    <% for(sort keys %{$Request->ServerVariables()}) { # don't want to show too much about my demo server # comment this line out if you want to see all of %ENV next unless ($_ =~ /^(HTTP_)/); %> <% } %>
    Server Variables / CGI Environment
    <%=$_%> <%=$Request->ServerVariables($_)%>
    Apache-ASP-2.63/site/eg/index.htm0000755000175000017500000000010311721310312014520 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl Apache-ASP-2.63/site/eg/global.asa0000644000175000017500000001561511721310312014640 0ustar jobjob use DemoASP; # import basename() into global.asa namespace use File::Basename qw(basename); # when PerlSetVar UseStrict setting on, need to declare # global variables with "use vars" use vars qw($FontFace $GlobalFont %EG $title); # static read only global $GlobalFont = 'face=verdana,helvetica'; # this is run every request for all scripts that share this global.asa sub Script_OnStart { $Response->Debug("Script_OnStart $0 in global.asa"); $Session->{Started}++; $title = ''; } sub Script_OnEnd { $Response->Debug("Script_OnEnd $0 in global.asa"); $Session->{Ended}++; } # modify data on the way out sub Script_OnFlush { if($Response->{ContentType} eq 'text/html') { my $data = $Response->{BinaryRef}; $$data =~ s/(\<(body|td).*?\>)/$1\/isg; } my $data = $Response->{BinaryRef}; $Response->Debug("Script_OnFlush: about to flush ".length($$data)." bytes to client"); } sub Session_OnStart { $Session->{Count} = 10; $Session->{onstart} = time(); $Application->{'Session'.$Session->SessionID} = '?'; $Response->AppendToLog("Session_OnStart! in ./eg/global.asa ". $Session->SessionID); } sub Session_OnEnd { my $t_session_active = time() - $Session->{onstart}; $Application->{'Session'.$Session->SessionID} = $t_session_active; $Response->AppendToLog("Session_OnEnd! in ./eg/global.asa ". $Session->SessionID); } sub Application_OnStart { $Response->AppendToLog("Application_OnStart! in ./eg/global.asa"); $Application->{Count} = 20; } sub Application_OnEnd { $Response->AppendToLog("Application_OnEnd! in ./eg/global.asa"); } # you can share globals between scripts as of v.10, as all scripts, including # the global.asa are compiled into the same module %EG = ( '.htaccess' => 'Configuration parameters that make Apache::ASP tick.', 'application.asp' => 'Uses $Application for incrementing a counter.', 'binary_write.htm' => '$Response->BinaryWrite() demo for an asp script serving a gif.', 'cgi.htm' => 'Shows compatibility with the CGI.pm library', 'counting.htm' => 'Simple asp syntax shown by wrapping a for loop around html and inserting a '. 'scalar value.', 'dynamic_includes.htm' => 'Shows an included file called as a subroutine.', 'error_document.htm' => 'Shows a custom error message using the $Response->ErrorDocument() API extension', 'filter.filter' => "Demonstrates Apache::ASP's ability to act both as a source and destination filter with Apache::Filter.", 'file_upload.asp' => 'File upload data can be read from the $Request->Form(), '. 'and is implemented via CGI.pm', 'footer.inc' => 'Footer include for most of the scripts listed.', 'form.asp' => 'Shows simple use of $Request->Form() and how to get raw input data '. ' from $Request->BinaryRead()', 'formfill.asp' => 'Shows use of FormFill feature, which auto fills HTML forms from '. '$Request->Form() data. One must install HTML::FillInForm to use this feature. ', 'global.asa' => 'The global.asa is the nervous system of an ASP application and '. 'is where you define your event handlers.', 'global_asa_demo.asp' => 'Shows how the global.asa can be used to track users in an '. 'application', 'header.inc' => 'Header include for most of the scripts listed here.', 'include.htm' => 'Shows how you can decompose a script into common included files', # 'ordered_collections.ixhtm' => # 'Used with Tie::IxHash, shows the natural ordering of the $Request->Form() collection '. # 'by how the browser submitted the data, useful for some.', 'register_cleanup.asp' => 'Demonstrates use of the API extension $Server->RegisterCleanup(). '. 'Execute code after a response completes in a fail safe way with this routine. ', 'response.asp' => 'Messy script showing much of the $Response object\'s functionality, '. 'including cookies and buffering.', 'row.inc' => 'File dynamically included in the dynamic_includes.htm example', 'server.htm' => 'Shows much of the $Server object\'s functionality', 'server_variables.htm' => '$Response->ServerVariables() are the equivalent of %ENV in ASP', 'session.asp' => 'Shows use of the $Session object, and also demos one implementation '. 'of cookieless sessions.', 'session_query_parse.asp' => "Demonstrates automatic cookieless session support with the SessionQueryParse* ". "settings.", 'source.asp' => 'Handy source code viewer used to let you easily view the source of '. 'the other asp scripts.', # 'ssi_filter.ssi' => 'Shows full SSI in action via Apache::Filter & Apache::SSI. You must compile '. # 'your apache with stacked handlers and install these modules to see '. # ' this script', 'syntax_error.asp' => 'Demonstrates asp debugging with Debug 2 by creating a perl syntax error ', 'table.inc' => 'Another include used to demo dynamic_includes.htm', 'test.gif' => 'Source gif for the binary_write.htm example', 'transfer.htm' => '$Server->Transfer() use in action, for speedy redirect type behavior.', 'xml_subs.asp' => 'XMLSubsMatch XML Extensions demonstrated, which all custom tags '. 'to be created by the developer.', 'xml_subs_strict.asp' => 'XMLSubsStrict setting causes XMLSubs to accept only string literals '. 'for arguments, conforming to XML standard more strictly, and '. 'controlling XMLSubs execution to compile time arguments.', 'xslt.xml' => 'XSLT transformation of XML script, using XML::XSLT, and a DBM based cache with the XSLTCache setting. Also possible for the XSLTParser setting is XML::Sablotron for faster XSLT rendering.', ); if($Apache::ASP::ModPerl2) { delete $EG{'ssi_filter.ssi'}; delete $EG{'filter.filter'}; } $SIG{__DIE__} = \&Carp::confess; # note if you include XMLSubs in the global.asa, make sure to # switch the package context to the XMLSubs namespace to avoid # any odd variable scoping problems package my; sub my::include { my($args, $text) = @_; # reference the $Response object in the package namespace # since we are in the my:: package and not the GlobalPackage/global.asa $main::Response->Include($args->{src}, title => $args->{title}); } sub my::ttb { my($args, $text) = @_; print "$text"; } sub my::table { my($args, $text) = @_; my $title = delete $args->{title}; my %args = ( # set defaults, and override with %$args border => 0, bgcolor => 'white', width => '300', cellpadding => 3, cellspacing => 0, %$args ); print ''; print ($title ? "" : ''); print "\n"; print "
    $title
    "; print $text; print "
    "; } Apache-ASP-2.63/site/eg/include.htm0000755000175000017500000000065111721310312015044 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl This script is primarily the product of an included header and included footer, which are both compiled into the script at compile time.

    When using includes, note that the script will recompile every time an included file changes. Included files may be used anywhere in a script, for perl or text.

    Apache-ASP-2.63/site/eg/global_asa_demo.asp0000755000175000017500000000445611721310312016513 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl This example serves as how one may use the global.asa file event handlers. Please see the global.asa file for the code relevant to this example.

    The following table lists the sessions that have been recorded in the global.asa file into $Application. When a session ends, its time lived is recorded and displayed below. Active sessions are also listed.

    <% my $count; my @sessions; for(keys %{$Application}) { next unless ($_ =~ /^Session/); $count++; push(@sessions, $_); } %>

    <%=$count%> Sessions Recorded
    <%=$Application->SessionCount()%> Active Sessions

    <% if($count > 200) { %>

    First 200 of <%= $count %> displayed.
    <% } %>

    <% $count = 0; for(sort @sessions) { next unless ($_ =~ /^Session/); last if $count++ >= 200; my $session_id = $_; $session_id =~ s/^Session//io; my $session = $Application->GetSession($session_id); my $session_data = $session ? { %$session } : undef; my $session_time = ($Application->{$_} eq '?') ? "in session" : "$Application->{$_} seconds"; %> <% } %>

    <%=substr($session_id, 0, 6)."..."%> <%=$session_time%>
    <%=$session_data ? Data::Dumper->Dump([$session_data]) : '' %>

    To see multiple sessions listed you may create a 2nd session by closing and then reopening the browser you are using to view this file, or you may also open a 2nd kind of browser to create this 2nd session. There is only one session-id generated per browser session for an asp application.


    Here is a simple use of the Script_OnStart & Script_OnEnd event handlers, keeping track of the number of scripts executed this session:
    Scripts Started This Session: <%=$Session->{Started}%>
    Scripts Ended This Session: <%=$Session->{Ended} || 0 %>
    Apache-ASP-2.63/site/eg/dynamic_includes.htm0000755000175000017500000000306511721310312016735 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% $Response->Include('header.inc', bgcolor => $Request->Form('color') || 'white'); %>

    Demonstration of dynamic includes.

    This first example demonstrates dynamic includes SSI style. First try entering a color in the box to be passed as a runtime argument to the included header for this file. Just hit enter after typing in the color.
    Now to show you how to access dynamic includes through the API extension $Response->Include($filename, @args)... please enter a number of columns less than 10 in the text box, and a grid will be produce below of that size.
    <% my $size = $Request->Form('size'); if($size > 0 and $size <= 10) { # Response->Include() and Server->Execute do the same things # but the former is the native solution, and the latter comes # from the recent IIS/ASP 3.0 API extension. Formally, Execute() # doesn't take arguments, but we allow this functionality. if($size % 2) { $Response->Include('table.inc', $size); } else { $Server->Execute('table.inc', $size); } } else { print "Please enter a valid number from 1 to 10 in the form.\n"; } %>
    Apache-ASP-2.63/site/eg/register_cleanup.asp0000755000175000017500000000247211721310312016752 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% my $Sleep = 3; %> We are about to sleep for <%=$Sleep %> seconds. Before that, this script registers a routine to be executed after this script finishes, which will increment a count. This count displayed after these <%=$Sleep %> seconds if you do nothing.

    Try this. Hit reload, then your browser STOP button quickly. Do this repeatedly. Then let the script execute normally. You will see the registered code executed appropriately.

    Up through Apache version 1.3.4, this method is important, because mod_perl halts script execution immediately when the user hits a STOP button, so doing $Server->RegisterCleanup is the only way to consistently execute code that you have to for that script.

    sleeping for <%=$Sleep %> seconds...

    <% $Response->Flush(); $Server->RegisterCleanup( sub { $main::Session->{cleanup_count}++ }); for(1..$Sleep) { print 'sleeping 1 second...
    '; $Response->Flush(); if(! $Response->{IsClientConnected}) { $Response->Debug("ending script execution since client is no longer connected"); $Response->End; } sleep(1); } %>

    Count incremented in $Server-<%=$Server->HTMLEncode('>')%>RegisterCleanup <%=$Session->{cleanup_count} || 0 %> Apache-ASP-2.63/site/eg/filter.filter0000644000175000017500000000173111721310312015400 0ustar jobjob <% $Response->Include('header.inc'); %> This file uses Apache::ASP both as a source and destination filter with Apache::Filter. By doing so it processes this file <%= basename($0) %> first, and then it processes the output from the first Apache::ASP script, compiling that output as an ASP script itself.

    This is probably not how this would be used normally, you would usually chain some filter aware modules together like:

           SetHandler perl-script
           PerlHandler SomeFilter Apache::ASP Apache::SSI
           PerlSetVar Global .
           PerlSetVar Filter On
    

    So we are about to print this code: <% my $code = "<\% print 'Code Output: '.time().''; %\>"; %> <%= $Server->HTMLEncode($code) %>

    And here should be the executed version of it:

    <% print $code; %>

    This last code bit would get executed when the first script output gets processed by the second Apache::ASP destination filter. <% $Response->Include('footer.inc'); %> Apache-ASP-2.63/site/eg/counting.htm0000755000175000017500000000105011721310312015241 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% if($Request->QueryString('transfer')) { %> We just transferred from transfer.htm !!

    <% } %> For loop decrementing font size: <% for my $num (reverse(1..6)) { %> <% for my $base (1..3) { %> <% } %> <% } %>
    ><%= (10 ** $base) * $num %>>Size = <%= $num %>
    Apache-ASP-2.63/site/eg/formfill.asp0000755000175000017500000000316711721310312015233 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% $Response->{FormFill} = 1; %>
    This page makes use of the FormFill feature which populates a HTML form from $Request->Form data. The FormFill functionality is provided by the HTML::FillInForm module, which in turn relies on HTML::Parser.

    It is enabled with:

      at runtime: $Response->{FormFill} = 1
    
        -- or --
    
      in config:  PerlSetVar FormFill 1
      
    At HTML::FillInForm v.07, select boxes must have their option values defined explicitly to be auto filled by the form fill feature, such as:
    <%=$Server->HTMLEncode('
    
    Example Form
    Your Name:
    Your Favorite Color:
    <% if(%{$Request->{Form}}) { %>
    Your name is <%=$Request->Form('name')%>
    Your favorite color is <%= $Request->{Form}{color} %> <% } %>
    The following are the contents of the data returned from doing a binary read of the form data:

    <%=$Request->BinaryRead($Request->{TotalBytes})%>

    Apache-ASP-2.63/site/eg/syntax_error.asp0000755000175000017500000000300311721310312016145 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% use File::Basename; if($Request->QueryString('buffer')) { $Response->{Buffer} = 1; } else { $Response->{Buffer} = 0; } %> We are creating a perl syntax error... this should demonstrate how error handling is done. Please check the error log file if you are interested in the output there.

    You can turn this error messaging off by setting the Debug variable in the ASP config to 1 or 0.

    Also here is an example of how you can use debugging, an API extension $Response->Debug(@args), in your script. The debug output will show up below, and in your error logs. This user style debugging is turned off with the same Debug setting set to 0.

    =pod This pod comment will be yanked upon compilation =cut <% $Response->Debug( "Debugging", ['can', 'take'], {'just'=>'about'}, sub { ['any', 'kind']}, \"of reference", "or scalar" ); print "Try this script also with buffering on."; %>

    This script by default does a runtime syntax error. If you would like to see a script compile error, click here.

    "> view this file's source

    <% if($Request->QueryString('compile_error')) { $Response->Include("compile_error.inc"); } else { my $Object; # create a run-time syntax error $Object->SyntaxError(); } %> Misc Text Below Error Apache-ASP-2.63/site/eg/xslt.xml0000755000175000017500000000171711721310312014427 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl Hello World! This is my first XSLT enabled Apache::ASP XML script! I am quite pleased with how well this works, and speedy too once the XML -> XSL tranformation gets cached with XSLTCache setting. Both the and file will be executed as ASP scripts before the XSL will be applied to the XML. This give you a very powerful dynamic XML publishing solution with full ASP scripted XSL & XML files.

    With this foundation in place, we will be able to implement XSP with all its <%=$Server->HTMLEncode('')%> tags no problem. - Apache-ASP-2.63/site/eg/test.gif0000755000175000017500000000442611721310312014361 0ustar jobjobGIF89a ÷ÿÿÿÎÎÎ¥¥¥„„„ssskkkZZZ!ÿBÿ1½RÞ­„ïœBÿ„ÿÎÿÎÎÎÆ½½Æ1ÿcÿœÿïÿçJïÞ{ÞÖ¥ÎÿœïJŒÿc焜ïRcÿ!ù, GÿH° Áƒ*\Ȱ¡Ã‡#JœH±¢E†0°À€l0°!Ã(Q&XÙÀA„þý3ó_™hþ; ¦2 ø°3€™=e%03PpêüWèL«¬Þ´y±«×¯`Ã|IvƒÙ *P 0aÂ? J㾕@wÛµ2PÈ0!ƒI¿Pþ;™._Š]̸±ãÇb#Dh0Aƒ• R Nùσfý†ö+Úd^½¥Ófð uëÌü'€£À u'HhÛ–îîݺ%\0xaíÚá/^μy 5{XØA3†‚0¯d¸@{‚ƒ ˆÿoù«€óçË/Œž ûêãËŸïðåy¹oç¶]›!oß½L•’(PSQÅST´ $ÀPÅ´ @L)’SrU×Fʤ} †8_°Rg •dÚrT`×ZnY…Ÿ\pýö[¨5À^˜À-¹ÔPºµ€¿MðáAÅGÁBN"‡ÝrÃY°Üu I·Öaçw_Þx"–iæ™h¦©æšl¶é¦A.9Ðy(æ€ àÙPMXÅ‘Q `ßO/•SE€  €Sð @|E@@V2iøÏŽÐg¢žúæ¨eUP í÷_*J§RMnÿU…’)õNEzIMÔè=*S¢Viêé°È('©Ìª÷èO_ÁÑ8—p—‹¨M0a  È’x†!°¬|[QÚìº"•’Y¡©ÕŸ‹lÁ5c~¾õ¶½x¡6Ò_&ÖÀ¹å; 5éä ‡%B4÷pB¸j±«”f€©xã…,òÈ <†§‰š †’Ф±ÌœqjÝ5ÁOnÙ;#P Ûk­9 ¤ÆENP’ENL '½–ÑÊ‘&åmËe|–mìÝÕXcòÈ"—<ªdHfT!p)àÁ ÚÛðš…ÒqåÀwª{d¾Fÿ„Ap <ÒO7Ä\ß~>7ŽRÇ^~¼Pw’4&ט‹»œwîùç ‡.ú褗Î9ÁaƒMÑÈŠX,A¯›.;D¦ê-)£hk–€e#TÓ±ÿL*—°›eÓ¯É*lRVñtà/U—¦Êoeó³goÐ @@…Z˜4RJ,í~ëÀ?«L’â$!üj”)ŸÏîd?°2q»@¯óÉV|¢½DF·ª‹“ü“šÏx@)0ÌÀjBAÂOW׳ž¤œ·“9 ëSIÉìðã]Ï€( [€bØL)¾‘ŒŒã¯½\X‰,ƒÕ%„= yTWÿX˜BŠ=/éVo^Ã|ÉÐ.}éVÜ4ãÀ6 \zƒÌrRÄ.V*l¹ë‘_ò2öÜk.7z"Û¢ÒÜ\™) ê(R—Â%Dix¼â r øQp 縔pqè€";à5…Pn%$&IÉJZ²’‘´ÈdÜö.—¦E0b"~jd£ýàH-1£@äV°Í\ÉÍo™¤Qà¸Ì¥. —çøe‘Î ‡ILh :)ÙA¬æÈ92L– Ù¦IÍjZ“1w»LW𴍿49B¥] Q&Àá oÚ&žØÀæg!pB´Ý Î–»Ìg”4Fó¥Á])KšY‰È¬ôj[Ï%'™IõŒÍD+Ù JHÂÍn.ç4ýñË^ÈØ¢¾ÄÌ3»U\~bñÀS K’:y“$ÄÙÆÑ#}IS©„j á€"©1ï“Ö|¤ÖÄ$Í .@™i’Lm\麪Ge¥þB’¨¨í„k|ö!ÜGkÂJÖ ,±p¼ŒHÓüV²º5¬Xt"ÌŸó˜šA*J¡™¡~‡¨ã¡¤Q¯éEÚérŽî9ì@0 K`úM—è0'&Y»ZV¯@5+ÍVó ƒ -5 KÚÒšö´¨=@;Apache-ASP-2.63/site/eg/application.asp0000755000175000017500000000131011721310312015710 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% # Locking # -------- # reads and writes to $Application as well as $Session are # always locked to ensure concurrency, but if you want to # make sure that you have the only access during # some block of commands, then use the Lock() and UnLock() # functions $Application->Lock(); $Application->{Count}+=1; $Application->UnLock(); %> We just incremented the $Application->{Count} variable by 1. Here is the value of the $Application->{Count} variable...
    <%= sprintf("%06d", $Application->{Count}) %>

    We reset this value to 20 every Application_OnStart. Check out the global.asa! Apache-ASP-2.63/site/eg/file_upload.asp0000755000175000017500000000440513252362524015715 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl This example shows you how to use Apache::ASP to handle file uploads. You need to have a recent version CGI.pm to use this facility. Just click Browse..., select your file, hit 'file upload' and voila!, you will see the data in the file below.

    Note that the current limit set on uploads for this demo is <% my $limit = $Server->Config('FileUploadMax') || $CGI::POST_MAX; $limit = ($limit eq '-1') ? 'NONE' : $limit; print "$limit"; %> . <% if($limit && ($limit < $Request->{TotalBytes})) { %> This limit was exceeded by a POST of <%= $Request->{TotalBytes} %> bytes! <% } %>
    <% use CGI; my $q = new CGI; print $q->start_multipart_form(); print $q->hidden('file_upload', 'Hidden File Upload Form Text'); print $q->filefield('uploaded_file','starting value',30,100); print ""; print $q->submit('Upload File'); %>

    File Upload Type: <%= $q->checkbox_group(-name=>'extensions', -values=>['GIF','HTML','OTHER'], -defaults=>['HTML'] ) %> <% my $filehandle; if($filehandle = $Request->{Form}{uploaded_file}) { %> Upload Type Specified: <%= join(', ', $Request->Form('extensions')) %>
    <% local *FILE; my $upload = $Request->{FileUpload}{uploaded_file}; print ""; my @data = ( '$Request->{TotalBytes}', $Request->{TotalBytes}, 'Hidden Text', $Request->Form('file_upload'), 'Uploaded File Name', $filehandle, # we only have the temp file because of the # FileUploadTemp setting 'Temp File', $upload->{TempFile}, 'Temp File Exists', (-e $upload->{TempFile}), 'Temp File Opened', (open(FILE, $upload->{TempFile}) ? 'yes' : "no: $!"), map { ($_, $Request->FileUpload('uploaded_file', $_)) } sort keys %$upload ); close FILE; while(@data) { my($key, $value) = (shift @data, shift @data); %> <% } print "
    <%=$key%> <%=$value%>
    "; %>

    UPLOADED DATA
    =============
    <% 
        while(<$filehandle>) { 
    	print $Server->HTMLEncode($_);	
        }
    %>
    	
    <% } %> Apache-ASP-2.63/site/eg/header.inc0000644000175000017500000000217411721310312014631 0ustar jobjob<% use vars qw($demo $title); use DemoASP; $demo = &DemoASP::new; my $gifdir = (-e '../asptitlelogo.gif') ? '..' : '../..'; my %args = @_; %> <%= $args{title} || $title || $demo->{title} %>
    Apache::ASP Powered by ModPerl & Apache Powered by Apache::ASP
    <%=$title || $demo->{title}%> <% my $date = &Apache::ASP::Date::time2iso(); $date =~ s/\s*\d\d:\d\d:\d\d$//; %> <%=$date %>

    Apache-ASP-2.63/site/eg/response.asp0000755000175000017500000000524711721310312015260 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% my $form = $Request->QueryString(); # Expires $form->{expires} ||= 0; $Response->{Expires} = $form->{expires}; my $update_time = &Apache::ASP::Date::time2str(time()+$form->{expires}); # Buffer (defined $Session->{buffer}) || ($Session->{buffer} = $Response->{Buffer}); if($form->{buffer}) { $Session->{buffer} = ! $Session->{buffer}; } my $buffer_display = $Session->{buffer} ? "Set Buffer Off" : "Set Buffer On"; $Response->{Buffer} = $Session->{buffer}; # Cookie if($form->{cookie_name}) { $Response->{Cookies}{$form->{cookie_name}} = $form->{cookie_value}; } %>
    {file}%> method=GET> <% if($update_time) { %> <% } %>
    Response Object Demonstration
    Input Text
    Expires In (secs)
    Expires On <%=$update_time%>
    Buffering <%=$Response->{Buffer} ? "On" : "Off"%>
    Cookie (Name=Value) =
    Cookies* <% while(my($k, $v) = each %{$Request->Cookies()}) { if(ref $v) { print "$k:
    \n"; for(keys %$v) { print "- $v->{$_}=$_
    \n"; } } else { print "$k=$v\n"; } print "

    \n"; } %>

    Clear Demo <% # printing now aliases to $Response->Write() print " Here's some text that was added to the box... if you pressed clear and buffering is on, you will not see it... "; # demo of $Response->Clear(); $Response->Flush(); %>
    Input Text:<%=$form->{text}%>
    <% if($form->{clear}) { $Response->Clear(); } %>
    print() demo <% print " perl print() now works!

    \n"; %>

    * Please note that the cookie example takes 2 submits to show up in the table after setting it because the first time, the header is sent to the browser, and the 2nd, the browser sends it back. Apache-ASP-2.63/site/eg/session.asp0000755000175000017500000000256411721310312015104 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% my $form = $Request->Form(); # process form here if($form->{increment}) { $Session->{Count}++; } elsif($form->{timeout}) { $Session->Timeout(.25); } elsif($form->{abandon}) { $Session->Abandon(); } my @rows = ( '$Session->{Count}', '$Session->{Timeout}', '$Session->{SessionID}' ); %> This file demonstrates the use of the $Session object, as well as one implementantion of cookieless sessions involving the use of the SessionQuery setting, and the $Server->URL($url, \%params) method to add session ids to the form query string.

    To demo the cookieless sessions, just turn off your cookies and use this form.

    URL($demo->{file})%> method=POST> <% for (@rows){ %> <% } %>
    Session Object Demonstration
    <%=$Server->HTMLEncode($_)%> <%=eval($_) || $@%>

    The value for $Session->{Count} gets reset to 10 on every session start in the global.asa file. Apache-ASP-2.63/site/eg/binary_write.htm0000755000175000017500000000141211721310312016113 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% use File::Basename; if($Request->QueryString('type') eq 'gif') { $Response->{ContentType} = 'image/gif'; open(FILE, 'test.gif') || die "can't open test.gif"; binmode FILE; $/ = undef; my $data = ; $Response->Clear; $Response->AddHeader('Content-Length', length $data); $Response->BinaryWrite($data); $Response->End; } else { %> We are going to load a gif through this same script as an example of doing a $Response->BinaryWrite()...

    Please note that if you are on Win32, you will need to call binmode on a file handle before reading, if its data is binary. <% } %> Apache-ASP-2.63/site/eg/cookieless_session.asp0000755000175000017500000000012311721310312017311 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl Apache-ASP-2.63/site/eg/server.htm0000755000175000017500000000157611721310312014736 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% ; my $file1 = '.'; my $file2 = '/'; my $html = ""; my $url = "cgi data =%&"; my @cmds = ( '$Server->MapPath("'.$file1.'")', '$Server->MapPath("'.$file2.'")', '$Server->HTMLEncode("'.$html.'")', '$Server->URLEncode("'.$url.'")', '$Server->Config("GlobalPackage")', ); ($^O eq 'MSWin32') && push(@cmds, '$Server->CreateObject("MSWC.AdRotator")'); %> <% for my $cmd (@cmds) { %> <% } %>
    The $Server methods in action

    <%= $Server->HTMLEncode($cmd) %>
    <%= eval "$cmd" %>

    Apache-ASP-2.63/site/eg/template.xsl0000755000175000017500000000126411721310312015253 0ustar jobjob Hello <% $Response->Include('header.inc'); %>

    source.asp?file= Apache-ASP-2.63/site/eg/cgi.htm0000755000175000017500000000342311721310312014163 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% # This code was ripped almost straight out of CGI.pm, by Lincoln Stein. # The code was the bulk of the SYNOPSIS section of CGI.pm v2.46 ; use strict; use CGI qw(:standard); my $query = new CGI; my $cookie; my $name; if($name = param('name')) { $cookie = cookie(-name=>'name', -value=>$name, -expires=>'+1h', ); } $name ||= cookie('name'); print header(-cookie=>$cookie); %> <% print h1('A Simple Example'), start_form, "What's your name? ",textfield('name'),p, "What's the combination?", p, checkbox_group(-name=>'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie']), p, "What's your favorite color? ", popup_menu(-name=>'color', -values=>['red','green','blue','chartreuse']),p, submit, end_form, hr; if (param()) { print "Your name is ",em($name),p,"\n", "The keywords are: ",em(join(", ",param('words'))),p,"\n", "Your favorite color is ",em(param('color')),"\n", hr; } %> This script is a demonstration of using the CGI.pm library in an ASP script. Please remember that using CGI.pm will probably NOT be portable with PScript and PerlScript.

    As of version 0.09, you may use CGI for reading form input without any change to regular use of CGI. Before, you couldn't do a

     use CGI; 
    by itself, as it would try to read form input that had already been loaded into $Request->Form(). Form input is now cached, and may be loaded into CGI as well. In short, use of CGI.pm is now transparent in Apache::ASP, as both output and input have been merged seemlessly.

    "> view this file's source <% print end_html; %> Apache-ASP-2.63/site/eg/row.inc0000644000175000017500000000012711721310312014204 0ustar jobjob <% for(1..$_[0]) { %> >
    <% } %> Apache-ASP-2.63/site/eg/table.inc0000644000175000017500000000015011721310312014460 0ustar jobjob <% for (1..$_[0]) { $Response->Include('row.inc', $_[0]); } %>
    Apache-ASP-2.63/site/eg/DemoASP.pm0000644000175000017500000000053711721310312014475 0ustar jobjob package DemoASP; use File::Basename; use strict; sub new { my($request) = $main::Request; my($env) = $request->ServerVariables(); my $basename = &File::Basename::basename($0); my($title) = "Demo ASP: ". $basename; my($self) = bless { bgcolor => 'white', env => $env, title => $title, file => $basename }; $self; } 1; Apache-ASP-2.63/site/eg/ssi_filter.ssi0000755000175000017500000000235111721310312015571 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% $Response->{Buffer} = 1; %> <% if(! $ENV{MOD_PERL}) { print "WARNING: Apache::SSI filtering doesn't work under normal CGI


    "; } %> <% unless($Request->QueryString('virtual') || $Request->QueryString('redirect')) { $Response->Redirect("$demo->{file}?redirect=1"); } if($Request->QueryString('virtual')) { # If virtual include of self, print a little, then exit ... $Response->Clear(); %>
    SSI Virtual Include
    <% $Response->End(); } %> This is a demo of using SSI directives, via Apache::Filter and Apache::SSI. You must have a modperl version of at least 1.16 installed with the PERL_STACKED_HANDLERS configuration option turned on when compiling. We will now do an ssi virtual include. I had to be careful after doing a recursive include. Ouch!
    Other SSI Directives
    ssi fsize:
    ssi flastmod:

    Apache-ASP-2.63/site/eg/source.asp0000755000175000017500000000010411721310312014705 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl Apache-ASP-2.63/site/eg/index.html0000755000175000017500000000234411721310312014705 0ustar jobjob#!/usr/bin/perl /usr/bin/asp-perl <% # split the page in 2 for nice formatting and english style sorting my(@col1, @col2); my @keys = sort keys %EG; @keys || die("\%EG is not defined, make sure you copied ./eg/global.asa correctly"); my $half = int(@keys/2) + 1; for(my $i =0; $i <= $#keys; $i++) { if($i < $half) { push(@col1, $keys[$i]); } else { push(@col2, $keys[$i]); } } $Response->Debug('col1', \@col1, 'col2', \@col2); $title = 'Example ASP Scripts'; %> <% while(@col1) { my $col1 = shift @col1; my $col2 = shift @col2; %> <% for([$col1, $EG{$col1}], '', [$col2, $EG{$col2}]) { unless(ref $_) { print ""; next; } next unless $_->[0]; # last col / last row # clean up the descriptions $_->[1] =~ s/\s*\.\s*$//s; $_->[1] .= '.'; %> <% } %> <% } %>
      [0]%>><%=$_->[0]%> <% if($_->[0] =~ /\.(htm|asp|ssi|xml)$/) { %>   ([0]%>>source) <% } %>
    <%=$_->[1]%>
    Apache-ASP-2.63/site/style.html0000644000175000017500000003360013252377727014367 0ustar jobjob Apache::ASP::Style guide

    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
    % STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    STYLE GUIDE
    Here are some general style guidelines. Treat these as tips for best practices on Apache::ASP development if you will.

    UseStrict Use global.asa's Script_On* Events
    Do not define subroutines in scripts.  

    UseStrict

    One of perl's blessings is also its bane, variables do not need to be
    declared, and are by default globally scoped.  The problem with this in 
    mod_perl is that global variables persist from one request to another
    even if a different web browser is viewing a page.  
    
    To avoid this problem, perl programmers have often been advised to add to the top of their perl scripts:
      use strict;
    
    In Apache::ASP, you can do this better by setting:
      PerlSetVar UseStrict 1
    
    which will cover both script & global.asa compilation and will catch "use strict" errors correctly. For perl modules, please continue to add "use strict" to the top of them.
    Because its so essential in catching hard to find errors, this configuration will likely become the default in some future release. For now, keep setting it.

    Do not define subroutines in scripts.

    DO NOT add subroutine declarations in scripts.  Apache::ASP is optimized
    by compiling a script into a subroutine for faster future invocation.
    Adding a subroutine definition to a script then looks like this to 
    the compiler:
    
      sub page_script_sub {
        ...
        ... some HTML ...
        ...
        sub your_sub {
          ...
        }
        ...
      }
    
    The biggest problem with subroutines defined in subroutines is the side effect of creating closures, which will not behave as usually desired in a mod_perl environment. To understand more about closures, please read up on them & "Nested Subroutines" at:
      http://perl.apache.org/docs/general/perl_reference/perl_reference.html
    
    Instead of defining subroutines in scripts, you may add them to your sites global.asa, or you may create a perl package or module to share with your scripts. For more on perl objects & modules, please see:
      http://perldoc.perl.org/perlobj.html
    

    Use global.asa's Script_On* Events

    Chances are that you will find yourself doing the same thing repeatedly
    in each of your web application's scripts.  You can use Script_OnStart
    and Script_OnEnd to automate these routine tasks.  These events are
    called before and after each script request.
    
    For example, let's say you have a header & footer you would like to include in the output of every page, then you might:
     # global.asa
     sub Script_OnStart {
       $Response->Include('header.inc');
     }
     sub Script_OnEnd {
       $Response->Include('footer.inc');
     }
    
    Or let's say you want to initialize a global database connection for use in your scripts:
     # global.asa
     use Apache::DBI;   # automatic persistent database connections
     use DBI;
    
     use vars qw($dbh); # declare global $dbh
    
     sub Script_OnStart {
       # initialize $dbh
       $dbh = DBI->connect(...);
    
       # force you to explicitly commit when you want to save data
       $Server->RegisterCleanup(sub { $dbh->rollback; });
     }
    
     sub Script_OnEnd {
       # not really necessary when using persistent connections, but
       # will free this one object reference at least
       $dbh = undef;
     }
    
     
    Apache-ASP-2.63/site/support.html0000644000175000017500000003725013252377727014750 0ustar jobjob Apache::ASP::Support
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
    % SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    SUPPORT
    COMMUNITY AlterCom
    Mailing List Archives The Cyberchute Connection
    Mailing List OmniTI
    Donations TUX IT AG
     
    COMMERCIAL  

    COMMUNITY

    Mailing List Archives

    Try the Apache::ASP mailing list archive first when working
    through an issue as others may have had the same question
    as you, then try the mod_perl list archives since often
    problems working with Apache::ASP are really mod_perl ones.
    
    The Apache::ASP mailing list archives are located at:
     http://groups.yahoo.com/group/apache-asp/
     http://www.mail-archive.com/asp%40perl.apache.org/
    
    The mod_perl mailing list archives are located at:
     http://mail-archives.apache.org/mod_mbox/perl-modperl/
    

    Mailing List

    Please subscribe to the Apache::ASP mailing list
    by sending an email to asp-subscribe[at]perl.apache.org
    and send your questions or comments to the list
    after your subscription is confirmed.
    
    To unsubscribe from the Apache::ASP mailing list, just send an email to asp-unsubscribe[at]perl.apache.org
    If you think this is a mod_perl specific issue, you can send your question to modperl[at]apache.org

    Donations

    Apache::ASP is freely distributed under the terms of the Perl artistic license 
    ( see the LICENSE section ). If you would like to donate time to 
    the project, please get involved on the Apache::ASP Mailing List,
    and submit ideas, bug fixes and patches for the core system,
    and perhaps most importantly to simply support others in learning
    the ins and outs of the software.
    	
    	

    COMMERCIAL

    If you would like commercial support for Apache::ASP, please
    check out any of the following listed companies.  Note that 
    this is not an endorsement, and if you would like your company
    listed here, please email asp[at]perl.apache.org with your information.
    	
    	

    AlterCom

    We use, host and support mod_perl. We would love to be able to help 
    anyone with their mod_perl Apache::ASP needs.  Our mod_perl hosting is $24.95 mo.
    
      http://altercom.com/home.html
    

    The Cyberchute Connection

    Our hosting services support Apache:ASP along with Mod_Perl, PHP and MySQL.
    
      http://www.Cyberchute.com
    

    OmniTI

    OmniTI supports Apache and mod_perl (including Apache::ASP) and offers competitive pricing for both hourly and project-based jobs. OmniTI has extensive experience managing and maintaining both large and small projects. Our services range from short-term consulting to project-based development, and include ongoing maintenance and hosting.
    
      http://www.omniti.com
    

    TUX IT AG

    Main business is implementing and maintaining infrastructure for big
    websites and portals, as well as developing web applications for our
    customers (Apache, Apache::ASP, PHP, Perl, MySQL, etc.)
    
    The prices for our service are about 900 EUR per day which is negotiable (for longer projects, etc.).
      http://www.tuxit.de
    
     
    Apache-ASP-2.63/site/cgi.html0000644000175000017500000004605113252377727013775 0ustar jobjob Apache::ASP::Cgi
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
    % CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    CGI
    CGI has been the standard way of deploying web applications long before ASP came along. In the CGI gateway world, CGI.pm has been a widely used module in building CGI applications, and Apache::ASP is compatible with scripts written with CGI.pm. Also, as of version 2.19, Apache::ASP can run in standalone CGI mode for the Apache web server without mod_perl being available. See "Standalone CGI Mode" section below.
    Following are some special notes with respect to compatibility with CGI and CGI.pm. Use of CGI.pm in any of these ways was made possible through a great amount of work, and is not guaranteed to be portable with other perl ASP implementations, as other ASP implementations will likely be more limited.

    Standalone CGI Mode, without mod_perl CGI headers
    CGI.pm print()ing CGI
    Query Object Initialization File Upload

    Standalone CGI Mode, without mod_perl

    As of version 2.19, Apache::ASP scripts may be run as standalone
    CGI scripts without mod_perl being loaded into Apache.  Work
    to date has only been done with mod_cgi scripts under Apache on a
    Unix platform, and it is unlikely to work under other web servers 
    or Win32 operating systems without further development.
    
    To run the ./site/eg scripts as CGI scripts, you copy the ./site directory to some location accessible by your web server, in this example its /usr/local/apache/htdocs/aspcgi, then in your httpd.conf activate Apache::ASP cgi scripts like so:
     Alias /aspcgi/ /usr/local/apache/htdocs/aspcgi/
     <Directory /usr/local/apache/htdocs/aspcgi/eg/ >
       AddType application/x-httpd-cgi .htm
       AddType application/x-httpd-cgi .html
       AddType application/x-httpd-cgi .asp
       AddType application/x-httpd-cgi .xml
       AddType application/x-httpd-cgi .ssi
       AllowOverride None
       Options +ExecCGI +Indexes
     </Directory>
    
    Then install the asp-perl script from the distribution into /usr/bin, or some other directory. This is so the CGI execution line at the top of those scripts will invoke the asp-perl wrapper like so:
     #!/usr/bin/perl /usr/bin/asp-perl
    
    The asp-perl script is a cgi wrapper that sets up the Apache::ASP environment in lieu of the normal mod_perl handler request. Because there is no Apache->dir_config() data available under mod_cgi, the asp-perl script will load a asp.conf file that may define a hash %Config of data for populating the dir_config() data. An example of a complex asp.conf file is at ./site/eg/asp.conf
    So, a trivial asp.conf file might look like:
     # asp.conf
     %Config = (
       'Global' => '.',
       'StateDir' => '/tmp/aspstate',
       'NoState' => 0,
       'Debug' => 3,
     );
    
    The default for NoState is 1 in CGI mode, so one must set NoState to 0 for objects like $Session & $Application to be defined.

    CGI.pm

    CGI.pm is a very useful module that aids developers in 
    the building of these applications, and Apache::ASP has been made to 
    be compatible with function calls in CGI.pm.  Please see cgi.htm in the 
    ./site/eg directory for a sample ASP script written almost entirely in CGI.
    
    As of version 0.09, use of CGI.pm for both input and output is seamless when working under Apache::ASP. Thus if you would like to port existing cgi scripts over to Apache::ASP, all you need to do is wrap <% %> around the script to get going. This functionality has been implemented so that developers may have the best of both worlds when building their web applications.
    For more information about CGI.pm, please see the web site
      http://search.cpan.org/dist/CGI/
    

    Query Object Initialization

    You may create a CGI.pm $query object like so:
    
    	use CGI;
    	my $query = new CGI;
    
    As of Apache::ASP version 0.09, form input may be read in by CGI.pm upon initialization. Before, Apache::ASP would consume the form input when reading into $Request->Form(), but now form input is cached, and may be used by CGI.pm input routines.

    CGI headers

    Not only can you use the CGI.pm $query->header() method
    to put out headers, but with the CgiHeaders config option
    set to true, you can also print "Header: value\n", and add 
    similar lines to the top of your script, like:
    
     Some-Header: Value
     Some-Other: OtherValue
    
     <html><body> Script body starts here.
    
    Once there are no longer any cgi style headers, or the there is a newline, the body of the script begins. So if you just had an asp script like:
        print join(":", %{$Request->QueryString});
    
    You would likely end up with no output, as that line is interpreted as a header because of the semicolon. When doing basic debugging, as long as you start the page with <html> you will avoid this problem.

    print()ing CGI

    CGI is notorious for its print() statements, and the functions in CGI.pm 
    usually return strings to print().  You can do this under Apache::ASP,
    since print just aliases to $Response->Write().  Note that $| has no
    affect.
    
    	print $query->header();
    	print $query->start_form();
    

    File Upload

    CGI.pm is used for implementing reading the input from file upload.  You
    may create the file upload form however you wish, and then the 
    data may be recovered from the file upload by using $Request->Form().
    Data from a file upload gets written to a file handle, that may in
    turn be read from.  The original file name that was uploaded is the 
    name of the file handle.
    
    	my $filehandle = $Request->Form('file_upload_field_name');
    	print $filehandle; # will get you the file name
    	my $data;
    	while(read($filehandle, $data, 1024)) {
    		# data from the uploaded file read into $data
    	};
    
    Please see the docs on CGI.pm (try perldoc CGI) for more information on this topic, and ./site/eg/file_upload.asp for an example of its use. Also, for more details about CGI.pm itself, please see the web site:
        http://search.cpan.org/dist/CGI/
    
    Occasionally, a newer version of CGI.pm will be released which breaks file upload compatibility with Apache::ASP. If you find this to occur, then you might consider downgrading to a version that works. For example, one can install a working CGI.pm v2.78 for a working version, and to get old versions of this module, one can go to BACKPAN at:
        http://backpan.cpan.org/modules/by-authors/id/L/LD/LDS/
    
    There is also $Request->FileUpload() API extension that you can use to get more data about a file upload, so that the following properties are available for querying:
      my $file_upload = $Request->{FileUpload}{upload_field};
      $file_upload->{BrowserFile}
      $file_upload->{FileHandle}
      $file_upload->{ContentType}
    
      # only if FileUploadTemp is set
      $file_upload->{TempFile}	
    
      # whatever mime headers are sent with the file upload
      # just "keys %$file_upload" to find out
      $file_upload->{?Mime-Header?}
    
    Please see the $Request section in OBJECTS for more information.
     
    Apache-ASP-2.63/site/top.inc0000755000175000017500000000546411721310312013620 0ustar jobjob<% use File::Basename; my $basename = basename($0); ($basename) = split(/\./, $basename); my $section = $FILES{$basename} || die("no section for $basename"); my ($data) = grep($_->{name} eq $section, @{$ASP->{stack}}); my ($copy) = grep($_->{name} eq 'COPYRIGHT', @{$ASP->{stack}}); $copy->{body} =~ s/\n\n.*$//sg; $data || die("can't get data for $section"); my $module = "Apache :: ASP"; my $title = "$module :: ".uc(lc $data->{name}); %> <%=$title%>
    <%=$module%>
    <% for $top (@{$ASP->{stack}}, '', { name=> EXAMPLES, file => 'eg/index'}) { unless($top) { %><% next; } my $file; if($top->{file}) { $file = $top->{file}; } else { ($file) = grep($top->{name} eq $FILES{$_}, keys %FILES); } $file = "$file.html"; next unless (-e $file); %> <% } %>


    ><%=$top->{name}%>

    Powered by ModPerl & Apache
    <% my @stack; my @order; push(@stack, $data); while(@stack) { my $data = shift @stack; unshift(@stack, @{$data->{stack}}); push(@order, $data); } print pod2html($data->{body}, $data->{name}, $data->{level}); my @links; $data = shift @order; if(@order > 2) { my $last_level = $order[0]->{level}; for $data (@order) { if($last_level != $data->{level}) { push(@links, ''); $last_level = $data->{level}; } push(@links, "URLEncode($data->{name}).">$data->{name}"); } %>
    <% for($i=0; $i<@links; $i++) { if($i == (int((@links+1) / 2))) { print ""; } print $links[$i] . "
    "; } %>

    <% } for $data (@order) { %>

    URLEncode($data->{name})%>> <%=pod2html($data->{body}, $data->{name}, $data->{level})%> <% } %>

    <%=$copy->{body}%>
    Apache-ASP-2.63/site/faq.html0000644000175000017500000006701313252377727014003 0ustar jobjob Apache::ASP::Faq
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
    % FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    FAQ
    The following are some frequently asked questions about Apache::ASP.

    Installation Development
    Examples don't work, I see the ASP script in the browser? VBScript or JScript supported?
    Apache Expat vs. XML perl parsing causing segfaults, what do I do? How is database connectivity handled?
    Why do variables retain their values between requests? What is the best way to debug an ASP application ?
    Apache errors on the PerlHandler or PerlModule directives ? How are file uploads handled?
    Error: no request object (Apache=SCALAR(0x???????):) How do I access the ASP Objects in general?
    I am getting a tie or MLDBM / state error message, what do I do? Can I print() in ASP?
    Do I have access to ActiveX objects?
    Sessions
    How can I use $Session to store complex data structures. Support and Production
    How can I keep search engine spiders from killing the session manager? How do I get things I want done?!
    How can I use $Session to store a $dbh database handle ? What is the state of Apache::ASP? Can I publish a web site on it?
     

    Installation

    Examples don't work, I see the ASP script in the browser?

    This is most likely that Apache is not configured to execute
    the Apache::ASP scripts properly.  Check the INSTALL QuickStart
    section for more info on how to quickly set up Apache to 
    execute your ASP scripts.
    	
    	

    Apache Expat vs. XML perl parsing causing segfaults, what do I do?

    Make sure to compile apache with expat disabled.  The
    ./make_httpd/build_httpds.sh in the distribution will do 
    this for you, with the --disable-rule=EXPAT in particular:
    
     cd ../$APACHE
     echo "Building apache =============================="
     ./configure \
        --prefix=/usr/local/apache \
        --activate-module=src/modules/perl/libperl.a \
        --enable-module=ssl \
        --enable-module=proxy \
        --enable-module=so \
        --disable-rule=EXPAT
    
                       ^^^^^
    
    keywords: segmentation fault, segfault seg fault

    Why do variables retain their values between requests?

    Unless scoped by my() or local(), perl variables in mod_perl
    are treated as globals, and values set may persist from one 
    request to another. This can be seen in as simple a script
    as this:
    
      <HTML><BODY>
        $counter++;
        $Response->Write("<BR>Counter: $counter");
      </BODY></HTML>
    
    The value for $counter++ will remain between requests. Generally use of globals in this way is a BAD IDEA, and you can spare yourself many headaches if do "use strict" perl programming which forces you to explicity declare globals like:
      use vars qw($counter);
    
    You can make all your Apache::ASP scripts strict by default by setting:
      PerlSetVar UseStrict 1
    

    Apache errors on the PerlHandler or PerlModule directives ?

    You get an error message like this:
    
     Invalid command 'PerlModule', perhaps mis-spelled or defined by a 
     module not included in the server configuration.
    
    You do not have mod_perl correctly installed for Apache. The PerlHandler and PerlModule directives in Apache *.conf files are extensions enabled by mod_perl and will not work if mod_perl is not correctly installed.
    Common user errors are not doing a 'make install' for mod_perl, which installs the perl side of mod_perl, and not starting the right httpd after building it. The latter often occurs when you have an old apache server without mod_perl, and you have built a new one without copying over to its proper location.
    To get mod_perl, go to http://perl.apache.org

    Error: no request object (Apache=SCALAR(0x???????):)

    Your Apache + mod_perl build is not working properly, 
    and is likely a RedHat Linux RPM DSO build.  Make sure
    you statically build your Apache + mod_perl httpd,
    recompiled fresh from the sources.
    	
    	

    I am getting a tie or MLDBM / state error message, what do I do?

    Make sure the web server or you have write access to the eg directory,
    or to the directory specified as Global in the config you are using.
    Default for Global is the directory the script is in (e.g. '.'), but should
    be set to some directory not under the www server document root,
    for security reasons, on a production site.
    
    Usually a
     chmod -R -0777 eg
    
    will take care of the write access issue for initial testing purposes.
    Failing write access being the problem, try upgrading your version of Data::Dumper and MLDBM, which are the modules used to write the state files.

    Sessions

    How can I use $Session to store complex data structures.

    Very carefully.  Please read the $Session documentation in 
    the OBJECTS section.  You can store very complex objects
    in $Session, but you have to understand the limits, and 
    the syntax that must be used to make this happen.
    
    In particular, stay away from statements that that have more than one level of indirection on the left side of an assignment like:
      BAD: $Session->{complex}{object} = $data;
    

    How can I keep search engine spiders from killing the session manager?

    If you want to disallow session creation for certain non web 
    browser user agents, like search engine spiders, you can use a mod_perl
    PerlInitHandler like this to set configuration variables at runtime:
    
     # put the following code into httpd.conf and stop/start apache server
     PerlInitHandler My::InitHandler
    
     <Perl>
    
      package My::InitHandler;
      use Apache;
    
      sub handler {
        my $r = shift; # get the Apache request object
    
        # if not a Mozilla User Agent, then disable sessions explicitly
        unless($r->headers_in('User-Agent') =~ /^Mozilla/) {
           $r->dir_config('AllowSessionState', 'Off');
        }
    
        return 200; # return OK mod_perl status code
      }
    
      1;
    
     </Perl>
    
    This will configure your environment before Apache::ASP executes and sees the configuration settings. You can use the mod_perl API in this way to configure Apache::ASP at runtime.
    Note that the Session Manager is very robust on its own, and denial of service attacks of the types that spiders and other web bots normally execute are not likely to affect the Session Manager significantly.

    How can I use $Session to store a $dbh database handle ?

    You cannot use $Session to store a $dbh handle.  This can 
    be awkward for those coming from the IIS/NT world, where
    you could store just about anything in $Session, but this
    boils down to a difference between threads vs. processes.
    
    Database handles often have per process file handles open, which cannot be shared between requests, so though you have stored the $dbh data in $Session, all the other initializations are not relevant in another httpd process.
    All is not lost! Apache::DBI can be used to cache database connections on a per process basis, and will work for most cases.

    Development

    VBScript or JScript supported?

    Only Perl scripting is supported with this module.
    	
    	

    How is database connectivity handled?

    Database connectivity is handled through perl's DBI & DBD interfaces.
    In the UNIX world, it seems most databases have cross platform support in perl.
    You can find the book on DBI programming at http://www.oreilly.com/catalog/perldbi/
    
    DBD::ODBC is often your ticket on Win32. On UNIX, commercial vendors like OpenLink Software (http://www.openlinksw.com/) provide the nuts and bolts for ODBC.
    Database connections can be cached per process with Apache::DBI.

    What is the best way to debug an ASP application ?

    There are lots of perl-ish tricks to make your life developing
    and debugging an ASP application easier.  For starters,
    you will find some helpful hints by reading the 
    $Response->Debug() API extension, and the Debug
    configuration directive.
    	
    	

    How are file uploads handled?

    Please see the CGI section.  File uploads are implemented
    through CGI.pm which is loaded at runtime only for this purpose.
    This is the only time that CGI.pm will be loaded by Apache::ASP,
    which implements all other cgi-ish functionality natively.  The
    rationale for not implementing file uploads natively is that 
    the extra 100K in memory for CGI.pm shouldn't be a big deal if you 
    are working with bulky file uploads.
    	
    	

    How do I access the ASP Objects in general?

    All the ASP objects can be referenced through the main package with
    the following notation:
    
     $main::Response->Write("html output");
    
    This notation can be used from anywhere in perl, including routines registered with $Server->RegisterCleanup().
    You use the normal notation in your scripts, includes, and global.asa:
     $Response->Write("html output");
    

    Can I print() in ASP?

    Yes.  You can print() from anywhere in an ASP script as it aliases
    to the $Response->Write() method.  Using print() is portable with
    PerlScript when using Win32::ASP in that environment.
    	
    	

    Do I have access to ActiveX objects?

    Only under Win32 will developers have access to ActiveX objects through
    the perl Win32::OLE interface.  This will remain true until there
    are free COM ports to the UNIX world.  At this time, there is no ActiveX
    for the UNIX world.
    	
    	

    Support and Production

    How do I get things I want done?!

    If you find a problem with the module, or would like a feature added,
    please mail support, as listed in the SUPPORT section, and your 
    needs will be promptly and seriously considered, then implemented.
    	
    	

    What is the state of Apache::ASP? Can I publish a web site on it?

    Apache::ASP has been production ready since v.02.  Work being done
    on the module is on a per need basis, with the goal being to eventually
    have the ASP API completed, with full portability to ActiveState PerlScript
    and MKS PScript.  If you can suggest any changes to facilitate these
    goals, your comments are welcome.
    	
    
    
     
    Apache-ASP-2.63/site/apache_asp_small_trans.GIF0000755000175000017500000000442111721310312017325 0ustar jobjobGIF89aŒ÷ÿÿÿÿüüüøøøõõõôôôðððïïïíííëëëêêêæææåååãããâââáááßßßÝÝÝÚÚÚÙÙÙÖÖÖÔÔÔÒÒÒÑÑÑÐÐÐÎÎÎÌÌÌËËËÊÊÊÈÈÈÆÆÆÅÅÅÂÂÂÁÁÁÀÀÀ¾¾¾½½½¼¼¼»»»¸¸¸···³³³±±±°°°«««©©©¨¨¨¥¥¥¢¢¢¡¡¡   ŸŸŸžžžœœœ›››ššš™™™˜˜˜———–––•••”””’’’‘‘‘ŽŽŽŒŒŒ‹‹‹ŠŠŠˆˆˆ‡‡‡†††………„„„ƒƒƒ‚‚‚€€€~~~}}}|||{{{zzzyyyxxxwwwvvvuuutttsssrrrqqqpppooonnnmmmlllkkkjjjiiihhhgggfffeeedddcccbbbaaa```___^^^]]]\\\[[[ZZZYYYXXXWWWVVVUUUTTTSSSRRRQQQPPPOOONNNMMMLLLKKKJJJIIIHHHGGGFFFEEEDDDCCCBBBAAA@@@???>>>===<<<;;;:::999888777666555444333222111000///...---,,,+++***)))((('''&&&%%%$$$###"""!!! ÀÀÀ!ù´,Œ@ÿi H° Áƒ*\Ȱ¡Ã‡ŠräË£/‡­ (âÄŠ"DLXñD†ˆ"'ä8ò¤äIƒ:yrÄ…@-¡…áÄ•/ bÀƒ¦M”?v˜t#ÇgEýã”ÖD w4”q椈+S>¹säÐ'€ýsæÊ‰O]Ê!ä‘Otvñä’ Z¾~úó$Ç™»Gh¹ørdîÁ¯ˆÁx‡Ö‰'ݹó‡óŸ?;!¦]ûÆ-\¹çxóæÐ§_Û>úüçÍш´V\¹›·ïßÀƒ7ì— Â#Š`y)qòˆÄÁv=8a@Îhÿ’Z€âW‡ÿ?r¢àÄ+—*gï{ÛçÝ+]°þìµü@ÝO>%ѡ×K·eÕÿ=òWOrO"œñÆK+œ×_8ýqÉöÑrÅéqTÜ%oвÞ%UÉÀÚ`±ÆZj~Q›^ 4x ]>ý"A«5ö—O2V“a3ZöÅw|‘C$]¡Ÿ@«)áÙ1`dñÆ#ZvYEÁFtM4UP˜i†ŸT†ã:Ò‚âg|ž ŸU_œñˆšÂ‰à‚ &='è „j衈&ª3rIhŠäÞ’‘¤KŽB*ÐØ)Ÿ|rag'ñØ×'³X[†´t°Ò#¹ÿxÖ}jÝ!ÞnY%‘¡î¹a–Va@x¹âe_ ÈÒn²8 ¢Zä!¡‰Ã›¶7äê°¶EJO¼ñÄ_ÜVPfÖÞ'RêÅ€V¡ÈÖ}»}¢a}¥†Á˜É@ì’‹Q¹.M”ŠˆÑƒ—ý*§[»~2+D{±WïèrÔ×%™õ©–ˆÙvJ¾2±|ê%_!ÕI$õ•—µq¢c—ØwY_‰0dÆ(m4©s"F•åXo,ø”UÄÅÔÙÝiÀ—€Úë!.K)‚O G WJîH`»•%ªºVqÉ`øˆ\rrGP+Üñ¶Ü2üñÉ)âÿtÉ#‡8ÒΠ®<«v[*ePtFÉÀ0¥ Jð´äæzÉÖ²ó… A­-æ)ŽfÐÀz¹ˆ* ñITøä9Œ¬% :„ÏŠ4·û ÈQš9ÄÿÊr§¼ÉV‚Ó#Ž‚œÈENÀÒµS5TåVzˆŽÄšlY%;BÌÐfhž=Â'<´ÏrJý8]!P( Ù0À—OHmRgA¸z3¼ äEzDó:2ølI »D¼nRžIì&˜©ÍIrpx«Ž°äËľžé§8KÁ»sed7âLjj´=šäZ¨ÊH\&ƒL@`á{ɤz³+pýe8Á®¤™3 gÅCKKÆc‘%д]Õ&æÌòµ¤#Æáµ STwH_Zd;À=â„óVäô$̸¬9îº ‹Pf‘3?ÎZncîIƒ”hÍìŠ.AMàÈDNÉúÒ;÷³‚¥ÄJÆÜ‰ …˜‰ÄE'€”“´r)v=!¥ST™¯ØŠxzÑM½ 6ÍœÄJ:‚}¦km&CÛáM…ÑŒ:‰*"ØÕ€P‘P.E•#Ÿü•PÄsQ„ICš3^_A×›¶$8ç˜TB(BOe|ö‡S óHÞØÂ’–X(LG°†‚±iéN%Tí''U5'Š» þ.ôœ>" EÉæOÆÇ¿¢|ŒmÂCÔJ€/”ì v™»Îzv†ó£gGKÚÒš6";Apache-ASP-2.63/site/nodecheck_button.gif0000755000175000017500000000257211721310312016325 0ustar jobjobGIF89aXæÿÿÿÿÿÿÿþþþþþýýýýýüüüüüïïïííìììëëëäääääâââßßßÞÞÞÚÖÖÖÐÐÐÏÏÏÎÎÎÎÎÍÍÍÆÃÆÁÁÁ¿¿¿¾¾¾¼±±±¯¯¯ªªª£ŸŸŸžžžžžžœœœ„‚„„€€€ppp```PPP@@@000 j‚m=„6u.d,a'T&T%Q„ÀÀÀ!ùA,X@ÿ€4 …†‡ˆ‰Š‹ŒŽ‡$$45–)5š5?)––00)©–,©«0–™ ¤(5¦°(¼5œ£œÀ›"µ1–3" ›¡%4 ›ÔÕÖרÙÚÛÜÝÖ "ÐÒ5/.5( ,š35®¹ 33ÕÉ(/ïÀÈÑ‹qX‹.þ±H.F-\/–ÌÔ;É€ƒV£Ðª˜2ˆÌ@€¢Rª„K¥Ë—0•ÁH3f òjp´a#äÈ 8pHãGÍ£H“*­)ÎÖL?åtˆš´T¢T&ƒ à&î°³.ôÈ@ *²QãT ÷äó§+äd`•)«IÛ¢¨Ûh°¾ÐcJ&t Ž]9Y”Õ°Ð;•x®ä©—mÌ gJˆ9‡1ǰsÜãE×nûí¸ç®ûî¼÷î;ît;Apache-ASP-2.63/site/oreilly_oscon2001_speaker.gif0000755000175000017500000001433011721310312017677 0ustar jobjobGIF89a}}Õ– &úôõ™+“!–&•#–&—)˜*™,š /œ2üøùŸ<¥&H¡9V°Hdºj€Ç{Ñ”¤Ý¶ÁèÌÔðÜâõçë™3“1‰.]p&}#AøïòýûüGFGñðñûüü +**nmmÿÿÿþþþýýýüüüûûûøøøõõõìììàààÐÐÐÁÁÁ«««“““€€€ZZZ777,}}ÿÀŸpH,ȤrÉl:ŸÆŒtJ­Z¯Ø¬vËíz¿S!xL.›Ï\1zÍn»¥ê·|N¿Æ¹HÄQïû±wX,†+S+Ž+|S–ŽX”USŽœ—–Œ§ZV¢§+©§,”±V, Vž+À´+¼¹º+ɱY®UšŽ6²Rϲ,ŸRáéáV-Vï+¼Éæ¤êéØyÓWÁÂ8Gýв,‡‡#H`·áD2ˆ](§¢GvT4lCtUHŸ6@88£?ŽŽ*x„HÑâC!E³³0Ë2ÿ2 ¸ìððeÅGˆrøÆËߊI‰M6eX#7†VB‚ ŽJ¥êªË¨FmÕG•Ê´)G‰•Xµ¡î†¦ÏXÔÕàĸ õÙµÛVJ5$8b‘pІ•Ä$T+1Ã]¸‚_ÎWoÝaÀ Ãé‰Ee K&iÀ{0¤‰œ‚lŠƒƒ’žææ8Âî %ÆYHÚÖélrœÅÅ,xˆ„UÞ–KœQ6‹ ‹’¼d¡C`]µ¥LÇØ%…ƒC&¶Ø‚‡ÂNO«¸ö—V¤+S*Ä/­qýbÁ .5õ ­B•HÄàJ¸õVþ±Ð@ð˜à=ÉÅRÿƒw¢e ß~J©ðM¬8SR ùÃT3á—h×L0±€ d]yðH;aF Œ¥…Õ¬@Aˆ"’†Å"œÅ»¥¨Ü E‚“,R µYßÂB d"7Ïi,HÀNŽ H…Sû ¥%}Ž@4Ãbéñ´E8he*ä´Â~^ùà^of6UÔcÉv,|ÀËcäIàÒ»±]l1i¶+x—XpJ*´g¶ØHÈbï."˜àù¬pÕŠµ¦©Œ'cN%’‹}g¬ ÎÒ¡#wmÀÁŽä“°†)æ ]%ûÍ«UÄwJ7Œã R´¥†Lô' ÄØÂÿ‡¶—”sí~Šé¤gQJ€.$@”vÈÒËL33>BÁ¡vuPÃAÈøFŒ¯œ¹ƒ>œêÂZ¿ û·B)ùA[…àBà1DF‹í›+I‘Èmù ò]àâ÷kQÉ–¼rÃ4uÓ²hú­&åÊÉp,ÕÈp»"ˆ¿º4òŸ,úùsÏ/-tŒå]ÐQ<¢2u‰ºWÏ~Öµ…§šMJ]_Vö—g_ö¢Ê”ÛÏ‚±Út×- 4Ô ÷Þ|÷í÷߀.øà„n¸áx 1ÞŒ7îøãG.ùä”Wnùå˜ã=ƒ2È0Ãç ‡.ú褗nú騧®úê¬Ë  Ç.ûì´×nÿûí¸ç®ûî¼÷NÂïBÀC Äo|ñ¿wìÇ7ïüóÐG/ýôÔW< B´àÂöÜwï 5¨0Â8¨ B#ä@ Þ·¿} 6àpà ۿpA Ð`ƒ 5pOB ûÛßçj>pïy{A lpƒîÕ+î‹ 'Ƚ!3¨A §¤ï8ÐAn`>X,,° vœ£0 ´pè¢X˜‚Ä$@ 1Ä …;À V0ƒ¤àaÿŠ¢WpÁSÌÀâÓXÌ |6ÈÛ n œ6øAfðÜ@:h€€øÿÀs"È t¨‚áÅ 8" T@D#ã ¸A FÀƒÔgŠ´Dµ8Œ/90Ÿ HÀÀ šðŠ8¨$dp,ñ5¬Á"ЀˆÀ;ÁE0ÄŨ@8ØN¡ƒ"ªà5xA$‡y‰IZ|8@Ÿ ä'¾Ð’9à_øDéˆÔà7° xp l#ØTÁ†¨ÃŒ_Äe!¡ÈŒ`œ. ¦<aLH¸à6ÈùƒO“5À$ ýb‰4*1xa5ʼn‚èàa4ÁP@Q2ƒtÔ.!qƒPsžÃ¬ç#d`Nô±2 Áø–Ù¿ðuñÿ4ø!!Ól:œ$ÀÁ l°ø@‰ÂcA ƒXKGlô78ÁAI‘®@*ðàùÆÆŒ@‹[üœ ÂxŠôY+è%îµ;Â@=tÁæŠÊ‚[b´¨+(¢%nÀƒ2uŠ"•>;˜ù…qç+>û9B%Z12e byúœötœ›3'(HœÓª<ßWpƒØõ®Q¬ç BxU’oŒèëk&÷w¾L‚ÕA &ª´ G8x¢#nàC´¢  rð[!æö·9X „ Úþ  Rõ§1ÉWÜ@Ÿ+-Ÿ –*›°’Š–hÀ)±¼Ä@xÂûÿ^XÏ+¼½Â\Ám›ÛÔç>¢—t¦%;èÁé–¯´é; EßX“JGÀÀd¢¿ö-·ª²rÇF°XaYñµF±ÒÑ +€:6|`GLòQ5'ñ™ÌôaòªWMí ôg¾ñ>âP†<äHÅö–¼d «J2“§L˜xÊÈǰd £ÅT´ïSìW”ÒŸbaü@ˆƒ-·ဒ `àu†@’Lç>ÓyÈz泟é\e€öÄ€h/ØÀ“¤_GÀÒ¼™v3æb¦klSٙΠˆÀÿî\gMÈð¨òSS£úÐL¶rèŒj,õ¼ f‹Ù|ÝâÞü:ƒ\Ÿû{ °£ªGÙÈ9Õšxö®=áj`#«vô€ê,€à^€ ½ê€º&À—[\Å-xÇ0Ø_›Õ¼¸ë.S¿8¨Áu“{ÏǶ_Í€ |צæö´“\ë |àáÁ¬Ëå\ß™×½žä ø›ƒÌ “Ö  ÇI¸Lœy«ùä·#0ào<@à ·µže%Å%4O’>Ým/_@×s‚¼LêíÞÔ÷2ûšÏýaÒQ¹þ÷qp0à®B ÿmu£èæ6²Q$NëZCà ¸øº÷@}¥A$€~Îôq pzxfÏgn—uãq >Ø]xq€ØÖs X`íVZ#DQõ{è$áF[ôH¨Ñræ6v X+—upb }ã®Ç{lg_‹Df{ÕAòÃ`y³UmöZµ C•e`xµ„@ÈzµÖeP.—e!P‚H~öãaãó†[DUæãfô;K%qˆVy˜$?µ|²±m—˜‹„˜&JF{ÿ^h 2DeL¦ucØeã!ŠÃ˜„ôUEªø`oGi D~åcIéC‹ú†>vE‘×m ðI2n@æàˆèÈãhߦŽãQ ø7ÊØ\UÔa™¤Y3B÷@gÖA4`…Ðaá`{¶q µ ùÐ É)¦‰ŠŽÐKW•vocBç”oz“OçsU¶(OV(E)yy±ÀŒ¥aËXMxco™¤OÜ•bvß` v¡  q{ÙFù °“”àJqÅd_$a‡Z°X;æO}•>)pV¨‹WÀbÿ²°xF¶aŽê¸uàø7yÐŽéÈ0ÖBFdfÙ-ö0y‰=ékŽp• Æ_Õx]òCBù˜Oã3>´T-Œwx ð À&¸dŠ7y!€‹¾ˆ\¶dp?Â8Œ P si‚‡vxã&e«pUI^/ɘ˜ÄRkXÔ˜IWÅXP‚´ömÙ¦ ¬ÇÞwxž0pu¦eºf  š«F{¤¶k\Çz߆jk©žHh:x›ŽÀ€Œ¸ZcX»9]–ñô ÏFg ,vfk6Wk€«f€†¸kÒIjÕùxð k<8´æŸõ©{<8šÿ¬‡9ˆh‡‰yŽPX™I4r7¶`/éHW(uÕÉu° àspG¸k@œŠÓY è ì(u °zµvk+`†xx4'fž- ié)?©õ¡”›'y8hnšðP¥Ý2¤,Ð|$ȉ?G ÷Ck^w ƒ·+Z?Jd€4§,À)™`¹¥›$Ô_tš›)ð¤Q ¡æv`¯ñžðò§uZs]Šg6ú}?÷oà (-0z XÇ¢!(`LÅ'i”¶L&”RyC™üu§ÇŒ¬WgКÕTmž X˜e…: ˆú¥•§yèœôǃ£ÐÿóåÝö«©: ’$fÕ@ñé3€c¥Ìpà‡‡æe(–u­úª £†Z£´ZkJ†g°—¹juÂjªÀJh;jž4%B ‡cZåø !€sö«^Æ‹˜b¯ú”\Ê­pý)…åú§'H{´—‹˜¿BѤ>#•E"Tóz -$fhŠp ,ʯz˜­ÿê¥gð Pyµg°²­Ùª¦ g²z@‘™J¬+äw>ñéF%yIR·ÊjCz1Ø«4J²7*G)˃\XŒÑ‹ð“ØxÜɧPO.`žƒNõàFd±ôÿ.›­S´Yv´ZJ¨#;«ê ÐrV7®W'¦‡V’pµ˜Ú’8{¤ôQ ÿruF{d*¦¬V¨Šö´÷x5'Š•·*v£íD· 0®> ¤ ö·k{i¥`³ô„³)47^éq9© ørs$uçV1ûПz»hw( †w #Èk®Ê¨ ’›ƒ¡ª¯.·Ì»ã¨®ŽÐµÿ“¬ 7ª+EÒž½»£-­¯†¸¯Š»§Ý¿Û¢7(¼Êù«.‡p W¾„‚Ãj _Ô9§ÀI×EÀ}¯vô;†1›mÀ™ßú¾u£@»!ÐÿÑzhV& 0À‡9a‡ƒ6­:ç°Ž@Ñt^µ€7+© ±{}Þ¸,@´×w Ï€”ý{}F††P   `–æXÌ, Ѻxê&¬`kÍ{ÄÏ[¿Ž°f6 <LÄt!H¤K N©*}Ë € (í$º()¢{^|Åû÷-@¥c,ºUfUv /L%ü/¥ŠBw¼BË yÌõ¥oæ$.€Rs”¡ˆõ PK*D¶ÿç95€`D6< ;0( rÄÀËõ'p² Ëpö7Ëu/¹¥ºäS•Ô›Bì£ ,°8„ N}%>ði  Kׄ”F)P®*, ÎB$K±ˆV"p!Æ`áÏ)`> ôýNå,Ì6À•»ÑZ½/ …ìãÊR¨Ë9KóŠÍ«¤à:Íf+•7NôPŽÏ)!Ü;Ði0àB´´ †JüÖ!F<õªˆ+H"0S+ðÐJì2°c]Ô@±ðqç-€@ù&¢@'0€¼[@ô ­ˆ5à²ÔÓ)ÀD?`£õÿl”DŸCwǬS<Å3}S*×Y5ЖQgÆ`&€ï E4IŧY\w—°@^$X¤Y¡Pƒ5 üs#°úD:`TÝÜ-Í=ÑÍD±DݤmQú ÿ9=ÝÝÐBM9IðÃʤ7ßs±zƒ~ò;tWzÊê[èôÏ!N¸mQ±”B ¾/& &ÀX÷ÜqåwÌÕkŸÕ½[=á(0?u×-B°qØ´@æó0 9²=w¬Vò‚V8ˆu ðÓ,`?Ð' àÛàØ'4;@ãʺ÷‚Q?àÌL<ŽT œAÎY>p0jË&ÀMï äìAw­\8‰¡óÄ®ü ¤7èýÁŒÎRX‹CShœ7{ÃÊÖS'äEÕ$…àµ7¢4é4u'žc@†Î’ÕôԛꉎǢ’|ü(Lý Þ\º¨~ëÿ¸IN•ë¼ÎëPðëÀìÂ>ìÄ^ìÆ~ìÈžìʾìÌÞìÇ–ˆu]jÔYÐþa©?µÌC`N-…eBÄ[Þþ‘â^ÜN#TËãt %mæìMàÉNœ…M+ ï¬í4€QÖT¬üX?vMD0?NææþžCîÎD+€XÔ9B ï1ïL0ïÏÕYÙ¤F¬Íñè¢EÐPö›SðiÏo1EÕ]ÏÓi„7ndóËõö? TwSñsö@Sz´ojÔ{/„tä³F®sÌèCÖn´ÌCò>€ÛDÐùÒîµ*à-…ÙTËrùE€ñ¼lM Ìx?ºÅ÷4wÂä$OXMŸM5ÿûvŸTø9 ‰ÿø¶„´ùK_ìÙïFÔîJ°ýÕñ9þI@\ä¯ìEòç¿þÀ–`?ÐÖîOÓ>ñãÿã¤Ñ#tNBîï¿ßè¦ò ‘ÈÔ ‡æn)!§ŒþnÿÙê°xÄfGÓ›ð–ÚKt’Ì­f2ó{õ\Ѱõäí›9iðøm~PfVVXÌpWj¼’FbÇ~hV,‘ÞÌVdh !>gXp|0=Ç2ÉîÚda¥œldVT~è ôø†Vª6ù"mVÌFÂbjòÂ’DlbÂjO…6íÌX,˜¶/ñ0ñ^_âVœfÙRbþ„fjH ßÞ÷ôhš‰]²Ìfâ´Hȹ$2 Q±Â @x²ýhAƒI‚¦\Õ86†%á¡`˜‹]ïP h£ÆŒ]™\ÈpÁæF‹kãM¤QÅ\¦N¹!–Ä $±½ôÊÆOŒ¦dʸýVƒ.WcžLXÒÐEà B‘£Eމh²‚P›Hä½¼¡²JŠ¡lâÂAƒE¡¤?S ¡›fh&>ºåprÌ1$\r%cƒþŽ©PœÃ®/X9l´ÐÑöÆ¢aQnÁ1Æ$P¨hö˅ƹ.vÊpIcFÎ? vt ÛŽ.ü6»<Æ:8ø®ãšcÆ‹B3"3$kæXÚOªH³ñ †RvœígÍ¢rp´ÐU3 •~®F’špÛJ1»Æ°h É’ˆäDÐÁYPˆAº)¬P-ÌPÃ’8ÛÐÃA QÄI,ÑÄQLQÅ5 ;Apache-ASP-2.63/site/tuning.html0000644000175000017500000005350313252377730014531 0ustar jobjob Apache::ASP::Tuning
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
    % TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    TUNING
    A little tuning can go a long way, and can make the difference between a web site that gets by, and a site that screams with speed. With Apache::ASP, you can easily take a poorly tuned site running at 10 hits/second to 50+ hits/second just with the right configuration.
    Documented below are some simple things you can do to make the most of your site.

    Online Resources Precompile Scripts
    Tuning & Benchmarking No .htaccess or StatINC
    $Application & $Session State Turn off Debugging
    Low MaxClients Memory Sparing, NoCache
    High MaxRequestsPerChild Resource Limits
    Precompile Modules  

    Online Resources

    For more tips & tricks on tuning Apache and mod_perl, please see the tuning
    documents at:
    
      Stas Bekman's mod_perl guide
    
    Written in late 1999 this article provides an early look at how to tune your Apache::ASP web site. It has since been updated to remain current with Apache::ASP v2.29+
      Apache::ASP Site Tuning
    

    Tuning & Benchmarking

    When performance tuning, it is important to have a tool to
    measure the impact of your tuning change by change.
    The program ab, or Apache Bench, provides this functionality
    well, and is freely included in the apache distribution.
    
    Because performance tuning can be a neverending affair, it is a good idea to establish a threshold where performance is "good enough", that once reached, tuning stops.

    $Application & $Session State

    Use NoState 1 setting if you don't need the $Application or $Session
    objects. State objects such as these tie to files on disk and will incur a
    performance penalty.
    
    If you need the state objects $Application and $Session, and if running an OS that caches files in memory, set your "StateDir" directory to a cached file system. On WinNT, all files may be cached, and you have no control of this. On Solaris, /tmp is a RAM disk and would be a good place to set the "StateDir" config setting to. When cached file systems are used there is little performance penalty for using state files. Linux tends to do a good job caching its file systems, so pick a StateDir for ease of system administration.
    On Win32 systems, where mod_perl requests are serialized, you can freely use SessionSerialize to make your $Session requests faster, and you can achieve similar performance benefits for $Application if you call $Application->Lock() in your global.asa's Script_OnStart.

    Low MaxClients

    Set your MaxClients low, such that if you have that
    many httpd servers running, which will happen on busy site,
    your system will not start swapping to disk because of 
    excessive RAM usage.  Typical settings are less than 100
    even with 1 gig RAM!  To handle more client connections,
    look into a dual server, mod_proxy front end.
    	
    	

    High MaxRequestsPerChild

    Set your max requests per child thread or process (in httpd.conf) high, 
    so that ASP scripts have a better chance being cached, which happens after 
    they are first compiled.  You will also avoid the process fork penalty on 
    UNIX systems.  Somewhere between 50 - 500 is probably pretty good.
    You do not want to set this too high though or you will risk having
    your web processes use too much RAM.  One may use Apache::SizeLimit
    or Apache::GTopLimit to optimally tune MaxRequestsPerChild at runtime.
    	
    	

    Precompile Modules

    For those modules that your Apache::ASP application uses,
    make sure that they are loaded in your sites startup.pl
    file, or loaded with PerlModule in your httpd.conf, so 
    that your modules are compiled pre-fork in the parent httpd.
    	
    	

    Precompile Scripts

    Precompile your scripts by using the Apache::ASP->Loader() routine
    documented below.  This will at least save the first user hitting 
    a script from suffering compile time lag.  On UNIX, precompiling scripts
    upon server startup allows this code to be shared with forked child
    www servers, so you reduce overall memory usage, and use less CPU 
    compiling scripts for each separate www server process.  These 
    savings could be significant.  On a PII300 Solaris x86, it takes a couple seconds
    to compile 28 scripts upon server startup, with an average of 50K RAM
    per compiled script, and this savings is passed on to the ALL child httpd 
    servers, so total savings would be 50Kx28x20(MaxClients)=28M!
    
    Apache::ASP->Loader() can be called to precompile scripts and even entire ASP applications at server startup. Note also that in modperl, you can precompile modules with the PerlModule config directive, which is highly recommended.
     Apache::ASP->Loader($path, $pattern, %config)
    
    This routine takes a file or directory as its first argument. If a file, that file will be compiled. If a directory, that directory will be recursed, and all files in it whose file name matches $pattern will be compiled. $pattern defaults to .*, which says that all scripts in a directory will be compiled by default.
    The %config args, are the config options that you may want set that affect compilation. These options include: Debug, Global, GlobalPackage, DynamicIncludes, IncludesDir, InodeNames, PodComments, StatINC, StatINCMatch, UseStrict, XMLSubsPerlArgs, XMLSubsMatch, and XMLSubsStrict. If your scripts are later run with different config options, your scripts may have to be recompiled.
    Here is an example of use in a *.conf file:
     <Perl> 
     Apache::ASP->Loader(
    	'/usr/local/proj/site', "(asp|htm)\$", 
    	'Global' => '/proj/perllib',
    	'Debug' => -3, # see system output when starting apache
    
    	# OPTIONAL configs if you use them in your apache configuration
    	# these settings affect how the scripts are compiled and loaded
    	'GlobalPackage' => 'SomePackageName',
    	'DynamicIncludes' => 1,	
    	'StatINC' => 1,		
            'StatINCMatch' => 'My',
            'UseStrict' => 1,
            'XMLSubsMatch' => 'my:\w+',
            'XMLSubsStrict' => 0 || 1,
    	);
     </Perl>
    
    This config section tells the server to compile all scripts in c:/proj/site that end in asp or htm, and print debugging output so you can see it work. It also sets the Global directory to be /proj/perllib, which needs to be the same as your real config since scripts are cached uniquely by their Global directory. You will probably want to use this on a production server, unless you cannot afford the extra startup time.
    To see precompiling in action, set Debug to 1 for the Loader() and for your application in general and watch your error_log for messages indicating scripts being cached.

    No .htaccess or StatINC

    Don't use .htaccess files or the StatINC setting in a production system
    as there are many more files touched per request using these features.  I've
    seen performance slow down by half because of using these.  For eliminating
    the .htaccess file, move settings into *.conf Apache files.
    
    Instead of StatINC, try using the StatINCMatch config, which will check a small subset of perl libraries for changes. This config is fine for a production environment, and if used well might only incur a 10-20% performance penalty, depending on the number of modules your system loads in all, as each module needs to be checked for changes on a per request basis.

    Turn off Debugging

    Turn off system debugging by setting Debug to 0-3.  Having the system 
    debug config option on slows things down immensely, but can be useful
    when troubleshooting your application.  System level debugging is 
    settings -3 through -1, where user level debugging is 1 to 3.  User level
    debugging is much more light weight depending on how many $Reponse->Debug()
    statements you use in your program, and you may want to leave it on.
    	
    	

    Memory Sparing, NoCache

    If you have a lot (1000's+) of scripts, and limited memory, set NoCache to 1,
    so that compiled scripts are not cached in memory.  You lose about
    10-15% in speed for small scripts, but save at least 10K RAM per cached
    script.  These numbers are very rough and will largely depend on the size
    of your scripts and includes.
    	
    	

    Resource Limits

    Make sure your web processes do not use too many resources
    like CPU or RAM with the handy Apache::Resource module.
    Such a config might look like:
    
     PerlModule Apache::Resource
     PerlSetEnv PERL_RLIMIT_CPU  1000
     PerlSetEnv PERL_RLIMIT_DATA 60:60
    
    If ever a web process should begin to take more than 60M ram or use more than 1000 CPU seconds, it will be killed by the OS this way. You only want to use this configuration to protect against runaway processes and web program errors, not for terminating a normally functioning system, so set these limits HIGH!
     
    Apache-ASP-2.63/site/concept_online.gif0000644000175000017500000000767611721310312016015 0ustar jobjobÿØÿàJFIFZ_ÿþCreated with The GIMPÿÛC    $.' ",#(7),01444'9=82<.342ÿÛC  2!!22222222222222222222222222222222222222222222222222ÿÀ#+"ÿÄÿÄ=!1"AQaq#2‘¡BRÁÑá3br±ð$4d‚’¢²ÿÄÿÄ+ !1AQa‘q¡±ÁÑð2BÿÚ ?ÏvwB“^ÔL+•·C™\~ƒÞ¾#¾Ÿ'Øž²‰®"Pe‘ÇÝÞ™óf=ižÀéqÚhÑ>y³3\ôý1]èLñè;FDòßϸ‘Éñ1ôP|‹‰u}‡sBìmú”÷ ÛK%ïVòÆçûžä)?.?M¥vØ]]‹ NÐXÞ€®<,}³[ë )³€Î|•Vv›±ú~¹hÊñ„” £¨”ûS .µ—Ÿ «÷†ƒx®÷úÍik¨ÂÖ÷0«*¾sÚÌý—rÈ ´-Ê9ÇŠÓvvãS¶{/SVi¬¶„¸Ç!éóXï?L –Këøa†öK[{E*í™äÇ!I `zõ¦u{¡>‡uƒû&‹Œ£ ½‘BÇ~>Ó¥À¡/mnõ$£PKd\Žï¸rÙõÎ@ö¦Rì7¬Íö ©)ñ~Ѿ¤HüEN+¸kzSKa}¬K!µ¹6v±ŒJ«™%aÁÛžŒó^–Ô´ðe†úKØÔe✠ØõqúUE•ЃMµ8T]§çž;ms½ËðI>Uʸ—.“Vä]ß÷¤©r¯¦¶í.†©šwÅÆ|wsåê yk«A{n&…Á†ÈÖOOºöz瓲V•£ÿ)'Ÿ_­t'HR í@÷(%ŒqÞ Ö¦¹³Xj±¤:ï||»F(”G‰©©“TÙ¨Ám ¨ÍŸLWƒUΣ5©G¸>¹¬åÍÔm}a:8!£~3È⢒ïn¥4¹ën¿êi“1r ›«ËMÀɤ׿j/5_†XFD“¤GþæøÑ{¬E`ci˜,nH$ùVV{Á5¬?†îÿ¸¦n®#–âȺ‡Q#†SÈ £ 9Ÿ .ѵΦ@»Xèf¨]‚S žAuަnžèŽæSÏãYÛ¤¶™#ï Y³aœ˜Ï¡ö©,&D¸ÔÍAëáZ+›"¡Ø‹±öòí@°ÜmRÆSX¼¶ø‹K{Nè–Uïdel‚G æ*Æ;©„|NÁ6Á¿aðîóÆ|«!ms|l· I C#…áÃmÃ×?_­1&¡µT4ÛÙQT·MÇœS{¶Æ¯p90f Ä ©ø³Íz·d¨éYfÔñô®cÔ²ƒÇ]šd.qÙ6  ÙútÿäU]çhÚ[6½Œ 6\«Ëû’Á>ÔvSK+i!³¯—•[]i¶wöóØß håÉÿZƒ€2£¿ùëÓó(5l©ÎÓ\³$‘¬ˆá‘†TƒÁBò 3`¼ÿZùe¶£ÚÁÈmÌoªhª|$CçþÇÊ­eþÑt}F 븪L û×FBUoÕòüöœèÀšÈtüÿäÝ¥Ôd†H$ƒ}Ìjÿä,wÚ«…[À<_ëTßšýå¼VAÞÆDÓܰ Hâ®|³É>Õµ|/õ!6a·cå‘ÐVÁ„ãZmØî~päʉ&7]`·ÐGõùÕõ®¸‘Ä&do@r+?(žº±rOûÍjl´hc‚"B·vÙL§#õ«½\L@Ô·´Ôžá S’èãËŒ~½jWÕ.`ÌK<*Ž ÊCž?¥C!Hä@\ƒ%þ´³In/d/+䜷çï\ϵ¿†ßiuÈÊ*q&³ÜÊ;ç2ÊIÜ=«@2x¦TðÙœ,êr¾Ù-½µƒ^DešFbFrž^•kl4«3 ûn¤XA2Œ¯$ÏŸ­fÁŒÕŽ:Ù¿Y†Fã›S’VYd`LGî£UÚŠzg®I÷52ê3Jð>ð«âT¯,HÇ_­1éu'Ä  Û2¢ ÁÛà\à㑜àבÝÚ}«pæí–ÜÈÎUG‰Ð?8à`Ÿ#ŠÃ0µ^>skk»‰>£4S«2÷0é=EGg<–ö¥mÞGQ;82~!œp}jçP«e ¶¥åœºåbubÃk®Aåô®¤ŠÔ3m=FÑ·å“Ob ‹Å¨´Ne(V` ‘̛МyyƒKê7×r/ÃܼbÙ†LVÊW³1çÃaa±žÖ+ÑÖ­+Í$9Ù†[#ëL$zeÄN.oY&I$ j6€ƒŒdå@lçùW8öl ì6íf½8”÷¯ÞTÝk¥4A*Å3ø  z~UBúÉ’>ïqeP2<ñZF•$·+qp;´r# (,‡ ¼yóŸ¥HÚ=ŠhóÞڴŶx2Û ñÔ [JêÖüD³U3¯¨È÷ñÞë*£#'“gÏçO&½pz<vm(ñOÔMJºz[Ì;â÷È[j«náw0Ë2hTÓ Èó²Ü–S°ïÃ1Ê:ñŒŒâ¤Ø1‘U[ÞÛoåda½Ä>ÕšDHÃ*•$r‚çgŽ•ßÚÓÌñÛV7,T¯âÈ#òëVÞŒneíä‡ #˜$1ÎF@ÁÇë\Ù 5äÿŒ-aÚaÝbx*q‹QÛéÄ]mßøÊ¤Ô.à—îâi"“ñ.܃V:$¿ YäŽY{Ñ»’¹c>ئm%ÓþLg½{~÷gÄK…ÌDù‚?Hm#³K…¸îîEWÉMø x;I':fT-¨àW<—±†…§´*¤ÆÜŒdg÷©ï'-ªï“n÷ 0?//.¦¦»kU·YK,“;âV[»'9+ÈÏ‘L¼61ÊÓœ÷€`íǨùõ¥Ã…1l—êOÞvm̦“S~æCÈËwuϧJ’Ù;•Èç Ჺ½dÈDyÎW«¶?½ük¢JWvbWŒ¦Æ#å_K·c5¢´ž#ëŠ(©JH¥Š7²‚QUFßn66å½L`ÑE2€£h¿2-]ͦ”ÿˆøÇ„VRåŒ:øÎòXù“EUæMÿÌÍhŽÆêV'-ëŠÛ[Lÿ 9tQE#s8‘ÝÊÿ¼Žž‚«.ånzœôùÑEa Œ ™vnßÈp)[›Ûû„Í“œš(¢°½¹hFé˜àñš’âúê2Ç;«þð<ÑE4¨ïî†Nûˆ9äÔFúè»æwëëE¦’Û_ÝüTmñdyî«=.îyf™ä“sn#$ ( aWšM³xnµãÝNÓB†V*IgçE„ÒÖÞyV'ErŸy}}t¶q3cpÿZ(¤ë¤êíD‹"¶H ç SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global . PerlSetVar GlobalPackage My::Search PerlSetVar StateDir /tmp/asp_search PerlSetVar Debug -3 PerlSetVar IncludesDir ../../eg PerlSetVar UseStrict 1 PerlSetVar SessionSerialize 1 PerlSetVar SearchDB /tmp/asp_search/search PerlSetVar SearchFileRoot ../.. PerlSetVar SearchSiteRoot ../.. PerlSetVar SearchRefreshPeriod 86400 PerlSetVar SearchFileMatch (\.asp|\.html?)$ Apache-ASP-2.63/site/apps/search/global.asa0000755000175000017500000001212211721310312016446 0ustar jobjobuse lib qw(../../eg); use File::stat; use File::Basename; use MLDBM::Sync; use File::Find qw(find); use DemoASP; use Fcntl qw(O_RDWR O_CREAT); use Cwd qw(cwd); use vars qw(%CONF %SDB $title %TEMP_SDB); sub Script_OnStart { %TEMP_SDB = (); for('DB', 'FileRoot', 'SiteRoot', 'RefreshPeriod', 'FileMatch') { $CONF{$_} = $Server->Config('Search'.$_) || die("no config for $_"); } $CONF{FileRoot} =~ /\W/ or die("The FileRoot config must have a non word character in it ". "that matches \W, like '/', so a local dir may be specified ". "with ./"); if($CONF{FileRoot} !~ m,^(/|[a-z]:[\\/])$,) { $CONF{FileRoot} = cwd().'/'.$CONF{FileRoot}; } $Response->Debug('Search %CONF', \%CONF); # only one person allowed to search at a time, this is # in case we ever have to update a stale database { local $MLDBM::UseDB = 'MLDBM::Sync::SDBM_File'; my $sdb_object = tie(%SDB, 'MLDBM::Sync', $CONF{DB}, O_RDWR | O_CREAT, 0640) || die("can't tie to $CONF{DB}: $!"); $sdb_object->Lock; $Server->RegisterCleanup(sub { if(%TEMP_SDB) { $Response->Debug("start saving TEMP_SDB to SDB"); %SDB = %TEMP_SDB; $Response->Debug("done saving TEMP_SDB to SDB"); } untie %SDB; $sdb_object->UnLock; }); } &refresh_db(\%CONF); } sub search_words { my $input = shift; $input =~ s/(\,\s|[\s\{\}\(\)%:;=\$\"\'\/\#]+)/ /sg; my @words = split(/\s+/, $input); my @dropped; my @final; my %final; for(@words) { if(length($_) < 3) { push(@dropped, $_); } else { $_ = lc $_; push(@final, $_); $final{$_}++; } } %final; } sub refresh_db { my($CONF) = @_; $SIG{__DIE__} = \&Carp::confess; if(($SDB{LastRefresh} + $CONF->{RefreshPeriod}) < time or ($SDB{LastRefresh} < stat($0)->mtime) ) { %SDB = (); $SDB{LastRefresh} = time(); my %files; find( { wanted => sub { if(! /$CONF->{FileMatch}/) { $Response->Debug("$_ does not match $CONF->{FileMatch}"); } elsif(-d $_) { $Response->Debug("$_ is a directory"); } elsif(-e $_) { $Response->Debug("indexing $_"); my $words = &index_page($_); $files{$_} = $words; } else { $Response->Debug("no file for $_"); } }, no_chdir => 1 } , $CONF->{FileRoot} ); $Response->Debug("indexing words for ".scalar(keys %files)." files"); my %words; for my $file ( keys %files ) { my $file_dict = $files{$file}; for my $word ( keys %$file_dict ) { my $count = $file_dict->{$word}; $words{"W:$word"}{$file} = $count; } } $Response->Debug("reading search database"); my %temp_sdb = %SDB; $Response->Debug("building search database", scalar(keys %words)); %TEMP_SDB = ( %words, %temp_sdb ); $Response->Debug("done search database"); } } sub index_page { my($file) = @_; return unless -e $file; $Response->Debug("indexing $file"); my $mtime_key = "MTIME:$file"; my $file_key = "FILE:$file"; my $file_data = $SDB{$file} || ''; my($mtime) = split(/\:\:/, $file_data, 2); $mtime ||= 0; if($mtime >= stat($file)->mtime) { $Response->Debug("file $file has not been modified recently, last update $mtime"); return; } if($mtime) { for (keys %SDB) { if(/\:$file/) { #$Response->Debug("deleting old key $_"); delete $SDB{$_}; } } } open(FILE, $file) || die("can't read $file: $!"); my $data = join('', ); close(FILE); $data =~ s/\<\%.*?\%\>//sg; # strip ASP code $data =~ s/^\#\!.*?\n//s; $data =~ s/\.*?\\s*(.*?)\s*\//isg; $data =~ s/\<[^\>]+\>/ /sg; $data =~ s/\&\w+\;//sg; $data =~ s/(\,\s|[\s\{\}\(\)%:;=\$\"\'\/\#]+)/ /sg; while($data =~ s/\s+([A-Z]+)\s+([A-Z]+)\b/ $2 /s) {}; my $summary = substr($data, 0, 20000); # $Response->Debug("just parsed $data"); $data = ' '.$data; my @words = split(/\s+/, $title.$data); my %words; for(@words) { next if length($_) < 3; next if length($_) > 20; $_ =~ s/\W+$//; $_ = lc $_; $words{$_}++; } # for my $word ( keys %words ) { # my $count = $words{$word}; # my $word_key = "WORD:$word"; # my $word_dict = $SDB{$word_key} || {}; # $word_dict->{$file} = $count; # $SDB{$word_key} = $word_dict; # } $Response->Debug("fetched words for $file"); # : ".join(", ", sort keys %words)); $SDB{$mtime_key} = stat($file)->mtime; $SDB{$file_key} = { title => $title, summary => $summary, }; my $weight = 1 / length(scalar(keys %words)); $SDB{"WEIGHT:$file"} = $weight; # $Response->Debug($SDB{$file_key}); \%words; } sub search_files { my(@words) = @_; my %files; my %matches; my $DB = %TEMP_SDB ? \%TEMP_SDB : \%SDB; for my $word (@words) { my $word_dict = $DB->{"W:$word"}; if($word_dict) { for my $file ( keys %$word_dict ) { $matches{$word}++; $files{$file} ||= 1; $files{$file} *= int(( $word_dict->{$file} + 2) * $SDB{"WEIGHT:$file"}) + 1; } } } (\%files, \%matches); } Apache-ASP-2.63/site/apps/search/index.asp0000755000175000017500000000442511721310312016343 0ustar jobjob<% my $input = $Request->{QueryString}{search} || $Request->{Form}{search}; my $copy = $input; my %final = &search_words($copy); my @final = keys %final; $title = "Site Search"; %>
    method=POST>
    <% unless(@final) { %> No search performed. <% $Response->Include('footer.inc'); $Response->End(); } my($files, $matches) = &search_files(@final); if(keys %$matches) { %> Matches: <%= join(", ", map { "$_: $matches->{$_}" } keys %$matches) %>

    <% } else { print "No matches found for your search."; } print "\n"; my $count = 0; my $final_match = join('|', @final); for my $file (reverse sort { $files->{$a} <=> $files->{$b} } keys %$files) { my $score = $files->{$file}; $Response->Debug("listing ranked $file"); my $file_data = $SDB{"FILE:$file"}; my($title,$summary) = ($file_data->{'title'}, $file_data->{summary}); # $Response->Debug($file_data); unless($title || $summary) { $Response->Debug("no data for $file"); next; } unless(-e $file) { $Response->Debug("file $file is deleted"); next; } my $wrap_per_match = 200 / @final; my $head_match_size = int($wrap_per_match / 3); my $tail_match_size = int($wrap_per_match / 3 * 2); my %summary_matches; my $summary_match = '... '; $summary =~ s/\b(.{0,$head_match_size}\b)($final_match)\b(.{0,$tail_match_size}\b)/ { unless($summary_matches{lc($2)}++ >= 3) { my($head, $mid, $tail) = ($1, $2, $3); $head =~ s,\b($final_match)\b,$1<\/b>,sgi; $tail =~ s,\b($final_match)\b,$1<\/b>,sgi; $summary_match .= "$head$mid<\/b>$tail ...<\/b> "; } ''; } /esgix; my $rel_file = $file; $rel_file =~ s/^$CONF{FileRoot}\/?//; $title ||= $rel_file; %> <%= ++$count %>. <%=$title%> ( Score: <%= $score %> )
    <%= $summary_match %>

    <% ; $Response->Flush; } %> Apache-ASP-2.63/site/apps/search/source.asp0000755000175000017500000000004011721310312016521 0ustar jobjob Apache-ASP-2.63/site/apps/bookmarks/0000755000175000017500000000000013252400404015245 5ustar jobjobApache-ASP-2.63/site/apps/bookmarks/.htaccess0000755000175000017500000000057211721310312017047 0ustar jobjobDirectoryIndex index.asp SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global . PerlSetVar GlobalPackage My::Bookmarks PerlSetVar StateDir /tmp/asp_apps_bookmarks PerlSetVar Debug 2 PerlSetVar SessionTimeout 15 PerlSetVar StatScripts On PerlSetVar AllowApplicationState On PerlSetVar AllowSessionState On PerlSetVar TimeHiRes On Apache-ASP-2.63/site/apps/bookmarks/dummy.asp0000755000175000017500000000002411721310312017101 0ustar jobjobINTRO <%=$Session%> Apache-ASP-2.63/site/apps/bookmarks/footer.inc0000755000175000017500000000046411721310312017242 0ustar jobjob
    size=-1 color=<%= $DarkColor %>> My-NotExists-Bookmarks Cool Technologies Etc., ???, © <%= (localtime())[5] + 1900 %>
    Apache-ASP-2.63/site/apps/bookmarks/global.asa0000755000175000017500000000377111721310312017203 0ustar jobjobuse File::Basename; use DBI; use DBD::SQLite; use vars qw( $DarkColor $Name %Titles $FontBase $Db $Title $Basename $Form $Query ); $DarkColor = '#0000aa'; $Name = "MyBookmarks"; %Titles = ( 'index.asp' => 'Introduction', 'bookmarks.asp' => 'Viewer' ); $FontBase = 'face=verdana,arial'; sub Script_OnStart { &init_db(); $Basename = basename($0); $Title = $Name.' / '.$Titles{$Basename}; $Response->Include('header.inc'); $Form = $Request->Form(); $Query = $Request->QueryString(); $Response->{Expires} = 0; # a user may logout from any script, destroy session, and go # to login / intro page if($Form->{logout}) { $Session->Abandon(); $Response->Redirect("index.asp?abandon=". ++$Application->{abandon}); } } sub Script_OnEnd { $Response->Include('footer.inc'); } sub Application_OnStart { &init_db(); # use max_bookmark_id as a pseudo sequence $Application->Lock(); my $max_id = $Db->selectrow_array("select bookmark_id from bookmarks order by bookmark_id desc"); $Application->{max_bookmark_id} = $max_id; $Application->UnLock(); } sub init_db { my $db_file = $Server->Config('StateDir').'/'."bookmarks.sqlite"; $Db = DBI->connect("dbi:SQLite:dbname=$db_file","","", { RaiseError => 1 }) or die "Cannot connect: " . $DBI::errstr; # $Db = DBI->connect("DBI:CSV:f_dir=".$Server->Config('StateDir'), '', '', # { RaiseError => 1 }) # or die "Cannot connect: " . $DBI::errstr; # setup bookmark database if first time # die $Server->Config('StateDir'); unless(eval { $Db->do("select bookmark_id,username,title,url from bookmarks") }) { eval { $Db->do("drop table bookmarks"); }; $Db->do(<do("select * from bookmarks") || die("can't do select against bookmarks: $DBI::errstr"); } Apache-ASP-2.63/site/apps/bookmarks/bookmarks.asp0000755000175000017500000000662711721310312017755 0ustar jobjob<% # only a logged in user may view the bookmarks $Session->{'user'} || $Response->Redirect('index.asp'); my $error; if($Form->{submit} =~ /create/i) { unless($Form->{new_url}) { $error = "The Url must be ". "filled in to create a new bookmark"; goto ERROR; } my $sth = $Db->prepare_cached( "select url from bookmarks where username=? and url=?" ); $sth->execute($Session->{'user'}, $Form->{new_url}); if($sth->fetchrow_array) { $error = "You already have $Form->{new_url} ". "for a bookmark"; goto ERROR; } else { $sth = $Db->prepare_cached(<Lock(); $sth->execute( ++$Application->{max_bookmark_id}, $Session->{'user'}, $Form->{new_url}, $Form->{new_title} ); $Application->UnLock(); } } if($Query->{delete}) { my $sth = $Db->prepare_cached(<execute($Query->{delete}, $Session->{user}); if(my $data = $sth->fetchrow_hashref) { my $sth = $Db->prepare_cached(<execute($Query->{delete}, $Session->{user}); $Form->{new_url} = $data->{'url'}; $Form->{new_title} = $data->{'title'}; } } # get all the bookmarks ERROR: my $rows = $Db->selectall_arrayref( "select bookmark_id, username, title, url from bookmarks where username=? ". "order by bookmark_id", undef, $Session->{'user'} ); my @bookmarks; for my $row ( @$rows ) { push(@bookmarks, { bookmark_id => $row->[0], username => $row->[1], title => $row->[2], url => $row->[3], }); } %> <% if(@bookmarks) { %> Welcome to your bookmarks! <% } else { %> You don't have any bookmarks. Please feel free to add some using the below form. <% } %>

    <% if($error) { %>

    * <%=$error%> <% } %>

    method=POST> <% for ('new_url', 'new_title') { my $name = $_; my $title = join(' ', map { ucfirst $_ } split(/_/, $name)); %> <% } %>
    <%=$title%>: value="<%=$Form->{$name}%>" size=40 maxlength=120>
      >
    <% if(@bookmarks) { my $half_index = int((@bookmarks+1)/2); %>

    cellspacing=0>
    > <% for(my $i=0; $i<$half_index; $i++) { %> <% for($i, $i+$half_index) { my $data = ($_ < @bookmarks) ? $bookmarks[$_] : undef; $data->{title} ||= $data->{'url'}; my $text = $data->{bookmark_id} ? "{'url'} >$data->{'title'}" : " "; %> <% } %> <% } %>
    Bookmarks
    <% if($data->{bookmark_id}) { %> {bookmark_id}" %>>[DEL] <% } else { %>   <% } %> <%= $text || ' '%>

    <% } %>

    Apache-ASP-2.63/site/apps/bookmarks/index.asp0000755000175000017500000000202011721310312017053 0ustar jobjob<% # process user login my $error; my $user = $Form->{'user'}; if(defined $user) { $user =~ /^\w+$/ or $error = "Your username must made of only letter and numbers"; length($user) > 3 or $error = "Your username much be at least 4 character long"; unless($error) { $Session->{user} = $user; $Response->Redirect('bookmarks.asp'); } } $user ||= $Session->{user}; %> Hello, and welcome to the MyBookmarks Apache::ASP demo application. To begin your bookmark experience, please login now:
    <% if($error) { %>

    * <%=$error%> <% } %>

    method=POST>
    This demo makes use of the Apache::ASP objects, especially $Session and $Response, modularizes html via SSI file includes, and uses the Script_OnStart and Script_OnEnd event hooks to simplify common tasks done for each script in this web application. Apache-ASP-2.63/site/apps/bookmarks/header.inc0000755000175000017500000000124511721310312017172 0ustar jobjob <%=$Title%>
    method=POST> >
    size=+1 color=yellow> <%=$Title%> <% if($Session->{user}) { %> for <%= $Session->{user} %> <% } %> > <% if($Session->{'user'}) { %> <% } else { %>   <% } %>
    size=+0> Apache-ASP-2.63/site/articles/0000755000175000017500000000000013252400404014120 5ustar jobjobApache-ASP-2.63/site/articles/perlmonth3_tune.html0000644000175000017500000004432211721310312020136 0ustar jobjob Apache::ASP Site Tuning
    Note: this article was from a series running on PerlMonth from 1999. PerlMonth.com seems to have disappeared, so this article is reposted with some slight modifications to make it current for recent releases of Apache::ASP ( versions >= 2.29 ).

    Apache::ASP Site Tuning

    by Joshua Chamas <chamas at alumni.stanford.org>

    Last month, we used Apache::ASP to build a simple MyBookmarks web application. Now we are going to tune the Apache::ASP web application and Apache web server, taking a mild mannered web app running at 250,000 pages per day, and boosting it up 4 times to a 1,000,000 pages per day powerhouse.

    Are you ready? Let's Tune!

    Methodology

    The application was taken as it was built last week, and incrementally benchmarked, changing one configuration setting at a time, and showing the performance changes below. The URL tested is the main URL of the application, .../bookmarks/index.asp.

    The application is run on a Solaris x86 box, PII300 512K cache with 2 4G 7200 RPM SCSI drives in a software RAID 1 configuration. The following numbers are not meant to be compared against other web application environments, or systems, but show relative performance improvements when tuning Apache::ASP and Apache on this particular system.

    The web server software being tested is apache 1.3.4, with the testing client ab, or ApacheBench, run locally on the server. Because ApacheBench does not support cookies, a new Apache::ASP $Session is created in StateDir for every request, so that the benchmark numbers are worse than what you would see in a production setting. Obviously testing locally does not take into account many slow client connections over the internet, which would likely be offset by a reverse proxy accelerator in production (see mod_perl guide).

    The ab program was run with 5 concurrent clients for 30 seconds with the following command:

      ab -c 5 -t 30 http:// $HOST /bookmarks/index.asp
    

    Tuning

    After running the first bench, and watching the system under top, it becomes strikingly clear that disk i/o is the bottleneck, with 50%+ of the time spent waiting for disk. The reason is that state management for $Session and $Application uses SDBM_File, or optionally DB_File, databases on disk to store data, and is highly i/o intensive.

    The trick then is to relocate the StateDir to a fast cached file system. On Solaris, this happens to be /tmp/... by default, but on Linux and WinNT, the file systems seem to be cached automatically, so you may not need to do anything except locate StateDir to a secure, non-browsable, location. Using a cached or RAM file system will also spare your disk, which is good as it is often the first thing to go on your box.

    Hits/sec Before After
    +116% 6.5 h/s 14.1 h/s
    Configuration
    AP.htaccess yes yes
    APMaxClients 5 5
    APMaxRequestsPerChild 50 50
    Debug 1 1
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 0
    SessionTimeout 15 15
    StateDir .state /tmp/bookmarks
    Comments Disk i/o activity takes 50% of the time, because the StateDir is pointed at a non-caching file system. Disk i/o activity is nearly 0%, with roughly 75% of the time spent in the user space, and 25% in the kernel
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    More straightforward is turning off debugging. The Apache::ASP code has been streamlined for production when debugging is turned off, and there is a significant penalty for leaving it on, as well as a bunch of clutter in your error_log.

    Hits/sec Before After
    +12% 14.1 h/s 15.8 h/s
    Configuration
    AP.htaccess yes yes
    APMaxClients 5 5
    APMaxRequestsPerChild 50 50
    Debug 1 0
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 0
    SessionTimeout 15 15
    StateDir /tmp/bookmarks /tmp/bookmarks
    Comments Disk i/o activity is nearly 0%, with roughly 75% of the time spent in the user space, and 25% in the kernel
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    Those were the two big basic tunes for Apache::ASP. Let's now go to the Apache web server. So far, our configuration information has been stored in a .htaccess file, which must be reparsed every request by Apache. So, we move the configuration information into one of the *.conf configuration files, to avoid that per request overhead. Also make sure to disallow .htaccess file parsing on up the file tree by setting an
      AllowOverride None
    
    wherever your Apache::ASP application is located.

    Hits/sec Before After
    +9% 15.8 h/s 17.3 h/s
    Configuration
    AP.htaccess yes no
    APMaxClients 5 5
    APMaxRequestsPerChild 50 50
    Debug 0 0
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 0
    SessionTimeout 15 15
    StateDir /tmp/bookmarks /tmp/bookmarks
    Comments Couldn't believe my eyes when I saw there to be so little difference when not using .htaccess. My guess is that the Apache people optimized this at some point.
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    The MaxRequestsPerChild is commonly overlooked in web server setup. What this does is control the number of requests that a child httpd server may serve before exiting, and the parent reforking another one. With mod_perl library loading and script recompilations, a fork is no small thing, and avoiding the fork penalty is important.

    We had the MaxRequestsPerChild pretty low before at 50 but we up it now to 500 which should be fine for production. You don't want to set this too high, or the mod_perl httpds will often take up too much memory because of leaks, and shared forked code becoming unshared as it gets dirtied.

    Hits/sec Before After
    +31% 17.3 h/s 22.8 h/s
    Configuration
    AP.htaccess no no
    APMaxClients 5 5
    APMaxRequestsPerChild 50 500
    Debug 0 0
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 0
    SessionTimeout 15 15
    StateDir /tmp/bookmarks /tmp/bookmarks
    Comments Couldn't believe my eyes when I saw there to be so little difference when not using .htaccess. My guess is that the Apache people optimized this at some point. This bench only had 684 requests, so there was no parent httpd forking during this time, whereas before there may have been reforking every few seconds during the 30 second bench.
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    Back to Apache::ASP, and some finer tuning. By default SessionSerialize is 0, and we are going to turn it on. What this does is lock $Session for exclusive use during the course of the script being run, so that any reads or writes to $Session don't have to lock it every time. Because of the i/o requirements of SDBM_File, each time $Session is read from or written to, it is freshly tied to the database and locked, so to avoid these ties can save much.

    The reason why SessionSerialize is not enabled by default is that one could easily deny service to a user with a long running script, such that no other scripts for that same user $Session could be run, and this requires some expertise. Also SessionSerialize is probably not a good thing for framed sites, where there is greater concurrency for the same $Session.

    Hits/sec Before After
    +12% 22.8 h/s 25.74 h/s
    Configuration
    AP.htaccess no no
    APMaxClients 5 5
    APMaxRequestsPerChild 500 500
    Debug 0 0
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 1
    SessionTimeout 15 15
    StateDir /tmp/bookmarks /tmp/bookmarks
    Comments This bench only had 684 requests, so there was no parent httpd forking during this time, whereas before there may have been reforking every few seconds during the 30 second bench.
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    From start to finish, we have nearly quadrupled the speed of the web application, and thus the site's ability to serve up web pages. This one should handle just about 1,000,000 page views per day. :)

    Hits/sec Before After
    +296% 6.5 h/s 25.74 h/s
    Configuration
    AP.htaccess yes no
    APMaxClients 5 5
    APMaxRequestsPerChild 50 500
    Debug 1 0
    Global . .
    GlobalPackage My::Bookmarks My::Bookmarks
    SessionSerialize 0 1
    SessionTimeout 15 15
    StateDir .state /tmp/bookmarks
    Comments Disk i/o activity takes 50% of the time, because the StateDir is pointed at a non-caching file system.
    Legend Configuration items that start with AP are Apache configuration options, the rest are Apache::ASP. The .htaccess one means that configurations are stored in the .htaccess if yes, if no in a configuration file. The configuration changes between benchmarks are highlighted in pink.

    For more information on Apache::ASP tuning, see the tuning docs online. Apache-ASP-2.63/site/articles/flow.gif0000644000175000017500000001022011721310312015546 0ustar jobjobGIF89a¢³ÿÿÿ999ccc”””µµµÞÞÞÀÀÀ!ù,¢@ÿÈI«½8ëÍ»ÿ`(Ždižhª®lë¾p,Ïtmß`pì|ïÿÀ `,È¢aSàžžÂJ Áui¹…ku<$wMC!@ð A< |y„ûZ.ç =€l=pmtr:g\M0l’v–Sš/Rd!RY Xv¦¬fg°±²³±ŒŽ­U›4n=Z\»q¶%–™SZ€¥˜”(qaPpÂMݹ妸æ8Ÿé!XCâ½yr«PÞY­÷Åìþy H° Áƒ› \Ȱaž~ÿ`܃x£€¦d'°HHÖ- …6™ÿD°ÑVÇ<) ¤ŠödÔ«!¼"–!)³æ‰u61dA€€bŒž×h>¹‚@­£Aøù̹$Ó§pBE¡iåÊ*£™ç@5ììû,˜Wd+ФÕÇ›N§Ê¥°d‰£¥s5ˆÑ¡èYÎ%DŒ¶¼Ã Þ¼qó*®sq‡TŽQ¨¼$•ßÈ]èàù"r˜™1q‰—¡¯®àU­yèL!‡4´9ôýj»’Ý9½+ˆ^á¦1æãT¥‚åë<~-†á'ía&»ÏHÑ#qÏz@<.ÏŽ3"~$X”·¼¼{S°]n÷çNÐüäßsȯ¿¿{9ˆ±Aÿ6tˆ§þ]€`‚ 6è +pøðà„:¶€V€@”fæEÄa0Wáˆ$²PÕ=Êd•qÜ»X•¢{"–hc:Ḃœñ´„¯I Q,ØaGWã œ9A“O:eˆ7VICª¨°^÷Yéå—`†)æ˜d–iæ™h¦©æš:ÁÖû GVX>ÊiOMAÈ|mÖmc £R„Ýð´gx¡Ó$и# qÌÛ[Ò`ƒ¢‹É·Ù yÜÃ"›“&ª,zÌyT¢/²p^u]š*“áAÄ#Ÿ‚àܬŒIBZ±¤´)æ+£kì¨Þˆ);“]%Óÿ‰‚l³¢–2‚ªå«.[žt$‰JÄxKCŠ«“l|¢dW`h-+Ä0ã»"H•Î(+­›‹Î>±ž¨vÌÛà‚ôŽ`ïqá šÜøI…jÇF\DmŽ\p(µ&á]—…`‡ü—ˆé{1Œ‚eüÞ4ú‰Cì¨òR§O_¼Q= lrF1ìü‘Ï! t2T+±\Ž©`×aFW²Jp’mÉjѪgšmIÁÈÔP}YŒ©t €Å¬ôëÐæ\¸š Á!M€áL!H8k-F´»¨µD'‘À#‡Œ`уÍEœh_è€-Ú6â›ÊÙ+¬hx9d3X9ã'{v£ÿg†vîùç ‡.:ž;9ú騣ŽùêæÄ‡¥Eʱ‹¬×Ž\w2ßÐib­µä¶ŸK6$ϰiÌ8CM&LÞ;›×pÎç|ƒ× O¿÷´âx€Ú‡/>û kE»«U?þúì·ïþûðÇ?ÂË"×?˜úòç_ýA˜ê¿?0UfG þ‰ /EÑ„ùµÀ2ðŒ '(Á Rð‚¤T…ðµ;•idE`ËrÐ`²lljø_YŒ2'AXÄ_8ÔŠò‡_HYZœ1!0ç@Q4’‡HüÆ%¡Ù΀Eð]!|€´°…åmüÒEbr¬hÔ€Ó‰Þ„ÿê°@D 8H È(#5b»‰éÓ.ÃlC`0Wšh?ÂÐ÷Ëá#l2ú…%UË“¾H†k¨ê>ÌÂ::²z´QQVDÉJZò’V´g«Ë`¤ÌPÃyˆ%´&ÜÅãÈ@ÇGºR ‘,gàbp aðx„0ªæ‚„̓ »¤ƒ­V#D^l–#:XMþÔ-V\C ÙsAùxDƒYýr|ȬP6ˬ±ÔÍ6`bÄX$iœLÓ6'¤Lÿ@Oh®b=.BH$ùŠ,qJ³Äù…â5ñ›ð”wô÷æ¯U¸Bú|¦Ó 5 ‹Ãmе‘µU”ÿѤ‹µ± nœ¡Æœ‹à|PÖ!4®[X.°Ð\>AöËB=û÷*Ðʨ­¬L.¾2Y:œNmwÓò¼ƒ£ßÆPU0«ÁÌ)RxCˆ%Ó_ AYK#c±™ÖàrÚ+ª;- À æxò’WÀP‡ÄÝpcRKâÀ×¶ƒ)5uŸXË£D<Ȇyú)R:âÕ26M7LÏ„Tl5d(rP^Ù§ˆ4êLJ ¢Íc€ˆÍa‰x*7¤ãÒ’ö´¦M-jWkZqˆCµ°e­lcÛ¢Ö˜µÒJ$9lò@‡™dµDpJ÷bt z‹´§ ÿ@*T*癦O§ŒZL,a˜ªá¤oV°M6„Á‘®AƒÚ²@rMŽE2 “#]VÊ é‹—W:Ì:첉¼-A4ÞÝ%TRŠïbMÑP^kŒ·)üèUë%ÂââûÞ ¢œÆ˜&árØoÈÛ[I9à:ʸÅSCH1ŠW¬â³øÅÍ»QV}@Ø ÿƒƒ¹ÓR§Òi‚Ý]. 7kÖkc̰|dÈ‘¼æ"dý¹Èîde?ÀÒÑþç¶Ly2”Iô[ÆôëAM~–·LfpJeN³ð¬(!5»Y"‡¼Àî–Š×0¿ùÎ8gd] Ð)çÂ"t#žm¼¡Ð–Õ €ëhÿgýCg4zÐ …tS -y‚cÌ$xís-ð™ÂTÀ\*&T}RƒÀÔúë-§XŠPÖ¥„ANÁ‘OÓˆL¨&ôëx<†lŒÂÐt°-¬0ZøÈX¶²Ëáãûa ËŽ6˜T¢4i[ûÚØÎ¶¶·Íín›Â w ·¸ÇMîr›ûÜèN·ºËímo·R°ðnw·ß]ôÔ;ö “âZÖQÞÜÞ,æÄ{s‘ïg¤¸EG07JmÞf½XðâÌ8Æ7®ñŽ7×ïYeþèͱ;È'PrÅ–±y°¯3¬ƒ½¡ÅgñMi=‰g:3ž7v¹ô%°ÃÿGrÖ:­€jžçR@ÎW¥ÂWfø2¾ÆPpLÂΙԓIú>Ÿ PléCîöƒ°ÐÄ Ež—•ð†>Ý¿á÷šÙû+q¸aT‘°õA– ä.ØëS¦•‚.¯®ècY¾½"Å=;îoä>bcpo,Gö©«Öc¹(Ûƒ'H g¾à0MÐlÄXçS¥ž¹lè B<¼‹M• ¦ïÒäã$ ñÇí­i*P½9•cç<ó…Ö¢øì]‰ûÎGb÷N»„ïc|J‡]ZaC=šXí2É~ùõkþ ±ä>^B¢nèm7øYHåò™Â€†aöòÈ]bú>øC&~ÿm^¾ÐrHeY€?,AmCð`)†×d{f E”lY¶Ø’@‘±x…Ñ)øe «C•ð  Äe4}¡*E# )žRë¡28ƒ4Xƒaìô"€_!+¨ _LàîÒPcÔ –À Â!»ðD~³Q2îð„]GaÀ‚k"| Â~ìÕ}ñx…¥€NôÔSòAD—?XÈ i8kÈh:h ÿMU3TÀ#pà`o,@x2wØé%ß“k¸u"À´\¨‡Vá†W˜‡‘¡…L!t”øi@†Öw9fâðLCsˆ=ÿ;màuÍ›_â@VÄõ6àZÂ! Cpà ¹"j™ö;Œø Â…IÂ8ŒÄXŒÆxŒIc‰y-_† ”k”-FHŒà£P!öa³d‘JcCâd&ý¤?‰¨àR|—Vá¥4áC èˆ[Øð‹§vGœ{\ÆÇÅ>åøšáRrX×ä/¶G _‘3$€?ý!ÐR‹(-Ig,"× j qh? ‰#0ÔL¦ðL[°}öøHx´‰ŠŒ³‘UDžxjmLKHÓsvFE™ØA* )Vøi© |29‘(“ÅÊøWÒÐ- rŽR¨k5 QCÿ ‰e,uP2äx”«GNè…-ÙceWH(/¤”â0p=á®(üPZ@i56i-8yY(‰€3V Yr@`ÕÍCB£òþP”ë3—ÛR•æ°p³P Ý£µG,¢DJÁfJqÓ m9=­ˆWq *ˆid‚a’Θ AI ÏV1=Y&¡ÉM Ô™ô‘ §™Ô$T6UÒÜð™6À˜‚å‘þa˜Úë٠Â)aY?\A!Ç)$R—™“‘"bbn‰Èá"7ò=ÈXž”´€æ™ž•¤AÛCšþñ/aQ6’É-˜v ¼‰W,˜ÿ[ç’A‰ïäžOqœÝ”$°)€ ûeUÑŸ¾UDŒècÿq=RÁ€•  MQX´â BŠV¸7Uœ/pœwÑ^O7vÃ{g´<,ê~¾R7÷Ç¢çOdJ—P þõŸžàÀ„ª»ðŸ‡ÊJ»€£æ%5OC`³(^¦*V~?ÃK*!P—àè£ËF\‘Ÿ+@€*&\Ó¤Ûµ Kæ]R:HOÓ5Ž™"à%ÅÀž,йlW¢©§¼99ŶlÖ§®p=»1J:¶@„Ð< §¦± ª±qؽ>äÂ[Ê#õ"cW¦öÿOG*‹)º‰_-{GáÝÈSÍ0‘`dbº4‹G5X¤à…ç`rƒ^Ë@ FÉÀ(Ì`¡Àò1Ù£åZÒ:­ÔZ­ÖÚo÷90Þà¾Z€à0õÈ› Y¼€;›Ñ1CÝ“”×çzʉ:€¨МÁ™§Ú×­>I«ÁJ˜&2\…™«5á¥øš£J¢1[ôÚ;°QÐòJeÞð®Ó°2Ѱ4ލ\ÏŽ‘±°À•±­`Ÿ!Ie•. ûU+²Zr§ ÷Êd+‹)ë² àcyP³‹)S>û³@´B;´?‹bD{´H‹´ÙгL‹]¥Óÿ´P‹#‚µT / TµeÆ+ÌÙ7ÒzXû„÷O‹b¤<ûµ`Ò©q¸q‹¡±´ r¶h«À•`Ê‹O±„7Kr;·tAx2`ªæ„cë·e¢YªˆuÛ” ¥˜Äa¸_B¦Жz:%¹Ë:¨T¨dMÀ£|»ãgw°8?ɹˤ¸Ã³m"º·Å/0GX »#çØ!{I | ÖÉhPtÖ·ïu›2ë `sZ3@€÷À­·æhBj eÝD±'ðb=%rÐ^"!Q-@.ÑÛJª½C%œö¸™›' {;^à…¸¾wöŸüú‘K=¿'3Ki«¿8ûL4É›f^«¾ÌþÚ€›Àúë®$¾lmC5ÁÜcy·¸;½ÜÁüÁ6;Apache-ASP-2.63/site/articles/perlmonth1_intro.html0000644000175000017500000002517711721310312020323 0ustar jobjob Introduction to Apache::ASP

    Introduction to Apache::ASP

    By: Joshua Chamas

    published in PerlMonth.com in 1999

    I was first drawn to Active Server Pages (ASP) as a web development platform a couple years ago when researching how to best develop the NODEWORKS web site. I needed something maintainable, powerful, fast, portable, and of course perl.

    Microsoft had developed the ASP standard as the end all to web application development, which promised to be maintainable, powerful, and fast. But support for perl under PerlScript was shoddy, VBScript, ASP's native tongue, seemed a pathetic alternative, and an NT/IIS solution lacks a certain portability. Thus I was led to developing Apache::ASP, which runs under Doug MacEachern's mod_perl for Apache.

    Maintainable

    I had been doing CGI style web applications for a couple of years already, and had never been quite satisfied with the CGI programming, growing less so as the HTML I was working with became increasingly more complex than the CGI it was embedded in. The idea of embedding the scripting within the flow of the HTML seemed like a more natural fit over time. This natural flow speaks to the heart of maintainability, where another developer can pick up your code and get a feel for it on the first read.

    Check out the difference in how it feels to embed the HTML in the scripting, versus embedding the scripting in the HTML. A reasonably complex table, which is structurally HTML heavy, only touches the tip of the iceberg:

    SOME
    DATA
    TO
    LOOP
    OVER
    :)

    Coding this table in CGI, you might get:


    use CGI qw/:standard *table/; my(@data) = ('Some', 'Data', 'To', 'Loop', 'Over', ':)'); print header, start_html('Example'), start_table({-border=>2, -bgcolor=>'blue'}), Tr,td, start_table({-border=>4, -bgcolor=>'white'}) ; # pretend we are reading from database cursor, so code # would be written like so my($data, $count); while(@data) { if($data and $count++ % 2) { print end_table,td,start_table({-border=>4, -bgcolor=>'white'}); } $data = shift @data; print Tr({align=>CENTER}, [td([uc($data)."\n"])] ) ; } print end_table, end_table, end_html ;
    When designing the above table ASP style, a much more natural flow to the script takes form, wherein the developer can literally see the table in table layout of the page:

    <% my(@data) = ('Some', 'Data', 'To', 'Loop', 'Over', ':)'); %> <html> <head><title>Example</title></head> <body> <table border=2 bgcolor=blue> <tr><td> <table border=4 bgcolor=white> <% my($data, $count); while(@data) { if($data and $count++ % 2) { %> </table><td><table border=4 bgcolor=white> <% } $data = shift @data; %> <tr><td><%=uc $data%></td></tr> <% } %> </table> </td></tr> </table> </body> </html>

    Doesn't the HTML-centric ASP read better? You'll see that this becomes more true as the html of your site becomes increasingly complex.

    There are other aspects to maintainability, like who will be taking over your code in 2 years. With perl CGI, you can assume that any perl developer that you work with is going to be able to get through the mess you've made. But so too with ASP, because of the marketing muscle that Microsoft put behind its brainchild, you can expect to get plenty of ASP experience in the workforce, with a huge peer learning environment.

    So far, this may sound religious to some, as project design and maintainability take on some very fuzzy and personal characteristics, with many varying perspectives, but it should be at the forefront of one's mind when beginning any software project. This leads me to the graphics designer you may end up working with, who doesn't know that the dynamic web site you are building really falls under software development ;) ...

    Because ASP is scripting embedded in HTML, you can give the graphics designer a few easy function calls to embed, and s/he can take the rest from there, using her/his favorite GUI tools to craft the web site beautifully. Notice that you significantly increased the number of people that can work on your site by using an embedded scripting web application environment like ASP, versus going with a pure scripted CGI solution.

    Another feature furthering maintainability is ASP's built-in support for Server Side Includes (SSI), which allows the developer to segment common parts of the site into modular include files. Thus is becomes easy to decompose a basic site template like:

    <html>
    <head><title>Company Name></title></head>
    <body>
    <!-- main body of page here -->
    Copyright / Disclaimer
    </body></html>
    
    
    and separate a common header and footer that can be reused across every script:
    [header.inc]
    <html>
    <head><title>Company Name></title></head>
    <body>
    
    [footer.inc]
    Copyright / Disclaimer
    </body></html>
    
    [sample.asp]
    <!--#include file=header.inc-->
    <!-- main body of page here -->
    <!--#include file=footer.inc-->
    
    

    Powerful

    When developing a web site under ASP, one has access to a complete set of objects and events, my favorite being $Session, which was one of ASP's key selling points for me. $Session is ASP's answer to the problem of HTTP being a stateless protocol. By using temporary session cookies, each web user has a unique $Session in which you may store data, and that follows them from script to script. Because the data storage for $Session is handled on the server, you do not have to worry about size limits of cookies as an alternate mechanism of storing user session data.

    There are some very useful events as well. Let's say that you are using $Session->{login} to control a user account login and logout. Because $Session automatically times out every SessionTimeout, if a user walks away from her/his computer for SessionTimeout minutes, the $Session->{login} is destroyed along with the rest of the data stored in $Session, and the next person that uses the computer will find themselves automatically logged out from the account. This is a huge security win if you maintain a set of accounts at your web site that hold sensitive information like credit card numbers.

    Here is a basic listing of the built-in objects available to the developer within every Apache::ASP script:

    	Object		-	Function
    	------			--------
    	$Session	-	session state
    	$Response	-	output
    	$Request	-	input
    	$Application	-	application state
    	$Server		-	OLE support + misc.
    
    You might be looking at the $Application object as saying "huh, what's that?". Simply, $Application allows you to share data between various ASP scripts and users. Metaphorically it represents your web site as an application, and $Application is initialized when the first user $Session is created, and destroyed when the last user $Session is destroyed.

    Events are triggered when these objects are created and destroyed. In addition to data initialization and destruction, these events allow the developer to define, in the global.asa, subroutines to be executed at these event times, providing hooks enabling the web site to function easily as a dynamic software application. The events are as follows:

    	Action			Event
    	------			------
            Script_OnStart *	Beginning of Script execution
            Script_OnEnd *		End of Script execution
    	Application_OnStart	Beginning of Application
    	Application_OnEnd	End of Application
    	Session_OnStart		Beginning of user Session.
    	Session_OnEnd		End of user Session.
    
      * These are API extensions that are not portable, but were
        added because they are incredibly useful
    

    Fast

    Execution speed is always important when picking your web application environment ... shoot for the stars and design with the fastest from the beginning, saving yourself a massive redesign later when your site becomes a success. One of the motivations for not using PerlScript under IIS, a couple years ago, was that it was painfully slow, but has since been much improved. The mod_perl project boasts a 20 times speedup in CGIs handled by Apache::Registry, and it handles perl ASP scripts just as well under Apache::ASP, with some performance lost because of all the objects initialization and events execution that ASP handles.

    The startup overhead on simple scripts is significantly more when moving from CGI to ASP under mod_perl for Apache, at least 20%, as shown in my previous Hello World - Web Application Benchmarks article, but this startup overhead will become relatively less important as your scripts get longer, and a base rate of 75 Apache::ASP requests per second on a PII 300 Solaris x86 is nothing to scoff at!

    In order to justify using ASP over CGI despite the performance hit, just remember how much more maintainable and powerful ASP is. The general consensus is that developer time is much more valuable than computer time so save the former where possible!

    Next Month

    In this article I tried to convey a sense of how and why you might use Apache::ASP to build your web site. Next month we will build a simple web site using some of the powerful and modular features ASP has to offer. Apache-ASP-2.63/site/articles/perlmonth2_build.html0000644000175000017500000003633711721310312020270 0ustar jobjob Apache::ASP Site Building

    Apache::ASP Site Building

    By: Joshua Chamas

    published originally in PerlMonth.com in 1999

    Last month, I gave a rough introduction of Apache::ASP, and why you might want to use it to build your web site. Now I get to show you Apache::ASP in action.

    Requirements

    First, we must decide what our site will do, or state its requirements. As a trivial site, we are going do build something my.*.com style, which holds a user's favorite links, a MyBookmarks site if you will.

    This site will require a user to login with a chosen user name for security, and view, add, and delete their internet bookmarks. The deletion will leave the deleted bookmark data in the form to allow easy modification and recreation of that bookmark.

    The user will also be able to logout, and the system will auto-logout their account automatically after 15 minutes, so that if it is a public terminal, another user using the same browser later will not be able modify the first user's bookmarks.

    Specification

    Often times, there is a specification round that we must do to pick our web application environment and hardware, as well as supported client software, but this is a no brainer here. We are choosing Apache::ASP because of its built in $Session which make user logins easy, and its built in event Session_OnEnd which will automatically destroy the contents of $Session every SessionTimeout, which defaults to 20 minutes.

    Also, because our web application has more than one page, we will make use of the same headers and footers for each page, using the includes <!--#include file=src.inc--> functionality to modularize the html.

    Design

    Before we start coding, let's take a minute to diagram what pages and actions our MyBookmarks web application needs to have. We have 2 pages, the intro, and the actual bookmarks page, where we get to view, add, and delete the bookmark entries. We have the user login to the bookmarks, and logout, securing access for the user's eyes only.

    You might also design the objects, methods, and functions that will be used for the site, but this site is so simple, that we are going to jump into implementation.

    Implementation

    We start by configuring .htaccess file of a directory in apache to allow Apache::ASP to run .asp files, and testing the configuration with a dummy.asp file.

    # .htaccess
    DirectoryIndex index.asp
    <Files ~ \.asp$>
    	SetHandler perl-script
    	PerlHandler Apache::ASP
    	PerlSetVar Global .
    	PerlSetVar GlobalPackage My::Bookmarks
    	PerlSetVar StateDir /tmp/asp_apps_bookmarks
    	PerlSetVar Debug 2
    	PerlSetVar SessionTimeout 15
    	PerlSetVar StatScripts 1
    	PerlSetVar AllowApplicationState 1
    	PerlSetVar AllowSessionState 1
    </Files>

    # dummy.asp
    INTRO <%=$Session%>

    If the index.asp works on your server, and just prints INTRO Apache::ASP::Session=HASH(0x??????), then we know Apache::ASP is working and $Sessions are enabled.


    Next, we set up the global.asa with globals and libraries that need to be initialized for the web application, and define the relevant event handlers. We also set up per request globals, like the document's title, which is something that we can do in Script_OnStart. Finally, we use the Script_OnStart and Script_OnEnd events to automatically include the header and footer for each script in our web application, and initialize relevant globals used by the scripts.

    Notice that each script can process its own Logout request, which was a decision made after the design because it seemed good to make the first script, index.asp, $Session aware.

    # global.asa
    use File::Basename;
    use DBI;
    use DBD::CSV;
    
    use vars qw( $DarkColor $Name %Titles $FontBase $Db $Title $Basename $Form $Query );
    
    $DarkColor = '#0000aa';
    $Name = "MyBookmarks";
    %Titles = (
    	   'index.asp' => 'Introduction',
    	   'bookmarks.asp' => 'Viewer'
    	  );
    $FontBase = 'face=verdana,arial';
    
    $Db = DBI->connect("DBI:CSV:f_dir=".Apache->dir_config('StateDir'), '', '', 
    		   { RaiseError => 1 })
      or die "Cannot connect: " . $DBI::errstr;
    
    # setup bookmark database if first time
    unless(eval { $Db->do("select bookmark_id,username,title,url from bookmarks") }) {
        eval { $Db->do("drop table bookmarks"); };
        $Db->do(<<CREATE) || die("can't create table $DBI::errstr");
        create table bookmarks (
    			    bookmark_id varchar(15),
    			    username varchar(30),
    			    title varchar(60),
    			    url varchar(120)
    			   )
    CREATE
      ;
    }
    
    $Db->do("select * from bookmarks")
      || die("can't do select against bookmarks: $DBI::errstr");
    
    sub Script_OnStart {
        $Basename = basename($0);
        $Title = $Name.' / '.$Titles{$Basename};
        $Response->Include('header.inc');
        $Form = $Request->Form();
        $Query = $Request->QueryString();
        $Response->Expires(0);
    
        # a user may logout from any script, destroy session, and go
        # to login / intro page
        if($Form->{logout}) {
    	$Session->Abandon();
    	$Response->Redirect("index.asp?abandon=".
    			    ++$Application->{abandon});
        }
    }
    
    sub Script_OnEnd {
        $Response->Include('footer.inc');
    }
    
    sub Application_OnStart {
        # use max_bookmark_id as a pseudo sequence
        $Application->Lock();
        my $sth = $Db->prepare_cached
          ("select bookmark_id from bookmarks order by bookmark_id desc");
        $sth->execute();
        $Application->{max_bookmark_id} = $sth->fetchrow_array();
        $Application->UnLock();
    }


    Next we set up the headers and footers for each page. One problem with HTML is that it requires you to specify the unique titles of the document before the standard body style for your site, so we cheated this and created the per page titles already in the Script_OnStart of the global.asa.

    # header.inc
    <html>
    <head><title><%=$Title%></title></head>
    <body bgcolor=white link=purple alink=yellow vlink=gray>
    
    <form src=<%=$Basename%> method=POST>
    <table border=0 width=100% cellpadding=5 cellspacing=0>
    <tr bgcolor=<%= $DarkColor %>>
    	<td>
    	<b><font <%=$FontBase%> size=+1 color=yellow>
    		<%=$Title%>
    		<% if($Session->{user}) { %>
    		  for <%= $Session->{user} %>
    		<% } %>
    	</font></b>
    	</td>
    	<td align=right>
    	<font <%=$FontBase%>>
    	<% if($Session->{'user'}) { %>
    		<input type=submit name=logout value=Logout>
    	<% } else { %>
    		&nbsp;
    	<% } %>
    	</font>
    	</td>
    </tr>
    </form>
    </table>
    
    <table border=0 cellpadding=5 width=100% ><tr><td valign=top>
    <font <%=$FontBase%> size=+0>

    # footer.inc
    </font>
    </table>
    
    <table border=0 width=100% cellpadding=5>
    <tr>
    	<td bgcolor=yellow align=center>
    	<font <%=$FontBase%> size=-1 color=<%= $DarkColor %>>
    	<b>
    		My-NotExists-Bookmarks 
    		Cool Technologies Etc., ???, &copy; <%= (localtime())[5] + 1900 %>
    	</b>
    	</font>
    	</td>
    </tr>
    </table>
    </body>
    </html>


    Doing the intro page should now be fairly easy. We will handle the login at the intro page, and redirect to the viewer upon success. We keep the login processing perl code at the top so we don't print out any HTML before the redirect is handled.

    # index.asp
    <%
    # process user login
    my $error;
    my $user = $Form->{'user'};
    if(defined $user) {
    	$user =~ /^\w+$/ or $error = 
    		"Your username must made of only letter and numbers";
    	length($user) > 3 or $error = 
    		"Your username much be at least 4 character long";
    	
    	unless($error) {
    		$Session->{user} = $user;
    		$Response->Redirect('bookmarks.asp');
    	}
    }
    $user ||= $Session->{user};
    %>
    Hello, and welcome to the MyBookmarks Apache::ASP demo application.
    To begin your bookmark experience, please login now:
    
    <center>
    <% if($error) { %>
    	<p><b><font color=red size=-1>* <%=$error%></font></b>
    <% } %>
    <form src=<%=$Basename%> method=POST>
    <input type=text name=user value="<%=$Server->HTMLEncode($user)%>">
    <input type=submit value=Login>
    </form>
    </center>
    
    This demo makes use of the Apache::ASP objects, especially
    <tt>$Session</tt> and <tt>$Response</tt>, modularizes html 
    via SSI file includes, and uses the <tt>Script_OnStart</tt>
    and  <tt>Script_OnEnd</tt> event hooks to 
    simplify common tasks done for each script in this web
    application.


    The final script for the site is the bookmarks.asp script, which is the most complex of the bunch. This script is in charge of viewing, adding, and deleting the user bookmarks. In order to do the bookmark modifications, the script processes its own form input.

    # bookmarks.asp
    <%
    # only a logged in user may view the bookmarks
    $Session->{'user'} || $Response->Redirect('index.asp');
    
    my $error;
    if($Form->{submit} =~ /create/i) {
    	unless($Form->{new_url}) {
    		$error = "The Url must be ".
    			"filled in to create a new bookmark";
    		goto ERROR;
    	}
    
    	my $sth = $Db->prepare_cached(
    		"select url from bookmarks where username=? and url=?"
    		);
    	$sth->execute($Session->{'user'}, $Form->{new_url});
    	if($sth->fetchrow_array) {
    		$error = "You already have $Form->{new_url} ".
    			"for a bookmark";
    		goto ERROR;
    	} else {
    		$sth = $Db->prepare_cached(<<SQL);
    insert into bookmarks (bookmark_id, username, url, title)
    values (?,?,?,?)
    SQL
    	;
    		$Application->Lock();
    		$sth->execute(
    			++$Application->{max_bookmark_id}, 
    			$Session->{'user'}, 
    			$Form->{new_url}, 
    			$Form->{new_title}
    			);
    		$Application->UnLock();
    	}
    }
    
    if($Query->{delete}) {
    	my $sth = $Db->prepare_cached(<<SQL);
    
    select * from bookmarks 
    where bookmark_id = ?
    and username = ?
    
    SQL
    	;
    	$sth->execute($Query->{delete}, $Session->{user});
    	if(my $data = $sth->fetchrow_hashref) {
    		my $sth = $Db->prepare_cached(<<SQL);
    
    delete from bookmarks 
    where bookmark_id = ? 
    and username = ?
    
    SQL
    	;
    		$sth->execute($Query->{delete}, $Session->{user});
    		$Form->{new_url} = $data->{'url'};
    		$Form->{new_title} = $data->{'title'};
    	}
    }
    
    # get all the bookmarks
    ERROR:
    my $sth = $Db->prepare_cached(
    			"select * from bookmarks where username=? ".
    			"order by bookmark_id"
    			);
    $sth->execute($Session->{'user'});
    my @bookmarks;
    while(my $bookmark = $sth->fetchrow_hashref()) {
    	push(@bookmarks, $bookmark);
    }
    %>
    
    <% if(@bookmarks) { %>
    	Welcome to your bookmarks!
    <% } else { %>
    	You don't have any bookmarks.  Please feel free to 
    	add some using the below form.
    <% } %>
    
    <center>
    <% if($error) { %>
    	<p><b><font color=red size=-1>* <%=$error%></font></b>
    <% } %>
    <form src=<%=$Basename%> method=POST>
    <table border=0>
    	<% for ('new_url', 'new_title') { 
    		my $name = $_;
    		my $title = join(' ', 
    			map { ucfirst $_ } split(/_/, $name));
    		%>
    		<tr>
    		<td><b><%=$title%>:</b></td>
    		<td><input type=text name=<%=$name%> 
    			value="<%=$Form->{$name}%>" 
    			size=40 maxlength=120>
    		</td>
    		</tr>
    	<% } %>
    	<tr>
    	<td>&nbsp;</td>
    	<td>
    		<font <%=$FontBase%>>
    		<input type=submit name=submit 
    			value="Create Bookmark"></td></tr>
    		</font>
    	</td>
    </form>
    </table>
    
    <% if(@bookmarks) { 
    	my $half_index = int((@bookmarks+1)/2);
    	%>
    	<p>
    	<table border=0 width=80% bgcolor=<%= $DarkColor %> cellspacing=0>
    	<tr><td align=center>
    
    	<table border=0 width=100% cellspacing=1 cellpadding=3>
    	<tr bgcolor=<%= $DarkColor %>><td align=center colspan=4>
    		<font color=yellow><b>Bookmarks</b></font>
    	</td></tr>
    	<% for(my $i=0; $i<$half_index; $i++) { %>
    		<tr>
    		<% for($i, $i+$half_index) { 
    			my $data = ($_ < @bookmarks) ? 
    				$bookmarks[$_] : undef;
    			$data->{title} ||= $data->{'url'};
    			my $text = $data->{bookmark_id} ? 
    				"<a href=$data->{'url'}
    					>$data->{'title'}</a>" 
    					: "&nbsp;";
    			%> 
    			<td bgcolor=#c0c0c0 width=30 align=center>
    			<% if($data->{bookmark_id}) { %>
    				<font size=-1><tt>
    				<a href=<%=
    				"$Basename?delete=$data->{bookmark_id}"
    				%>>[DEL]</a>
    				</tt></font>
    			<% } else { %>
    			  &nbsp;
    			<% } %>
    			</td>
    			<td bgcolor=white><%= $text || '&nbsp;'%></td> 
    		<% } %>
    		</tr>
    	<% } %>
    	</table>	
    	
    	</td></tr></table>
    	<br>
    <% } %>
    
    </center>


    That's it :) If you would like you may view the MyBookmarks web application online. Next month, we will tune the MyBookmarks web application for maximum throughput, and minimum RAM usage.

    Apache-ASP-2.63/site/events.html0000644000175000017500000005362013252377727014537 0ustar jobjob Apache::ASP::Events
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
    % EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    EVENTS
    Overview Script_OnParse
    Script_OnStart & Script_OnEnd Application_OnStart
    Session_OnStart Application_OnEnd
    Session_OnEnd Server_OnStart ( pseudo-event )
    Script_OnFlush mod_perl handlers

    Overview

    The ASP platform allows developers to create Web Applications.
    In fulfillment of real software requirements, ASP allows 
    event-triggered actions to be taken, which are defined in
    a global.asa file.  The global.asa file resides in the 
    Global directory, defined as a config option, and may
    define the following actions:
    
    	Action			Event
    	------			------
            Script_OnStart *	Beginning of Script execution
            Script_OnEnd *		End of Script execution
            Script_OnFlush *	Before $Response being flushed to client.
            Script_OnParse *        Before script compilation
    	Application_OnStart	Beginning of Application
    	Application_OnEnd	End of Application
    	Session_OnStart		Beginning of user Session.
    	Session_OnEnd		End of user Session.
    
      * These are API extensions that are not portable, but were
        added because they are incredibly useful
    
    These actions must be defined in the $Global/global.asa file as subroutines, for example:
      sub Session_OnStart {
          $Application->{$Session->SessionID()} = started;
      }
    
    Sessions are easy to understand. When visiting a page in a web application, each user has one unique $Session. This session expires, after which the user will have a new $Session upon revisiting.
    A web application starts when the user visits a page in that application, and has a new $Session created. Right before the first $Session is created, the $Application is created. When the last user $Session expires, that $Application expires also. For some web applications that are always busy, the Application_OnEnd event may never occur.

    Script_OnStart & Script_OnEnd

    The script events are used to run any code for all scripts
    in an application defined by a global.asa.  Often, you would
    like to run the same code for every script, which you would
    otherwise have to add by hand, or add with a file include,
    but with these events, just add your code to the global.asa,
    and it will be run.  
    
    There is one caveat. Code in Script_OnEnd is not guaranteed to be run when $Response->End() is called, since the program execution ends immediately at this event. To always run critical code, use the API extension:
    	$Server->RegisterCleanup()
    

    Session_OnStart

    Triggered by the beginning of a user's session, Session_OnStart
    gets run before the user's executing script, and if the same
    session recently timed out, after the session's triggered Session_OnEnd.
    
    The Session_OnStart is particularly useful for caching database data, and avoids having the caching handled by clumsy code inserted into each script being executed.

    Session_OnEnd

    Triggered by a user session ending, Session_OnEnd can be useful
    for cleaning up and analyzing user data accumulated during a session.
    
    Sessions end when the session timeout expires, and the StateManager performs session cleanup. The timing of the Session_OnEnd does not occur immediately after the session times out, but when the first script runs after the session expires, and the StateManager allows for that session to be cleaned up.
    So on a busy site with default SessionTimeout (20 minutes) and StateManager (10 times) settings, the Session_OnEnd for a particular session should be run near 22 minutes past the last activity that Session saw. A site infrequently visited will only have the Session_OnEnd run when a subsequent visit occurs, and theoretically the last session of an application ever run will never have its Session_OnEnd run.
    Thus I would not put anything mission-critical in the Session_OnEnd, just stuff that would be nice to run whenever it gets run.

    Script_OnFlush

    API extension. This event will be called prior to flushing
    the $Response buffer to the web client.  At this time,
    the $Response->{BinaryRef} buffer reference may be used to modify 
    the buffered output at runtime to apply global changes to scripts 
    output without having to modify all the scripts.
    
     sub Script_OnFlush {
       my $ref = $Response->{BinaryRef};
       $$ref =~ s/\s+/ /sg; # to strip extra white space
     }
    
    Check out the ./site/eg/global.asa for an example of its use.

    Script_OnParse

    This event allows one to set up a source filter on the script text,
    allowing one to change the script on the fly before the compilation
    stage occurs.  The script text is available in the $Server->{ScriptRef}
    scalar reference, and can be accessed like so:
    
     sub Script_OnParse {
       my $code = $Server->{ScriptRef}
       $$code .= " ADDED SOMETHING ";
     }
    

    Application_OnStart

    This event marks the beginning of an ASP application, and 
    is run just before the Session_OnStart of the first Session
    of an application.  This event is useful to load up
    $Application with data that will be used in all user sessions.
    	
    	

    Application_OnEnd

    The end of the application is marked by this event, which
    is run after the last user session has timed out for a 
    given ASP application.
    	
    	

    Server_OnStart ( pseudo-event )

    Some might want something like a Server_OnStart event, where
    some code gets runs when the web server starts.  In mod_perl,
    this is easy to achieve outside of the scope of an ASP
    application, by putting some initialization code into
    a <Perl> section in the httpd.conf file.  Initializations
    that you would like to be shared with the child httpds are
    particularly useful, one such being the Apache::ASP->Loader() 
    routine which you can read more about in the TUNING section -
    Precompile Scripts subsection. It is could be called like:
    
      # httpd.conf
      <Perl>
         Apache::ASP->Loader($path, $pattern, %config)
      </Perl>
    
    So a <Perl> section is your Server_OnStart routine!

    mod_perl handlers

    If one wants to extend one's environment with mod_perl
    handlers, Apache::ASP does not stop this.  Basic
    use of Apache::ASP in fact only involves the content
    handler phase of mod_perl's PerlHandler, like
    
      SetHandler perl-script
      PerlModule Apache::ASP
      PerlHandler Apache::ASP 
    
    But mod_perl allows for direct access to many more Apache event stages, for full list try "perldoc mod_perl" or buy the mod_perl Eagle book. Some commonly used ones are:
      PerlInitHandler
      PerlTransHandler
      PerlFixupHandler
      PerlHandler
      PerlLogHandler
      PerlCleanupHandler
    
    For straight Apache::ASP programming, there are some equivalents, say Script_OnStart event instead of Init/Fixup stages, or $Server->RegisterCleanup() for Log/Cleanup stages, but you can do things in the mod_perl handlers that you cannot do in Apache::ASP, especially if you want to handle all files globally, and not just ASP scripts.
    For many Apache::* modules for use with mod_perl, of which Apache::ASP is just one, check out http://perl.apache.org/src/apache-modlist.html
    To gain access to the ASP objects like $Session outside in a non-PerlHandler mod_perl handler, you may use this API:
      
      my $ASP = Apache::ASP->new($r); # $r is Apache->request object
    
    as in this possible Authen handler:
      <Perl>
        use Apache::ASP;
        sub My::Auth::handler {
          my $r = shift;
          my $ASP = Apache::ASP->new($r) 
          my $Session = $ASP->Session;
        }
      </Perl>
    
    Here are some examples of do-it-yourself mod_perl handler programming...
     === Forbid Bad HSlide User Agent ===
    
     # httpd.conf
     PerlAccessHandler My::Access
     <Perl>
       sub My::Access::handler {
         my $r = shift;
         if($r->headers_in->{'USER_AGENT'} =~ /HSlide/) {
    	 403;
         } else {
    	 200;
         }
       }
     </Perl>
    
     === Runtime Path Parsing ===
    
    This example shows how one might take an arbitrary URL path /$path/$file.asp, and turn that into a runtime config for your site, so your scripts get executed always in your sites DocumentRoot.
     INPUT URL /SomeCategory/
     OUTPUT
      Script: index.asp
      $Server->Config('PATH') eq '/SomeCategory'
    
     INPUT URL /SomeCategory/index.asp
     OUTPUT
      Script: index.asp
      $Server->Config('PATH') eq '/SomeCategory'
    
     INPUT URI /index.asp
     OUTPUT
      Script: index.asp
      $Server->Config('PATH') eq ''
    
     # httpd.conf
     PerlTransHandler My::Init
     use lib qw( $custom_perllib );
    
     # $custom_perllib/My/Init.pm
     package My::Init;
     use strict;
     use Apache::Constants qw(:common);
     sub handler {
        my $r = shift;
    
        my $uri = $r->uri || '/';
        unless($uri =~ m|^(.*)(/([^/.]+\.[\w]+)?)$|i) {
    	warn("can't parse uri $uri");
    	return DECLINED;
        }
        $uri = $2;
        my $PATH = $1 || '';
        $r->dir_config('PATH', $PATH);
    
        if($uri eq '/') {
    	$uri = '/index.asp';
        }
    
        $r->uri($uri);
        $r->filename($r->document_root.$uri);
    
        DECLINED;
     }
    
     1;
    
     
    Apache-ASP-2.63/site/todo.html0000644000175000017500000002273013252377730014170 0ustar jobjob Apache::ASP::Todo
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
    % TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    TODO
    There is no specific time frame in which these things will be implemented. Please let me know if any of these is of particular interest to you, and I will give it higher priority.

    WILL BE DONE

     + Database storage of $Session & $Application, so web clusters 
       may scale better than the current NFS/CIFS StateDir implementation
       allows, maybe via Apache::Session.
    
     
    Apache-ASP-2.63/site/changes.html0000644000175000017500000037203513252377727014647 0ustar jobjob Apache::ASP::Changes
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
    % CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    CHANGES
    Apache::ASP has been in development since 1998, and was production ready since its .02 release. Releases are always used in a production setting before being made publically available.
    In July 2000, the version numbers of releases went from .19 to 1.9 which is more relevant to software development outside the perl community. Where a .10 perl module usually means first production ready release, this would be the equivalent of a 1.0 release for other kinds of software.
     + = improvement   - = bug fix    (d) = documentations
    

    $VERSION = 2.63; $DATE="03/14/2018" $VERSION = 2.09; $DATE="01/30/2001";
    $VERSION = 2.62; $DATE="08/16/2011" $VERSION = 2.07; $DATE="11/26/2000";
    $VERSION = 2.61; $DATE="05/24/2008" $VERSION = 2.03; $DATE="08/01/2000";
    $VERSION = 2.59; $DATE="05/23/2005" $VERSION = 2.01; $DATE="07/22/2000";
    $VERSION = 2.57; $DATE="01/29/2004" $VERSION = 2.00; $DATE="07/15/2000";
    $VERSION = 2.55; $DATE="08/09/2003" $VERSION = 1.95; $DATE="07/10/2000";
    $VERSION = 2.53; $DATE="04/10/2003" $VERSION = 1.93; $DATE="07/03/2000";
    $VERSION = 2.51; $DATE="02/10/2003" $VERSION = 1.91; $DATE="07/02/2000";
    $VERSION = 2.49; $DATE="11/10/2002" $VERSION = 0.19; $DATE="NOT RELEASED";
    $VERSION = 2.47; $DATE="11/06/2002" $VERSION = 0.18; $DATE="02/03/2000";
    $VERSION = 2.45; $DATE="10/13/2002" $VERSION = 0.17; $DATE="11/15/99";
    $VERSION = 2.41; $DATE="09/29/2002" $VERSION = 0.16; $DATE="09/22/99";
    $VERSION = 2.39; $DATE="09/10/2002" $VERSION = 0.15; $DATE="08/24/1999";
    $VERSION = 2.37; $DATE="07/03/2002" $VERSION = 0.14; $DATE="07/29/1999";
    $VERSION = 2.35; $DATE="05/30/2002" $VERSION = 0.12; $DATE="07/01/1999";
    $VERSION = 2.33; $DATE="04/29/2002" $VERSION = 0.11; $DATE="06/24/1999";
    $VERSION = 2.31; $DATE="01/22/2002"; $VERSION = 0.10; $DATE="05/24/1999";
    $VERSION = 2.29; $DATE="11/19/2001"; $VERSION = 0.09; $DATE="04/22/1999";
    $VERSION = 2.27; $DATE="10/31/2001"; $VERSION = 0.08; $DATE="02/06/1999";
    $VERSION = 2.25; $DATE="10/11/2001"; $VERSION = 0.07; $DATE="01/20/1999";
    $VERSION = 2.23; $DATE="10/11/2001"; $VERSION = 0.06; $DATE="12/21/1998";
    $VERSION = 2.21; $DATE="8/5/2001"; $VERSION = 0.05; $DATE="10/19/1998";
    $VERSION = 2.19; $DATE="7/10/2001"; $VERSION = 0.04; $DATE="10/14/1998";
    $VERSION = 2.17; $DATE="6/17/2001"; $VERSION = 0.03; $DATE="09/14/1998";
    $VERSION = 2.15; $DATE="06/12/2001"; $VERSION = 0.02; $DATE="07/12/1998";
    $VERSION = 2.11; $DATE="05/29/2001"; $VERSION = 0.01; $DATE="06/26/1998";

    $VERSION = 2.63; $DATE="03/14/2018"

     + Added section ``raw'' to MailErrors.inc to debug POSTs without
       form fields
    
     - MailErrorsHTML now uses monospaced fonts for errors. Easier on
       the eyes and more informative
    

    $VERSION = 2.62; $DATE="08/16/2011"

     - Fixed 'application/x-www-form-urlencoded' for AJAX POSTs post
       Firefox 3.x
    
     + First sourceforge.net hosted version
    
     + Incremented version number to actually match SVN branch tag
    

    $VERSION = 2.61; $DATE="05/24/2008"

     - updated for more recent mod_perl 2 environment to trigger correct loading of modules
    
     + loads modules in a backwards compatible way for older versions of mod_perl 1.99_07 to 1.99_09
    
     + license changes from GPL to Perl Artistic License
    

    $VERSION = 2.59; $DATE="05/23/2005"

     + added "use bytes" to Response object to calculate Content-Length
       correctly for UTF8 data, which should require therefore at least
       perl version 5.6 installed
    
     + updated to work with latest mod_perl 2.0 module naming convention,
       thanks to Randy Kobes for patch
    
     + examples now exclude usage of Apache::Filter & Apache::SSI under mod_perl 2.0
    

    $VERSION = 2.57; $DATE="01/29/2004"

     - $Server->Transfer will update $0 correctly
    
     - return 0 for mod_perl handler to work with latest mod_perl 2 release
       when we were returning 200 ( HTTP_OK ) before
    
     - fixed bug in $Server->URL when called like $Server->URL($url)
       without parameters.  Its not clear which perl versions this bug 
       affected.
    

    $VERSION = 2.55; $DATE="08/09/2003"

     - Bug fixes for running on standalone CGI mode on Win32 submitted
       by Francesco Pasqualini
    
     + Added Apache::ASP::Request::BINMODE for binmode() being
       called on STDIN after STDIN is tied to $Request object
    
     + New RequestBinaryRead configuration created, may be turned off
       to prevent $Request object from reading POST data
    
     ++ mod_perl 2 optmizations, there was a large code impact on this,
       as much code was restructured to reduce the differences between
       mod_perl 1 and mod_perl 2, most importantly, Apache::compat is
       no longer used
    
     + preloaded CGI for file uploads in the mod_perl environment
    
     - When XSLT config is set, $Response->Redirect() should work now
       Thanks to Marcus Zoller for pointing problem out
    
     + Added CookieDomain setting, documented, and added test to cover 
       it in t/cookies.t . Setting suggested by Uwe Riehm, who nicely 
       submitted some code for this.
    

    $VERSION = 2.53; $DATE="04/10/2003"

     + XMLSubs tags with "-" in them will have "-" replaced with "_" or underscore, so a
       tag like <my:render-table /> will be translated to &my::render_table() ... tags with
       - in them are common in extended XML syntaxes, but perl subs cannot have - in them only.
    
     + Clean setting now works on output when $Response->{ContentType} begins with text/html;
       like "text/html; charset=iso-8859-2" ... before Clean would only work on output marked
       with ContentType text/html.  Thanks to Szymon Juraszczyk for recommending fix.
    
     --Fixed a bug which would cause Session_OnEnd to be called twice on sessions in a certain case,
       particularly when an old expired session gets reused by and web browser... this bug was
       a result of a incomplete session cleanup method in this case.  Thanks to Oleg Kobyakovskiy 
       for reporting this bug.  Added test in t/session_events.t to cover this problem going forward.
    
     - Compile errors from Apache::ASP->Loader() were not being reported.  They will
       be reported again now.  Thanks to Thanos Chatziathanassiou for discovering and
       documenting this bug.  Added test in t/load.t to cover this problem going forward.
    
     + use of chr(hex($1)) to decode URI encoded parameters instead of pack("c",hex($1))
       faster & more correct, thanks to Nikolay Melekhin for pointing out this need.
    
     (d) Added old perlmonth.com articles to ./site/articles in distribution
       and linked to them from the docs RESOURCES section
    
     (d) Updated documention for the $Application->SessionCount API
    
     + Scripts with named subroutines, which is warned against in the style guide,
       will not be cached to help prevent my closure problems that often
       hurt new developers working in mod_perl environments.  The downside
       is that these script will have a performance penalty having to be
       recompiled each invocation, but this will kill many closure caching 
       bugs that are hard to detect.
    
     - $Request->FileUpload('upload_file', 'BrowserFile') would return
       a glob before that would be the file name in scalar form.  However
       this would be interpreted as a reference incorrectly.  The fix
       is to make sure this is always a scalar by stringifying 
       this data internally.  Thanks to Richard Curtis for pointing
       out this bug.
    

    $VERSION = 2.51; $DATE="02/10/2003"

     + added t/session_query_parse.t test to cover use of SessionQueryParse
       and $Server->URL APIs
    
     - Fixed duplicate "&" bug associated with using $Server->URL 
       and SessionQueryParse together
    
     + Patch to allow $Server->URL() to be called multiple times on the same URL
       as in $Server->URL($Server->URL($url, \%params), \%more_params)
    
     (d) Added new testimonials & sites & created a separate testimonials page.
    
     - SessionQueryParse will now add to &amp; to the query strings
       embedded in the HTML, instead of & for proper HTML generation.
       Thanks to Peter Galbavy for pointing out and Thanos Chatziathanassiou
       for suggesting the fix.
    
     - $Response->{ContentType} set to text/html for developer error reporting,
       in case this was set to something else before the error occured.
       Thanks to Philip Mak for reporting.
    
     - Couple of minor bug fixes under PerlWarn use, thanks Peter Galbavy
       for reporting.
    
     + Added automatic load of "use Apache2" for compat with mod_perl2 
       request objects when Apache::ASP is loaded via "PerlModule Apache::ASP"
       Thanks to Richard Curtis for reporting bug & subsequent testing.
    
     - When GlobalPackage config changes, but global.asa has not, global.asa
       will be recompiled anyway to update the GlobalPackage correctly.
       Changing GlobalPackage before would cause errors if global.asa was
       already compiled.
    
     ++ For ANY PerlSetVar type config, OFF/Off/off will be assumed 
        to have value of 0 for that setting.  Before, only a couple settings
        had this semantics, but they all do now for consistency.
    
     - Fix for InodeNames config on OpenBSD, or any OS that might have
       a device # of 0 for the file being stat()'d, thanks to Peter Galbavy
       for bug report.
    
     ++ Total XSLT speedups, 5-10% on large XSLT, 10-15% on small XSLT
    
     + bypass meta data check like expires for XSLT Cache() API use
       because XSLT tranformations don't expire, saves hit to cache dbm
       for meta data
    
     + use of direct Apache::ASP::State methods like FETCH/STORE
       in Cache() layer so we don't have to go through slower tied interface.
       This will speed up XSLT & and include output caching mostly.
    
     + minor optimizations for speed & memory usage
    

    $VERSION = 2.49; $DATE="11/10/2002"

     -- bug introduced in 2.47 cached script compilations for executing
        scripts ( not includes ) of the same name in different directories
        for the same Global/GlobalPackage config for an application.
        Fix was to remove optimization that caused problem, and
        created test case t/same_name.t to cover bug.
    

    $VERSION = 2.47; $DATE="11/06/2002"

     ++ Runtime speed enhancements for 15-20% improvement including:
       + INTERNAL API ReadFile() now returns scalar ref as memory optimization
       + cache InodeNames config setting in ASP object now for common lookups
       + removed CompileChecksum() INTERNAL API, since it was an unnecesary
         method decomposition along a common code path
       + removed IsChanged() INTERNAL API since compiling of scripts
         is now handled by CompileInclude() which does this functionality already
       + removed unnecessary decomp of IncludesChanged() INTERNAL API, which was along
         critical code path
       + do not call INTERNAL SearchDirs() API when compiling base script
         since we have already validated its path earlier
       + Use stat(_) type shortcut for stat() & -X calls where possible
       + Moved @INC initilization up to handler() & consolidated with $INCDir lib
       + removed useless Apache::ASP::Collection::DESTROY
       + removed useless Apache::ASP::Server::DESTROY
       + removed useless Apache::ASP::GlobalASA::DESTROY
       + removed useless Apache::ASP::Response::DESTROY
    
     - Default path for $Response->{Cookies} was from CookiePath
       config, but this was incorrect as CookiePath config is only
       for $Session cookie, so now path for $Response->{Cookies}
       defaults to /
    
     - Fixed bug where global.asa events would get undefined with
       StatINC and GlobalPackage set when the GlobalPackage library
       changed & get reloaded.
    
     (d) Documented long time config NoCache.
    
     -- Fixed use with Apache::Filter, capable as both source
        and destination filter.  Added ./site/eg/filter.filter example
        to demonstrate these abilities.
    
     + Use $r->err_headers_out->add Apache::Table API for cookies 
       now instead of $r->cgi_header_out.  Added t/cookies.t test to 
       cover new code path as well as general $Response->Cookies API.
       Also make cookies headers sorted by cookie and dictionary key 
       while building headers for repeatable behavior, this latter was 
       to facilitate testing.
    
     - fixed $Server->Mail error_log output when failing to connect
       to SMTP server.
    
     + added tests to cover UniquePackages & NoCache configs since this
       config logic was updated
    
     + made deprecated warnings for use of certain $Response->Member
       calls more loudly write to error_log, so I can remove the AUTOLOAD
       for Response one day
    
     - Probably fixed behavior in CgiHeaders, at least under perl 5.8.0, and
       added t/cgi_headers.t to cover this config.
    
     + removed $Apache::ASP::CompressGzip setting ability, used to possibly
       set CompressGzip in the module before, not documented anyway
    
     + removed $Apache::ASP::Filter setting ability to set Filter globally, 
       not documented anyway
    
     + removed old work around for setting ServerStarting to 0
       at runtime, which was bad for Apache::DBI on win32 a long
       time ago:
    
        $Apache::ServerStarting and $Apache::ServerStarting = 0;
    
       If this code is still needed in Apache::ASP->handler() let
       me know.
    
     + check to make sure data in internal database is a HASH ref
       before using it for session garbage collection.  This is to
       help prevent against internal database corruption in a 
       network share that does not support flock() file locking.
    
     + For new XMLSubs ASP type <%= %> argument interpolation
       activated with XMLSubsPerlArgs 0, data references can now
       be passed in addition to SCALAR/string references, so one
       can pass an object reference like so:
    
         <my:tag value="<%= $Object %>" />
    
       This will only work as long as the variable interpolation <%= %>
       are flushed against the containing " " or ' ', or else the object
       reference will be stringified when it is concatenated with 
       the rest of the data.
    
       Testing for this feature was added to ./t/xmlsubs_aspargs.t
    
       This feature is still experimental, and its interface may change.
       However it is slated for the 3.0 release as default method,
       so feedback is appreciated.
    
     + For new XMLSubs ASP type <%= %> argument interpolation
       activated with XMLSubsPerlArgs 0, <% %> will no longer work,
       just <%= %>, as in 
    
         <my:tag value="some value <%= $value %> more data" />
    
       This feature is still experimental, and its interface may change.
       However it is slated for the 3.0 release as default method,
       so feedback is appreciated.
    

    $VERSION = 2.45; $DATE="10/13/2002"

     ++New XMLSubsPerlArgs config, default 1, indicates how 
      XMLSubs arguments have always been parsed.  If set to 0,
      will enable new XMLSubs args that are more ASP like with
      <%= %> for dynamic interpolation, such as:
    
        <my:xmlsub arg="<%= $data %>" arg2="text <%= $data2 %>" />
     
      Settings XMLSubsPerlArgs to 0 is experimental for now, but
      will become the default by Apache::ASP version 3.0
    
     ++Optimization for static HTML/XML files that are served up 
      via Apache::ASP so that they are not compiled into perl subroutines
      first.  This makes especially native XSLT both faster & take
      less memory to serve, before XSL & XML files being transformed
      by XSLT would both be compiled as normal ASP script first, so 
      now this will happen if they really are ASP scripts with embedded
      <% %> code blocks & XMLSubs being executed.
    
     +Consolidate some config data for Apache::ASP->Loader to use
      globals in @Apache::ASP::CompileChecksumKeys to know which 
      config data is important for precompiling ASP scripts.
    
     +Further streamlined code compilation.  Now both base
      scripts and includes use the internal CompileInclude() API
      to generate code.
    
     -Fixed runtime HTML error output when Debug is set to -2/2,
      so that script correctly again gets rendered in final perl form.
      Added compile time error output to ./site/eg/syntax_error.asp
      when a special link is clicked for a quick visual test.
    
     -Cleaned up some bad coding practices in ./site/eg/global.asa
      associated changes in other example files.  Comment example
      global.asa some for the first time reader
    
     -DemoASP.pm examples module needed "use strict" fix, thanks
      to Allan Vest for bug report
    
     --$rv = $Response->Include({ File => ..., Cache => 1});
      now works to get the first returned value fetched from
      the cache.  Before, because a list was always returned,
      $rv would have been equal to the number of items returned,
      even if the return value list has just one element.
    
     (d) added site/robots.txt file with just a comment for
         search engine indexing
    
     -fixed ./site/eg/binary_write.htm to not use 
      $Response->{ContentLength} because it does not exist.
      Fixed it to use $Response->AddHeader now instead
    

    $VERSION = 2.41; $DATE="09/29/2002"

     -Removed CVS Revision tag from Apache::ASP::Date, which 
      was causing bad revision numbers in CPAN after CVS integration
      of Apache::ASP
    
     +removed cgi/asp link to ../asp-perl from distribution.  This
      link was for the deprecated asp script which is now asp-perl
    

    $VERSION = 2.39; $DATE="09/10/2002"

     -Turn off $^W explicitly before reloading global.asa.  Reloading
      global.asa when $^W is set will trigger subroutine redefinition
      warnings.  Reloading global.asa should occur without any problems
      under normal usage of the system, thus this work around.
    
      This fix is important to UseStrict functionality because warnings
      automatically become thrown as die() errors with UseStrict enabled,
      so we have to disable normal soft warnings here.
    
     -$Response->Include() runtime errors now throw a die() that
      can be trapped.  This was old functionality that has been restored.
      Other compile time errors should still trigger a hard error
      like script compilation, global.asa, or $Response->Include()
      without an eval()
    
     +Some better error handling with Debug 3 or -3 set, cleaned
      up developer errors messages somewhat.
    

    $VERSION = 2.37; $DATE="07/03/2002"

     -Fixed the testing directory structures for t/long_names.t
      so that tar software like Archive::Tar & Solaris tar that
      have problems with long file names will still be able 
      to untar distribution successfully.  Now t/long_names.t
      generates its testing directory structures at runtime.
    
     -Fixes for "make test" to work under perl 5.8.0 RC2, 
      courtesy of Manabu Higashida
    
     +SessionQueryForce setting created for disabling use of cookies
      for $Session session-id passing, rather requiring use of SessionQuery*
      functionality for session-id passing via URL query string.
    
      By default, even when SessionQuery* options are used, cookies will
      be used if available with SessionQuery* functionality acting only
      as a backup, so this makes it so that cookies will never be used.
    
     +Escape ' with HTMLEncode() to &#39;
    
     -Trying to fix t/server_mail.t to work better for platforms
      that it should skip testing on.  Updated t/server.t test case.
    
     +Remove exit() from Makefile.PL so CPAN.pm's automatic
      follow prereq mechanism works correctly.  Thanks to Slaven Rezic
      for pointing this out.
    
     +Added Apache::compat loading in mod_perl environment for better
      mod_perl 2.0 support.
    

    $VERSION = 2.35; $DATE="05/30/2002"

     +Destroy better $Server & $Response objects so that my 
      closure references to these to not attempt to work in the future 
      against invalid internal data. There was enough data left in these 
      old objects to make debugging the my closure problem confusing, where 
      it looked like the ASP object state became invalid.
    
     +Added system debug diagnostics to inspect StateManager group cleanup
    
     (d) Documentation update about flock() work around for 
      Win95/Win98/WinMe systems, confirmed by Rex Arul
    
     (d) Documentation/site build bug found by Mitsunobu Ozato, 
      where <% %> not being escaped correctly with $Server->HTMLEncode().
      New japanese documentation project started by him 
      at http://sourceforge.jp/projects/apache-asp-jp/ 
    
     -InitPackageGlobals() called after new Apache::ASP object created so 
      core system templates can be compiled even when there was a runtime
      compilation error of user templates.  Bug fix needed pointed out by
      Eamon Daly
    

    $VERSION = 2.33; $DATE="04/29/2002"

     - fixed up t/server_mail.t test to skip if a sendmail server
       is not available on localhost.  We only want the test to run
       if there is a server to test against.
    
     + removed cgi/asp script, just a symlink now to the ./asp-perl script
       which in this way deprecates it.  I had it hard linked, but the 
       distribution did not untar very well on win32 platform.
    
     + Reordered the modules in Bundle::Apache::ASP for a cleaner install.
    
     - Fixed bug where XMLSubs where removing <?xml version ... ?> tag
       when it was needed in XSLT mode.
    
     + $Server->Mail({ CC => '...', BCC => '...' }), now works to send
       CC & BCC headers/recipients.
    
     + Removed $Apache::ASP::Register definition which defined the current
       executing Apache::ASP object.  Only one part of the application was
       using it, and this has been fixed.  This would have been an unsafe
       use of globals for a threaded environment.
    
     + Decreased latency when doing Application_OnStart, used to sleep(1) 
       for CleanupMaster sync, but this is not necessary for Application_OnStart 
       scenario
    
     + Restructure code / core templates for MailErrorsTo funcationality.  
       Wrote test mail_error.t to cover this.  $ENV{REMOTE_USER} will now 
       be displayed in the MailErrorsTo message when defined from 401 basic auth.
    
     + $Server->RegisterCleanup should be thread safe now, as it no longer relies
       on access to @Apache::ASP::Cleanup for storing the CODE ref stack.
    
     + test t/inode_names.t for InodeNames and other file tests covering case
       of long file names.
    
     - Fixed long file name sub identifier bug.  Added test t/long_names.t.
    
     + CacheDir may now be set independently of StateDir.  It used to default
       to StateDir if it was set.
    
     ++ Decomposition of modules like Apache::ASP::Session & Apache::ASP::Application
       out of ASP.pm file.  This should make the source more developer friendly.  
    
       This selective code compilation also speeds up CGI requests that do not 
       need to load unneeded modules like Apache::ASP::Session, by about 50%,
       so where CGI mode ran at about 2.1 hits/sec before, now for 
       light requests that do not load $Session & $Application, requests
       run at 3.4 hits/sec, this is on a dual PIII-450 linux 2.4.x
    
     - Caching like for XSLTCache now works in CGI mode.  
       This was a bug that it did not before.
    
     + $Server->File() API added, acts as a wrapper around 
       Apache->request->filename Added test in t/server.t
    
     ++  *** EXPERIMENTAL / ALPHA FEATURE NOTE BEGIN ***
    
       New $PERLLIB/Apache/ASP/Share/ directory created to 
       hold system & user contributed components, which will be found
       on the $Server->MapInclude() path, which helps $Response->Include
       search '.',Global,IncludesDir, and now Apache::ASP::Share for
       includes to load at runtime.  
    
       The syntax for loading a shared include is to prefix the file
       name with Share:: as in:
    
        $Response->TrapInclude('Share::CORE/MailError.inc');
    
       New test to cover this at t/share.t
    
       This feature is experimental.  The naming convention may change
       and the feature may disappear altogether, so only use if you
       are interesting in experimenting with this feature & will
       provide feedback about how it works.
    
       *** EXPERIMENTAL / ALPHA FEATURE NOTE END ***
    
     + asp-perl script now uses ./asp.conf instead of ./asp.config
       for runtime configuration via %Config defined there.  Update docs
       for running in standalone CGI mode
    
     + Make use of MANFEST.SKIP to not publish the dev/* files anymore.
    
     - Script_OnEnd guaranteed to run after $Response->End, but 
       it will not run if there was an error earlier in the request.
    
     + lots of new test cases covering behaviour of $Response->End
       and $Response->Redirect under various conditions like XMLSubs
       and SoftRedirect and global.asa Script_OnStart
    
     + asp-perl will be installed into the bin executables when
       Apache::ASP is installed.  asp-perl is the command line version
       of Apache::ASP that can also be used to run script in CGI mode.
       Test case covering asp-perl functionality.
    
     + asp CGI/command line script now called asp-perl.  I picked this 
       name because Apache::ASP often has the name asp-perl in distributions
       of the module.
    
     + Apache::ASP::CGI::Test class now subclass of Apache::ASP::CGI.  To facilitate
       this Apache::ASP::CGI::init() now called OO like Apache::ASP::CGI->init()
       Fixed up places where the old style was called.  New Test class allows
       a dummy Apache request object to be built which caches header & body output
       for later inspection instead of writing it to STDOUT.
    
     - $Response->Redirect() under SoftRedirect 1 will not first Clear() buffer
    
     - $Response->Redirect() in an XMLSubs will work now ... behavior
       of $Response->Flush() being turned off in an XMLSubs was interfering with this.
    
     + srand() init tracking done better, thanks for patch from Ime Smits
    
     + Added file/directory being used for precompilation in 
       Apache::ASP->Loader($file, ...) to output like:
    
        [Mon Feb 04 20:19:22 2002] [error] [asp] 4215 (re)compiled 22 scripts 
          of 22 loaded for $file
    
       This is so that when precompiling multiple web sites
       each with different directories, one can easier see the 
       compile output relevant to the Loader() command being run.
    
     + better decomp of Apache::ASP site build files at ./build/* files,
       which is good should anyone look at it for ideas.
    
     + improved test suite to error when unintended output results from
       t/*.t test scripts.
    
     - () now supported in XMLSubsMatch config, added xmlsubsmatch.t test...
       specifically a config like 
    
         PerlSetVar (aaa|bbb):\w+ 
    
       should now work.  Thanks for bug report from David Kulp.
    
     + Added an early srand() for better $ServerID creation
    
     + Work around for DSO problems where $r is not always correctly 
       defined in Apache::ASP::handler().  Thanks to Tom Lear for patch.
    

    $VERSION = 2.31; $DATE="01/22/2002";

     + $Server->MapInclude() API extension created to wrap up Apache::ASP::SearchDirs 
       functionality so one may do an conditional check for an include existence befor 
       executing $Response->Include().  Added API test to server.t
    
     + $Server->Transfer() now allows arguments like $Response->Include(), and now acts just
       as a wrapper for:
    
         $Response->Include($file, @args);
         $Response->End();
    
       added test case at t/server_transfer.t
    
     + Removed dependency of StatINC functionality on Apache::Symbol.  Apache::Symbol 
       is no longer required.  Added test of t/stat_inc.t for correct StatINC initialization
       for platforms where Devel::Symdump is present.
    
     + Better error message when $Request->Params has not been defined with RequestParams
       config & it gets used in script.  Added test case as t/request_params_none.t
    
     + Directories cannot now be included as scripts via $Response->Include(), added
       test case to t/include.t
    
     - No longer make $Response->Flush dependent on $Response->IsClientConnected() to 
       be true to write output to client.  There have been spurious errors reported
       about the new ( >= 2.25 ) IsClientConnected code, and this will limit the impact 
       of that functionality possibly not working still to those users explicitly using 
       that API.
    
     + $Response->AddHeader($header_name, $value) now will set $Response members
       for these headers: Content-Type, Cache-Control, Expires.  This is to avoid
       both the application & Apache::ASP sending out duplicate headers.  Added
       test cases for this to t/response.t
    
     + split up Bundle::Apache::ASP into that, and Bundle::Apache::ASP::Extra
       the former with just the required modules to run, and the latter 
       for extra functionality in Apache::ASP
    
     + new $Request->{Method} member to return $r->method of GET or POST that 
       client browser is requesting, added t/request.t sub test to cover this member.
    

    $VERSION = 2.29; $DATE="11/19/2001";

     +Added some extra help text to the ./cgi/asp --help message
      to clarify how to pass arguments to a script from the command line.
    
     +When using $Server->Mail() API, if Content-Type header is set,
      and MIME-Version is not, then a "MIME-Version: 1.0" header will be sent
      for the email.  This is correct according to RFC 1521 which specifies
      for the first time the Content-Type: header for email documents.
      Thanks to Philip Mak for pointing out this correct behavior.
    
     +Made dependent on MLDBM::Sync version .25 to pass the taint_check.t test
    
     +Improved server_mail.t test to work with mail servers were relaying is denied
    
     +Added <html><body> tags to MailErrorsTo email
    
     --Fixed SessionCount / Session_OnEnd bug, where these things were not
      working for $Sessions that never had anything written to them.
      This bug was introduced in 2.23/2.25 release.
    
      There was an optimization in 2.23/2.25 where a $Session that was never
      used does not write its state lock file & dbm files to disk, only if
      it gets written too like $Session->{MARK}++.  Tracking of these NULL $Sessions 
      then is handled solely in the internal database.  For $Session garbage 
      collection though which would fire Session_OnEnd events and update 
      SessionCount, the Apache::ASP::State->GroupMembers() function was just 
      looking for state files on disk ... now it looks in the internal database 
      too for SessionID records for garbage collection.
    
      Added a test at ./t/session_events.t for these things.
    
     +Some optimizations for $Session API use.
    
     +Added support for XSLT via XML::LibXSLT, patch courtesy of Michael Buschauer
    
     -Got rid of an warning when recompiling changing includes under perl 5.6.1...
      undef($code) method did not work for this perl version, rather undef(&$code) does.
      Stopped using using Apache::Symbol for this when available.
    
     -Make Apache::ASP script run under perl taint checking -T for perl 5.6.1...
      $code =~ tr///; does not work to untaint here, so much use the slower:
      $code =~ /^(.*)$/s; $code = $1; method to untaint.
    
     -Check for inline includes changing, included in a dynamic included
      loaded at runtime via $Response->Include().  Added test case for
      this at t/include_change.t.  If an inline include of a dynamic include
      changes, the dynamic include should get recompiled now.
    
     -Make OK to use again with PerlTaintCheck On, with MLDBM::Sync 2.25.
      Fixed in ASP.pm, t/global.asa, and created new t/taint_check.t test script
    
     +Load more modules when Apache::ASP is loaded so parent will share more
      with children httpd: 
       Apache::Symbol 
       Devel::Symdump 
       Config 
       lib 
       MLDBM::Sync::SDBM_File
    
     +When FileUploadMax bytes is exceeded for a file upload, there will not
      be an odd error anymore resulting from $CGI::POST_MAX being triggered,
      instead the file upload input will simply be ignored via $CGI::DISABLE_UPLOADS.
      This gives the developer the opportunity to tell the user the the file upload
      was too big, as demonstrated by the ./site/eg/file_upload.asp example.
    
      To not let the web client POST a lot of data to your scripts as a form
      of a denial of service attack use the apache config LimitRequestBody for the 
      max limits.  You can think of PerlSetVar FileUploadMax as a soft limit, and 
      apache's LimitRequestBody as a hard limit.
    
     --Under certain circumstances with file upload, it seems that IsClientConnected() 
      would return an aborted client value from $r->connection->aborted, so
      the buffer output data would not be flushed to the client, and 
      the HTML page would return to the browser empty.  This would be under
      normal file upload use.  One work-around was to make sure to initialize
      the $Request object before $Response->IsClientConnected is called,
      then $r->connection->aborted returns the right value.
      
      This problem was probably introduced with IsClientConnected() code changes
      starting in the 2.25 release.
    

    $VERSION = 2.27; $DATE="10/31/2001";

     + Wrapped call to $r->connection->fileno in eval {} so to 
       preserve backwards compatibility with older mod_perl versions
       that do not have this method defined.  Thanks to Helmut Zeilinger
       for catching this.
    
     + removed ./dev directory from distribution, useless clutter
    
     + Removed dependency on HTTP::Date by taking code into
       Apache::ASP as Apache::ASP::Date.  This relieves
       the dependency of Apache::ASP on libwww LWP libraries.
       If you were using HTTP::Date functions before without loading
       "use HTTP::Date;" on your own, you will have to do this now.
    
     + Streamlined code execution.  Especially worked on 
       $Response->IsClientConnected which gets called during
       a normal request execution, and got rid of IO::Select
       dependency. Some function style calls instead of OO style 
       calls where private functions were being invokes that one 
       would not need to override.
    
     - Fixed possible bug when flushing a data buffer where there
       is just a '0' in it.
    
     + Updated docs to note that StateCache config was deprecated
       as of 2.23.  Removed remaining code that referenced the config.
    
     + Removed references to unused OrderCollections code.
    
     - Better Cache meta key, lower chance of collision with 
       unrelated data since its using the full MD5 keyspace now
    
     + Optimized some debugging statements that resulted 
       from recent development.
    
     + Tie::TextDir .04 and above is supported for StateDB
       and CacheDB settings with MLDBM::Sync .21. This is good for 
       CacheDB where output is larger and there are not many 
       versions to cache, like for XSLTCache, where the site is 
       mostly static.
    
     + Better RESOURCES section to web site, especially with adding
       some links to past Apache::ASP articles & presentations.
    

    $VERSION = 2.25; $DATE="10/11/2001";

     + Improved ./site/apps/search application, for better
       search results at Apache::ASP site.  Also, reengineered
       application better, with more perl code moved to global.asa.
       Make use of MLDBM::Sync::SDBM_File, where search database
       before was engineering around SDBM_File's shortcomings.
    
     - Fix for SessionSerialize config, which broke in 2.23
       Also, added t/session_serialize.t to test suite to catch
       this problem in the future.
    

    $VERSION = 2.23; $DATE="10/11/2001";

     +Make sure a couple other small standard modules get loaded
      upon "PerlModule Apache::ASP", like Time::HiRes, Class::Struct,
      and MLDBM::Serializer::Data::Dumper.  If not available
      these modules won't cause errors, but will promote child httpd
      RAM sharing if they are.
    
     -XMLSubs args parsing fix so an arg like z-index
      does not error under UseStrict.  This is OK now:
    
       <my:layer z-index=3 top=0 left=0> HTML </my:layer>
    
     -Only remove outermost <SCRIPT> tags from global.asa
      for IIS/PerlScript compatibility.  Used to remove
      all <SCRIPT> tags, which hurt when some subs in globa.asa
      would be printing some JavaScript.
    
     +$Response->{IsClientConnected} now updated correctly 
      before global.asa Script_OnStart.  $Response->IsClientConnect()
      can be used for accurate accounting, while 
      $Response->{IsClientConnected} only gets updated
      after $Response->Flush().  Added test cases to response.t
    
     +$Server->HTMLEncode(\$data) API extension, now can take
      scalar ref, which can give a 5% improvement in benchmarks
      for data 100K in size.
    
     -Access to $Application is locked when Application_OnEnd & 
      Application_OnStart is called, creating a critical section
      for use of $Application
    
     ++MLDBM::Sync used now for core DBM support in Apache::ASP::State.
      This drastically simplifies/stabilizes the code in there
      and will make it easier for future SQL database plugins.
    
     +New API for accessing ASP object information in non content
      handler phases:
    
        use Apache::ASP;
        sub My::Auth::handler {
          my $r = shift;
          my $ASP = Apache::ASP->new($r) 
          my $Session = $ASP->Session;
        }
    
      In the above example, $Session would be the same $Session
      object created later while running the ASP script for this
      same request.  
    
      Added t/asp_object.t test for this.  Fixed global.asa to only 
      init StateDir when application.asp starts which is the first 
      test script to run.
    
     -Fixed on Win32 to make Apache::ASP->new($r) able to create
      multiple master ASP objects per request.  Was not reentrant 
      safe before, particularly with state locking for dbms like 
      $Application & $Session.  
    
     ++Output caching for includes, built on same layer ( extended )
      as XSLTCache, test suite at t/cache.t.  Enabled with special 
      arguments to 
    
        $Response->Include(\%args, @include_args)
        $Response->TrapInclude(\%args, @include_args)
        $Server->Execute(\%args, @include_args)
    
      where %args = (
        File => 'file.inc',
        Cache => 1, # to activate cache layer
        Expires => 3600, # to expire in one hour
        LastModified => time() - 600, # to expire if cached before 10 minutes ago
        Key => $Request->Form, # to cache based on checksum of serialized form data,
        Clear => 1, # to not allow fetch from cache this time, will always execute include
      );
    
      Like the XSLTCache, it uses MLDBM::Sync::SDBM_File
      by default, but can use DB_File or GDBM_File if
      CacheDB is set to these.
    
      See t/cache.t for API support until this is documented.
    
     +CacheSize now supports units of M, K, B like 
    
       CacheSize 10M
       CacheSize 10240K
       CacheSize 10000000B
       CacheSize 10000000
    
     -Better handling of $Session->Abandon() so multiple
      request to the same session while its being destroyed
      will have the right effect.
    
     +Optimized XMLSubs parsing.  Scripts with lots lof XMLSubs 
      now parse faster for the first time.  One test script with 
      almost 200 such tags went from a parse time of around 3 seconds
      to .7 seconds after optimizations.
    
     +Updated performance tuning docs, particularly for using
      Apache::ASP->Loader()
    
     +$Server->URL($url, \%params) now handles array refs
      in the params values like
        $Server->URL($url, { key => [ qw( value1 value2 ) ] })
    
      This is so that query string data found in 
      $Request->QueryString that gets parsed into this form
      from a string like: ?key=value&key=value2 would be 
      able to be reused passed back to $Server->URL to 
      create self referencing URLs more easily.
    
     -Bug fix where XMLSubs like <s:td /> now works on perl 
      5.005xx, thanks to Philip Mak for reporting & fix.
    
     +When searching for included files, will now join
      the absolute path of the directory of the script
      with the name of the file if its a relative file
      name like ./header.inc.  Before, would just look
      for something like ././header.inc by using '.'
      as the first directory to look for includes in.
    
      The result of this is that scripts in two directories
      configured with the same Global setting should be able
      to have separate local header.inc files without causing
      a cached namespace collision.
    
     +$Server->Config() call will return a hash ref 
      to all the config setting for that request, like
      Apache->dir_config would.
    
     -StatINC setting with Apache::ASP->Loader() works again.
      This makes StatINC & StatINCMatch settings viable 
      for production & development use when the system has
      very many modules.
    
     -Cookieless session support with configs like SessionQueryParse
      and SessionQuery now work for URLs with frags in them
      like http://localhost?arg=value#frag
    
     +@rv = $Response->Include() now works where there are
      multiple return values from an include like:
      <% return(1,2); %>
    

    $VERSION = 2.21; $DATE="8/5/2001";

     +Documented RequestParams config in CONFIG misc section.
    
     +Documented new XSLT caching directives.
    
     +Updated ./site/eg/.htaccess XSLT example config
      to use XSLTCache setting.
    
     +New FAQ section on why perl variables are sticky globals,
      suggested by Mark Seger.
    
     -push Global directory onto @INC during ASP script execution
      Protect contents of original @INC with local.  This makes
      things compatible with .09 Apache::ASP where we always had
      Global in @INC.  Fixed needed by Henrik Tougaard
    
     - ; is a valid separator like & for QueryString Parameters
      Fixed wanted by Anders
    
     -XSMLSubsMatch doc fix in CONFIG section
    
     +Reduces number of Session groups to 16 from 32, so 
      session manager for small user sets will be that much faster.
    
     +optimizations for internal database, $Application, and $Session
      creation.
    
     +XSLTCache must be set for XSLT caching to begin using CacheDir
    
     +CacheDB like StateDB bug sets dbm format for caching, which
      defaults to MLDBM::Sync::SDBM_File, which works well for caching
      output sizes < 50K
    
     +CacheDir config for XSLT caching ... defaults to StateDir
    
     +CacheSize in bytes determines whether the caches in CacheDir
      are deleted at the end of the request.  A cache will be 
      reset in this way back to 0 bytes. Defaults to 10000000 bytes
      or about 10M.
    
     +Caching infrastructure work that is being used in XSLT
      can be leveraged later for output caching of includes,
      or arbitrary user caching.
    
     -t/server_mail.t test now uses valid email for testing
      purposes ... doesn't actually send a mail, but for SMTP
      runtime validation purposes it should be OK.
    
     +fixed where POST data was read from under MOD_PERL,
      harmless bug this was that just generated the wrong
      system debugging message.
    

    $VERSION = 2.19; $DATE="7/10/2001";

     +update docs in various parts
    
     +added ./make_httpd/build_httpds.sh scripts for quick builds
      of apache + mod_perl + mod_ssl
    
     ++plain CGI mode available for ASP execution.  
      cgi/asp script can now be used to execute ASP 
      scripts in CGI mode.  See CGI perldoc section for more info.
      The examples in ./site/eg have been set up to run
      in cgi mode if desired.  Configuration in CGI section
      only tested for Apache on Linux.
    
     -Fixed some faulty or out of date docs in XML/XSLT section.
    
     +added t/server_mail.t test for $Server->Mail(), requires
      Net::SMTP to be configured properly to succeed.
    
     +Net::SMTP debugging not enabled by Debug 1,2,3 configs,
      not only when system debugging is set with Debug -1,-2,-3
      However, a Debug param passed to $Server->Mail() will 
      sucessfully override the Debug -1,-2,-3 setting even
      when its Debug => 0
    
     -Check for undef values during stats for inline includes
      so we don't trigger unintialized warnings
    
     +Documented ';' may separate many directories in the IncludesDir
      setting for creating a more flexible includes search path.
    

    $VERSION = 2.17; $DATE="6/17/2001";

     +Added ASP perl mmm-mode subclass and configuration
      in editors/mmm-asp-perl.el file for better emacs support.
      Updated SYNTAX/Editors documentation.
    
     +Better debugging error message for Debug 2 or 3 settings 
      for global.asa errors.  Limit debug output for lines
      preceding rendered script.
    
     -In old inline include mode, there should no longer
      be the error "need id for includes" when using
      $Response->Include() ... if DynamicIncludes were
      enabled, this problem would not have likely occured
      anyway.  DynamicIncludes are preferrable to use so
      that compiled includes can be shared between scripts.
      This bug was likely introduced in version 2.11.
    
     -Removed logging from $Response->BinaryWrite() in regular
      debug mode 1 or 2.  Logging still enabled in system Debug mode, -1 or -2
    
     -Removed other extra system debugging call that is really not
      necessary.
    

    $VERSION = 2.15; $DATE="06/12/2001";

     -Fix for running under perl 5.6.1 by removing parser optimization
      introduced in 2.11.
    
     -Now file upload forms, forms with ENCTYPE="multipart/form-data"
      can have multiple check boxes and select items marked for 
      @params = $Request->Form('param_name') functionality.  This 
      will be demonstrated via the ./site/eg/file_upload.asp example.
    

    $VERSION = 2.11; $DATE="05/29/2001";

     +Parser optimization from Dariusz Pietrzak
    
     -work around for global destruction error message for perl 5.6
      during install
    
     +$Response->{IsClientConnected} now will be set
      correctly with ! $r->connection->aborted after each
      $Response->Flush()
    
     +New XSLTParser config which can be set to XML::XSLT or
      XML::Sablotron.  XML::Sablotron renders 10 times faster, 
      but differently.  XML::XSLT is pure perl, so has wider
      platform support than XML::Sablotron.  This config affects
      both the XSLT config and the $Server->XSLT() method.
    
     +New $Server->XSLT(\$xsl_data, \$xml_data) API which 
      allows runtime XSLT on components instead of having to process
      the entire ASP output as XSLT.  
    
     -XSLT support for XML::XSL 0.32.  Things broke after .24.
    
     -XSLTCacheSize config no longer supported.  Was a bad 
      Tie::Cache implementation.  Should be file based cache
      to greatly increases cache hit ratio.
    
     ++$Response->Include(), $Response->TrapInclude(),
      and $Server->Execute() will all take a scalar ref
      or \'asdfdsafa' type code as their first argument to execute 
      a raw script instead of a script file name.  At this time, 
      compilation of such a script, will not be cached.  It is 
      compiled/executed as an anonymous subroutine and will be freed
      when it goes out of scope.
    
     + -p argument to cgi/asp script to set GlobalPackage
      config for static site builds
    
     -pod commenting fix where windows clients are used for 
      ASP script generation.
    
     +Some nice performance enhancements, thank to submissions from
      Ime Smits.  Added some 1-2% per request execution speed.
    
     +Added StateDB MLDBM::Sync::SDBM_File support for faster
      $Session + $Application than DB_File, yet still overcomes
      SDBM_File's 1024 bytes value limitation.  Documented in 
      StateDB config, and added Makefile.PL entry.
    
     +Removed deprecated MD5 use and replace with Digest::MD5 calls
    
     +PerlSetVar InodeNames 1 config which will compile scripts hashed by 
      their device & inode identifiers, from a stat($file)[0,1] call.
      This allows for script directories, the Global directory,
      and IncludesDir directories to be symlinked to without
      recompiling identical scripts.  Likely only works on Unix
      systems.  Thanks to Ime Smits for this one.
    
     +Streamlined code internally so that includes & scripts were
      compiled by same code.  This is a baby step toward fusing
      include & script code compilation models, leading to being
      able to compile bits of scripts on the fly as ASP subs, 
      and being able to garbage collect ASP code subroutines.
    
     -removed @_ = () in script compilation which would trigger warnings 
      under PerlWarn being set, thanks for Carl Lipo for reporting this.
    
     -StatINC/StatINCMatch fix for not undeffing compiled includes
      and pages in the GlobalPackage namespace
    
     -Create new HTML::FillInForm object for each FormFill
      done, to avoid potential bug with multiple forms filled
      by same object.  Thanks to Jim Pavlick for the tip.
    
     +Added PREREQ_PM to Makefile.PL, so CPAN installation will
      pick up the necessary modules correctly, without having
      to use Bundle::Apache::ASP, thanks to Michael Davis. 
    
     + > mode for opening lock files, not >>, since its faster
    
     +$Response->Flush() fixed, by giving $| = 1 perl hint
      to $r->print() and the rest of the perl sub.
    
     +$Response->{Cookies}{cookie_name}{Expires} = -86400 * 300;
      works so negative relative time may be used to expire cookies.
    
     +Count() + Key() Collection class API implementations
    
     +Added editors/aasp.vim VIM syntax file for Apache::ASP,
      courtesy of Jon Topper.
    
     ++Better line numbering with #line perl pragma.  Especially
      helps with inline includes.  Lots of work here, & integrated
      with Debug 2 runtime pretty print debugging.
    
     +$Response->{Debug} member toggles on/off whether 
      $Response->Debug() is active, overriding the Debug setting
      for this purpose.  Documented.
    
     -When Filter is on, Content-Length won't be set and compression
      won't be used.  These things would not work with a filtering
      handler after Apache::ASP
    

    $VERSION = 2.09; $DATE="01/30/2001";

     +Examples in ./site/eg are now UseStrict friendly.  
      Also fixed up ./site/eg/ssi_filter.ssi example.
    
     +Auto purge of old stale session group directories, increasing 
      session manager performance when using Sessions when migrating
      to Apache::ASP 2.09+ from older versions.
    
     +SessionQueryParse now works for all $Response->{ContentType}
      starting with 'text' ... before just worked with text/html,
      now other text formats like wml will work too. 
    
     +32 groups instead of 64, better inactive site session group purging.
    
     +Default session-id length back up to 32 hex bytes.
      Better security vs. performance, security more important,
      especially when performance difference was very little.
    
     +PerlSetVar RequestParams 1 creates $Request->Params
      object with combined contents of $Request->QueryString
      and $Request->Form
    
     ++FormFill feature via HTML::FillInForm.  Activate with
      $Response->{FormFill} = 1 or PerlSetVar FormFill 1
      See site/eg/formfill.asp for example.
    
     ++XMLSubs tags of the same name may be embedded in each other
      recursively now.
    
     +No umask() use on Win32 as it seems unclear what it would do
    
     +simpler Apache::ASP::State file handle mode of >> when opening 
      lock file.  saves doing a -e $file test.
    
     +AuthServerVariables config to init $Request->ServerVariables
      with basic auth data as documented.  This used to be default
      behavior, but triggers "need AuthName" warnings from recent
      versions of Apache when AuthName is not set.
    
     -Renamed Apache::ASP::Loader class to Apache::ASP::Load
      as it collided with the Apache::ASP->Loader() function
      namespace.  Class used internally by Apache::ASP->Loader()
      so no public API changed here.
    
     +-Read of POST input for $Request->BinaryRead() even
       if its not from a form.  Only set up $Request->Form
       if this is from a form POST.
    
     +faster POST/GET param parsing
    

    $VERSION = 2.07; $DATE="11/26/2000";

     -+-+ Session Manager
      empty state group directories are not removed, thus alleviating
      one potential race condition.  This impacted performance
      on idle sites severely as there were now 256 directories
      to check, so made many performance enhancements to the 
      session manager.  The session manager is built to handle
      up to 20,000 client sessions over a 20 minute period.  It
      will slow the system down as it approaches this capacity.
    
      One such enhancement was session-ids now being 11 bytes long 
      so that its .lock file is only 16 characters in length.  
      Supposedly some file systems lookup files 16 characters or 
      less in a fast hashed lookup.  This new session-id has
      4.4 x 10^12 possible values.  I try to keep this space as
      large as possible to prevent a brute force attack.
    
      Another enhancement was to limit the group directories
      to 64 by only allowing the session-id prefix to be [0-3][0-f]
      instead of [0-f][0-f], checking 64 empty directories on an
      idle site takes little time for the session manager, compared
      to 256 which felt significant from the client end, especially
      on Win32 where requests are serialized.  
    
      If upgrading to this version, you would do well to delete
      empty StateDir group directories while your site is idle.
      Upgrading during an idle time will have a similar effect,
      as old Apache::ASP versions would delete empty directories.
    
     -$Application->GetSession($session_id) now creates
      an session object that only lasts until the next
      invocation of $Application->GetSession().  This is 
      to avoid opening too many file handles at once,
      where each session requires opening a lock file.
    
     +added experimental support for Apache::Filter 1.013 
      filter_register call
    
     +make test cases for $Response->Include() and 
      $Response->TrapInclude()
    
     +Documented CollectionItem config.
    
     +New $Request->QueryString('multiple args')->Count()
      interface implemented for CollectionItem config.
      Also $Request->QueryString('multiple args')->Item(1) method.
      Note ASP collections start counting at 1.
    
     --fixed race condition, where multiple processes might 
      try creating the same state directory at the same time, with
      one winning, and one generating an error.  Now, web process
      will recheck for directory existence and error if 
      it doesn't. 
    
     -global.asa compilation will be cached correctly, not
      sure when this broke.  It was getting reloaded every request.
    
     -StateAllWrite config, when set creates state files
      with a+rw or 0666 permissions, and state directories
      with a+rwx or 0777 permissions.  This allows web servers
      running as different users on the same machine to share a 
      common StateDir config.  Also StateGroupWrite config
      with perms 0770 and 0660 respectively.
    
     -Apache::ASP->Loader() now won't follow links to 
      directories when searching for scripts to load.
    
     +New RegisterIncludes config which is on by default only
      when using Apache::ASP->Loader(), for compiling includes
      when precompiling scripts.
    
     +Apache::ASP::CompileInclude path optimized, which underlies
      $Response->Include()
    
     +$Request->QueryString->('foo')->Item() syntax enabled
      with CollectionItem config setting.  Default syntax
      supported is $Request->QueryString('foo') which is
      in compatible.  Other syntax like $Request->{Form}{foo}
      and $Request->Form->Item('foo') will work in either case.
    
     +New fix suggested for missing Apache reference in 
      Apache::ASP handler startup for RedHat RPMs.  Added
      to error message.
    
     --Backup flock() unlocking try for QNX will not corrupt the 
      normal flock() LOCK_UN usage, after trying to unlock a file
      that doesn't exist.  This bug was uncovered from the below 
      group deletion race condition that existed. 
    
     -Session garbage collection will not delete new group
      directories that have just been created but are empty.
      There was a race condition where a new group directory would
      be created, but then deleted by a garbage collector before
      it could be initialized correctly with new state files.
    
     +Better random session-id checksums for $Session creation.
      per process srand() initialization, because srand() 
      may be called once prefork and never called again.
      Call without arguments to rely on perl's decent rand
      seeding.  Then when calling rand() in Secret() we have
      enough random data, that even if someone else calls srand()
      to something fixed, should not mess things up terribly since
      we checksum things like $$ & time, as well as perl memory
      references.
    
     +XMLSubs installation make test.
    
     -Fix for multiline arguments for XMLSubs
    

    $VERSION = 2.03; $DATE="08/01/2000";

     +License change to GPL.  See LICENSE section.
    
     +Setup of www.apache-asp.org site, finally!
    
     -get rid of Apache::ASP->Loader() warning message for perl 5.6.0
    

    $VERSION = 2.01; $DATE="07/22/2000";

     +$data_ref = $Response->TrapInclude('file.inc') API
      extension which allows for easy post processing of
      data from includes
    
     +./site/eg/source.inc syntax highlighting improvements
    
     +XMLSubsMatch compile time parsing performance improvement
    

    $VERSION = 2.00; $DATE="07/15/2000";

     -UniquePackages config works again, broke a couple versions back
    
     +better error handling for methods called on $Application
      that don't exist, hard to debug before
    

    $VERSION = 1.95; $DATE="07/10/2000";

     !!!!! EXAMPLES SECURITY BUG FOUND & FIXED !!!!!
    
     --FIXED: distribution example ./site/eg/source.asp now parses 
      out special characters of the open() call when reading local 
      files.
    
      This bug would allow a malicious user possible writing
      of files in the same directory as the source.asp script.  This
      writing exploit would only have effect if the web server user
      has write permission on those files.
    
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
     -$0 now set to transferred file, when using $Server->Transfer
    
     -Fix for XMLSubsMatch parsing on cases with 2 or more args passed
      to tag sub that was standalone like 
        <Apps:header type="header" title="Moo" foo="moo" />
    

    $VERSION = 1.93; $DATE="07/03/2000";

     -sub second timing with Time::HiRes was adding <!-- -->
      comments by HTML by default, which would possibly
      break specific programs looking for precise HTML output.
      Now this behavior must be explicitly turned on with
      the TimeHiRes config setting.
    
      These comments will only appear in HTML only if 
      Debug is enabled as well.
    
      Timed log entries will only occur if 
      system debugging is enabled, with Debug -1 or -2
    

    $VERSION = 1.91; $DATE="07/02/2000";

     +Documented XMLSubsMatch & XSLT* configuration
      settings in CONFIG section.
    
     +XSLT XSL template is now first executed as an 
      ASP script just like the XML scripts.  This is 
      just one step away now from implementing XSP logic.
    
     +$Server->Execute and $Server->Transfer API extensions
      implemented.  Execute is the same as $Request->Include()
      and $Server->Transfer is like an apache internal redirect
      but keeps the current ASP objects for the next script.
    
      Added examples, transfer.htm, and modified dynamic_includes.htm.
    
     +Better compile time error debugging with Debug 2 or -2.
      Will hilite/link the buggy line for global.asa errors, 
      include errors, and XML/XSLT errors just like with 
      ASP scripts before.
    
     +Nice source hiliting when viewing source for the example
      scripts.
    
     +Runtime string writing optimization for static HTML going
      through $Response.
    
     +New version numbering just like everyone else.  Starting at 1.91
      since I seem to be off by a factor of 10, last release would have
      been 1.9.
    

    $VERSION = 0.19; $DATE="NOT RELEASED";

     +XMLSubsMatch and XSLT* settings documented in 
      the XML/XSLT section of the site/README.
    
     -XMLSubsMatch will strip parens in a pattern match
      so it does not interfere with internal matching use.
    
     +XSLT integration allowing XML to be rendered by XSLT
      on the fly.  XSLT specifies XSL file to transform XML.
      XSLTMatch is a regexp that matches XML file names, like \.xml$,
      which will be transformed by XSLT setting, default .*
      
      XSLTCacheSize when specified uses Tie::Cache to cached XML DOMs 
      internally and cache XSLT transformations output per XML/XSL 
      combination.  XML DOM objects can take a lot of RAM, so use
      this setting judiciously like setting to 100.  Definitely 
      experiment with this value.
    
     +More client info in the error mail feature, including
      client IP, form data, query string, and HTTP_* client headers
    
     +With Time::HiRes loaded, and Debug set to non 0, 
      will add a <!-- Apache::ASP served request in xx.xx seconds -->
      to text/html output, similar to Cocoon, per user request  
      Will also add this to the system debug error log output
      when Debug is < 0
    
     -bug fix on object initialization optimization earlier
      in this release, that was introduced for faster event
      handler execution.
    
     +Apache::ASP::Parse() takes a file name, scalar, or
      scalar ref for arguments of data to parse for greater
      integration ability with other applications.
    
     +PodComments optimization, small speed increase at
      compilation time.
    
     +String optimization on internal rendering that avoids 
      unnecessary copying of static html, by using refs.  Should 
      make a small difference on sites with large amounts of 
      static html.
    
     +CompressGzip setting which, when Compress::Zlib is installed,
      will compress text/html automatically going out to the web
      browser if the client supports gzip encoding.
    
     ++Script_OnFlush event handler, and auxiliary work optimizing
      asp events in general.  $Response->{BinaryRef} created which
      is a reference to outgoing output, which can be used 
      to modify the data at runtime before it goes out to the client. 
    
     +Some code optimizations that boost speed from 22 to 24 
      hits per second when using Sessions without $Application,
      on a simple hello world benchmark on a WinNT PII300.
    
     ++Better SessionManagement, more aware of server farms that 
      don't have reliable NFS locking.  The key here is to have only
      one process on one server in charge of session garbage collection
      at any one time, and try to create this situation with a snazzy
      CleanupMaster routine.  This is done by having a process register
      itself in the internal database with a server key created at
      apache start time.  If this key gets stale, another process can 
      become the master, and this period will not exceed the period
      SessionTimeout / StateManager.
    
      ** Work on session manager sponsored by LRN, http://www.lrn.com.  **
      ** This work was used to deploy a server farm in production with  **
      ** NFS mounted StateDir. Thanks to Craig Samuel for his belief in **
      ** open source. :)                                                **
    
      Future work for server farm capabilities might include breaking
      up the internal database into one of 256 internal databases 
      hashed by the first 2 chars of the session id.  Also on the plate
      is Apache::Session like abilities with locking and/or data storage
      occuring in a SQL database.  The first dbs to be done will include
      MySQL & Oracle.
    
     +Better session security which will create a new session id for an 
      incoming session id that does not match one already seen.  This will
      help for those with Search engines that have bookmarked
      pages with the session ids in the query strings.  This breaks away
      from standard ASP session id implementation which will automatically
      use the session id presented by the browser, now a new session id will
      be returned if the presented one is invalid or expired.
    
     -$Application->GetSession will only return a session if
      one already existed.  It would create one before by default.
    
     +Script_OnFlush global.asa event handler, and $Response->{BinaryRef}
      member which is a scalar reference to the content about to be flushed.
      See ./site/eg/global.asa for example usage, used in this case to
      insert font tags on the fly into the output.
    
     +Highlighting and linking of line error when Debug is set to 2 or -2.
    
     --removed fork() call from flock() backup routine? How did 
       that get in there?  Oh right, testing on Win32. :(
       Very painful lesson this one, sorry to whom it may concern.
    
     +$Application->SessionCount support turned off by default
      must enable with SessionCount config option.  This feature
      puts an unnecessary load on busy sites, so not default 
      behavior now.  
    
     ++XMLSubsMatch setting that allows the developer to 
      create custom tags XML style that execute perl subroutines.
      See ./site/eg/xml_subs.asp
    
     +MailFrom config option that defaults the From: field for 
      mails sent via the Mail* configs and $Server->Mail()
    
     +$Server->Mail(\%mail, %smtp_args) API extension
    
     +MailErrorsTo & MailAlertTo now can take comma
      separated email addresses for multiple recipients.
    
     -tracking of subroutines defined in scripts and includes so 
      StatINC won't undefine them when reloading the GlobalPackage, 
      and so an warning will be logged when another script redefines 
      the same subroutine name, which has been the bane of at least
      a few developers.
    
     -Loader() will now recompile dynamic includes that 
      have changed, even if main including script has not.
      This is useful if you are using Loader() in a 
      PerlRestartHandler, for reloading scripts when
      gracefully restarting apache.
    
     -Apache::ASP used to always set the status to 200 by 
      default explicitly with $r->status().  This would be 
      a problem if a script was being used to as a 404 
      ErrorDocument, because it would always return a 200 error
      code, which is just wrong.  $Response->{Status} is now 
      undefined by default and will only be used if set by 
      the developer.  
    
      Note that by default a script will still return a 200 status, 
      but $Response->{Status} may be used to override this behavior.
    
     +$Server->Config($setting) API extension that allows developer
      to access config settings like Global, StateDir, etc., and is a 
      wrapper around Apache->dir_config($setting)
    
     +Loader() will log the number of scripts
      recompiled and the number of scripts checked, instead
      of just the number of scripts recompiled, which is
      misleading as it reports 0 for child httpds after
      a parent fork that used Loader() upon startup.  	
    
     -Apache::ASP->Loader() would have a bad error if it didn't load 
      any scripts when given a directory, prints "loaded 0 scripts" now
    

    $VERSION = 0.18; $DATE="02/03/2000";

     +Documented SessionQuery* & $Server->URL() and 
      cleaned up formatting some, as well as redoing
      some of the sections ordering for better readability.
      Document the cookieless session functionality more
      in a new SESSIONS section.  Also documented new 
      FileUpload configs and $Request->FileUpload collection.
      Documented StatScripts.
    
     +StatScripts setting which if set to 0 will not reload
      includes, global.asa, or scripts when changed.
    
     +FileUpload file handles cleanup at garbage collection
      time so developer does not have to worry about lazy coding
      and undeffing filehandles used in code.  Also set 
      uploaded filehandles to binmode automatically on Win32 
      platforms, saving the developer yet more typing.
    
     +FileUploadTemp setting, default 0, if set will leave
      a temp file on disk during the request, which may be 
      helpful for processing by other programs, but is also
      a security risk in that others could potentially read 
      this file while the script is running. 
    
      The path to the temp file will be available at
      $Request->{FileUpload}{$form_field}{TempFile}.
      The regular use of file uploads remains the same
      with the <$filehandle> to the upload at 
      $Request->{Form}{$form_field}.
    
     +FileUploadMax setting, default 0, currently an 
      alias for $CGI::POST_MAX, which determines the 
      max size for a file upload in bytes.  
    
     +SessionQueryParse only auto parses session-ids
      into links when a session-id COOKIE is NOT found.
      This feature is only enabled then when a user has
      disabled cookies, so the runtime penalty of this
      feature won't drag down the whole site, since most
      users will have cookies turned on.   
    
     -StatINC & StatINCMatch will not undef Fnctl.pm flock 
      functions constants like O_RDWR, because the code references
      are not well trackable.  This would result in sporadic 500 server
      errors when a changed module was reloaded that imported O_* flock 
      functions from Fnctl.
    
     +SessionQueryParse & SessionQueryParseMatch
      settings that enable auto parsing session ids into 
      URLs for cookieless sessions.  Will pick up URLs in 
      <a href>, <area href>, <form action>, <frame src>,
      <iframe src>, <img src>, <input src>, <link href>
      $Response->Redirect($URL) and the first URL in 
      script tags like <script>*.location.href=$URL</script>
    
      These settings require that buffering be enabled, as
      Apache::ASP will parse through the buffer to parse the URLs.
    
      With SessionQueryParse on, it will just parse non-absolute
      URLs, but with SessionQueryParseMatch set to some server
      url regexp, like ^http://localhost , will also parse
      in the session id for URLs that match that.
    
      When testing, the performance hit from this parsing
      a script dropped from 12.5 hits/sec on my WinNT box
      to 11.7 hits per second for 1K of buffered output.
      The difference is .007 of my PII300's processing power
      per second.
    
      For 10K of output then, my guess is that this speed
      of script, would be slowed to 6.8 hits per second.
      This kind of performance hit would also slow a
      script running at 40 hits per second on a UNIX box
      to 31 hits/sec for 1K, and to 11 hits/sec for 10K parsed.
    
      Your mileage may vary and you will have to test the difference
      yourself.  Get yourself a valid URL with a session-id in
      it, and run it through ab, or Socrates, with SessionQuery
      turned on, and then with SessionQueryParse set to see 
      the difference.  SessionQuery just enables of session id
      setting from the query string but will not auto parse urls.
    
     -If buffering, Content-Length will again be set.
      It broke, probably while I was tuning in the past 
      couple versions.
    
     +UseStrict setting compiles all scripts including
      global.asa with "use strict" turned on for catching
      more coding errors.  With this setting enabled,
      use strict errors die during compilation forcing
      Apache::ASP to try to recompile the script until
      successful.
    
     -Object use in includes like $Response->Write() 
      no longer error with "use strict" programming.  
    
     +SessionQuery config setting with $Server->URL($url, { %params } ) 
      alpha API extensions to enable cookieless sessions.
    
     +Debugging not longer produces internal debugging
      by default.  Set to -1,-2 for internal debugging
      for Debug settings 1 & 2.
    
     +Both StateSerializer & StateDB can be changed 
      without affecting a live web site, by storing 
      the configurations for $Application & $Session 
      in an internal database, so that if $Session was
      created with SDBM_File for the StateDB (default),
      it will keep this StateDB setting until it ends.
    
     +StateSerializer config setting.  Default Data::Dumper,
      can also be set to Storable.  Controls how data is
      serialized before writing to $Application & $Session.
    
     +Beefed up the make test suite.
    
     +Improved the locking, streamlining a bit of the 
      $Application / $Session setup process.  Bench is up to 
      22 from 21 hits / sec on dev NT box.
    
     +Cut more fat for faster startup, now on my dev box 
      I get 44 hits per sec Apache::ASP vs. 48 Embperl 
      vs. 52 CGI via Apache::Registry for the HelloWorld Scripts.
    
     -Improved linking for the online site documentation, 
      where a few links before were bad.
    

    $VERSION = 0.17; $DATE="11/15/99";

     ++20%+ faster startup script execution, as measured by the 
      HelloWorld bench.  I cut a lot of the fat out of 
      the code, and is now at least 20% faster on startup 
      both with and without state.
    
      On my dev (NT, apache 1.3.6+mod_perl) machine, I now get:
    
    	42 hits per sec on Apache::ASP HelloWorld bench
    	46 hits per sec on Embperl (1.2b10) and
    	51 hits per sec for CGI Apache::Registry scripts  
    
      Before Apache::ASP was clocking some 31 hits per sec.
      Apache::ASP also went from 75 to 102 hits per second 
      on Solaris.
    
     +PerlTaintCheck On friendly.  This is mod_perl's way 
      of providing -T taint checking.  When Apache::ASP
      is used with state objects like $Session or $Application,
      MLDBM must also be made taint friendly with:
    
        $MLDBM::RemoveTaint = 1;
    
      which could be put in the global.asa.  Documented.
    
     +Added $Response->ErrorDocument($error_code, $uri_or_string) 
      API extension which allows for setting of Apache's error
      document at runtime.  This is really just a wrapper 
      for Apache->custom_response() renamed so it syncs with
      the Apache ErrorDocument config setting.  Updated
      documentation, and added error_document.htm example.
    
     =OrderCollections setting was added, but then REMOVED
      because it was not going to be used.  It bound 
      $Request->* collections/hashes to Tie::IxHash, so that data
      in those collections would be read in the order the 
      browser sent it, when eaching through or with keys.
    
     -global.asa will be reloaded when changed.  This broke
      when I optimized the modification times with (stat($file))[9]
      rather than "use File::stat; stat($file)->mtime"
    
     -Make Apache::ASP->Loader() PerlRestartHandler safe,
      had some unstrict code that was doing the wrong thing.
    
     -IncludesDir config now works with DynamicIncludes.
    
     +DebugBufferLength feature added, giving control to 
      how much buffered output gets shown when debugging errors.
    
     ++Tuning of $Response->Write(), which processes all
      static html internally, to be almost 50% faster for
      its typical use, when BufferingOn is enabled, and 
      CgiHeaders are disabled, both being defaults.
    
      This can show significant speed improvements for tight
      loops that render ASP output.
    
     +Auto linking of ./site/eg/ text to example scripts
      at web site.
    
     +$Application->GetSession($session_id) API extension, useful
      for managing active user sessions when storing session ids
      in $Application.  Documented.
    
     -disable use of flock() on Win95/98 where it is unimplemented
    
     -@array context of $Request->Form('name') returns
      undef when value for 'name' is undefined.  Put extra
      logic in there to make sure this happens.
    

    $VERSION = 0.16; $DATE="09/22/99";

     -$Response->{Buffer} and PerlSetVar BufferingOn
      configs now work when set to 0, to unbuffer output,
      and send it out to the web client as the script generates it.
    
      Buffering is enabled by default, as it is faster, and
      allows a script to error cleanly in the middle of execution.  
    
     +more bullet proof loading of Apache::Symbol, changed the 
      way Apache::ASP loads modules in general.  It used to 
      check for the module to load every time, if it hadn't loaded
      successfully before, but now it just tries once per httpd,
      so the web server will have to be restarted to see new installed
      modules.  This is just for modules that Apache::ASP relies on.
    
      Old modules that are changed or updated with an installation
      are still reloaded with the StatINC settings if so configured. 
    
     +ASP web site wraps <font face="courier new"> around <pre>
      tags now to override the other font used for the text
      areas.  The spacing was all weird in Netscape before
      for <pre> sections.
    
     -Fixed Content-Length calculation when using the Clean
      option, so that the length is calculated after the HTML
      is clean, not before.  This would cause a browser to 
      hang sometimes.
    
     +Added IncludesDir config option that if set will also be
      used to check for includes, so that includes may easily be
      shared between applications.  By default only Global and 
      the directory the script is in are checked for includes.
    
      Also added IncludesDir as a possible configuration option
      for Apache::ASP->Loader()
    
     -Re-enabled the Application_OnStart & OnEnd events, after
      breaking them when implementing the AllowApplicationState
      config setting.
    
     +Better pre-fork caching ... StatINC & StatINCMatch are now 
      args for Apache::ASP->Loader(), so StatINC symbols loading
      may be done pre-fork and shared between httpds.  This lowers
      the child httpd init cost of StatINC.  Documented.
    
     +Made Apache::ASP Basic Authorization friendly so authentication
      can be handled by ASP scripts.  If AuthName and AuthType Apache
      config directives are set, and a $Response->{Status} is set to 
      401, a user will be prompted for username/password authentication
      and the entered data will show up in ServerVariables as:
        $env = $Request->ServerVariables
        $env->{REMOTE_USER} = $env->{AUTH_USER} = username
        $env->{AUTH_PASSWD} = password
        $env->{AUTH_NAME}   = your realm
        $env->{AUTH_TYPE}   = 'Basic'
    
      This is the same place to find auth data as if Apache had some 
      authentication handler deal with the auth phase separately.
    
     -MailErrorsTo should report the right file now that generates
      the error.
    

    $VERSION = 0.15; $DATE="08/24/1999";

     --State databases like $Session, $Application are 
      now tied/untied to every lock/unlock triggered by read/write 
      access.  This was necessary for correctness issues, so that 
      database file handles are flushed appropriately between writes
      in a highly concurrent multi-process environment.
    
      This problem raised its ugly head because under high volume, 
      a DB_File can become corrupt if not flushed correctly.  
      Unfortunately, there is no way to flush SDBM_Files & DB_Files 
      consistently other than to tie/untie the databases every access.
    
      DB_File may be used optionally for StateDB, but the default is
      to use SDBM_File which is much faster, but limited to 1024 byte
      key/value pairs.
    
      For SDBM_Files before, if there were too many concurrent 
      writes to a shared database like $Application, some of the 
      writes would not be saved because another process
      might overwrite the changes with its own.
    
      There is now a 10 fold performance DECREASE associated
      with reading from and writing to files like $Session 
      and $Application.  With rough benchmarks I can get about
      100 increments (++) now per second to $Session->{count}, where
      before I could get 1000 increments / second.  
    
      You can improve this if you have many reads / writes happening
      at the same time, by placing locking code around the group like
      
    	$Session->Lock();
    	$Session->{count}++;
    	$Session->{count}++;
    	$Session->{count}++;
    	$Session->UnLock();	
    
      This method will reduce the number of ties to the $Session database
      from 6 to 1 for this kind of code, and will improve the performance
      dramatically.
    
      Also, instead of using explicit $Session locking, you can 
      create an automatic lock on $Session per script by setting
      SessionSerialize in your config to 1.  The danger here is
      if you have any long running scripts, the user will have
      to wait for it to finish before another script can be run.
    
      To see the number of lock/unlocks or ties/unties to each database
      during a script execution, look at the last lines of debug output
      to your error log when Debug is set to 1.  This can help you
      performance tweak access to these databases.
    
     +Updated documentation with new config settings and
      API extensions.
    
     +Added AllowApplicationState config option which allows
      you to leave $Application undefined, and will not
      execute Application_OnStart or Application_OnEnd.
      This can be a slight performance increase of 2-3% if
      you are not using $Application, but are using $Session.
    
     +Added $Session->Lock() / $Session->UnLock() API routines
      necessary additions since access to session is not
      serialized by default like IIS ASP.  Also prompted
      by change in locking code which retied to SDBM_File
      or DB_File each lock.  If you $Session->Lock / UnLock
      around many read/writes, you will increase performance.
    
     +Added StateCache config which, if set will cache
      the file handle locks for $Application and an internal 
      database used for tracking $Session info.  This caching can 
      make an ASP application perform up to 10% faster,
      at a cost of each web server process holding 2 more 
      cached file handles open, per ASP application using
      this configuration.  The data written to or read from
      these state databases is not cached, just the locking 
      file handles are held open.
    
     -Added in much more locking in session manager 
      and session garbage collector to help avoid collisions
      between the two.  There were definite windows that the
      two would collide in, during which bad things could 
      happen on a high volume site.
    
     -Fixed some warnings in DESTROY and ParseParams()
    

    $VERSION = 0.14; $DATE="07/29/1999";

     -CGI & StatINC or StatINCMatch would have bad results
      at times, with StatINC deleting dynamically compiled
      CGI subroutines, that were imported into other scripts
      and modules namespaces.
    
      A couple tweaks, and now StatINC & CGI play nice again ;)
      StatINCMatch should be safe to use in production with CGI. 
      This affects in particular environments that use file upload, 
      since CGI is loaded automatically by Apache::ASP to handle 
      file uploads.
    
      This fix should also affect other seemingly random 
      times when StatINC or StatINCMatch don't seem to do 
      the right thing.
    
     +use of ASP objects like $Response are now "use strict"
      safe in scripts, while UniquePackages config is set.
    
     +Better handling of "use strict" errors in ASP scripts.
      The error is detected, and the developer is pointed to the 
      Apache error log for the exact error.  
    
      The script with "use strict" errors will be recompiled again.  Its seems 
      though that "use strict" will only throw its error once, so that a script 
      can be recompiled with the same errors, and work w/o any use strict
      error messaging.
    

    $VERSION = 0.12; $DATE="07/01/1999";

     -Compiles are now 10 +times faster for scripts with lots of big
      embedded perl blocks <% #perl %>
    
      Compiles were slow because of an old PerlScript compatibility
      parsing trick where $Request->QueryString('hi')->{item}
      would be parsed to $Request->QueryString('hi') which works.
      I think the regexp that I was using had O(n^2) characteristics
      and it took a really big perl block to 10 +seconds to parse
      to understand there was a problem :(
    
      I doubt anyone needed this compatibility, I don't even see
      any code that looks like this in the online PerlScript examples,
      so I've commented out this parsing trick for now.  If you 
      need me to bring back this functionality, it will be in the 
      form of a config setting.
    
      For information on PerlScript compatibility, see the PerlScript
      section in the ASP docs.
    
     -Added UniquePackages config option, that if set brings back 
      the old method of compiling each ASP script into its own
      separate package.  As of v.10, scripts are compiled by default
      into the same package, so that scripts, dynamic includes & global.asa
      can share globals.  This BROKE scripts in the same ASP Application
      that defined the same sub routines, as their subs would redefine
      each other.  
    
      UniquePackages has scripts compiled into separate perl packages,
      so they may define subs with the same name, w/o fear of overlap.
      Under this settings, scripts will not be able to share globals.  
    
     -Secure field for cookies in $Response->Cookies() must be TRUE to 
      force cookie to be secure.  Before, it just had to be defined, 
      which gave wrong behavior for Secure => 0. 
    
     +$Response->{IsClientConnected} set to one by default.  Will
      work out a real value when I upgrade to apache 1.3.6.  This
      value has no meaning before, as apache aborts the perl code
      when a client drops its connection in earlier versions.
    
     +better compile time debugging of dynamic includes, with 
      Debug 2 setting
    
     +"use strict" friendly handling of compiling dynamic includes
      with errors
    

    $VERSION = 0.11; $DATE="06/24/1999";

     +Lots of documentation updates
    
     +The MailHost config option is the smtp server used for 
      relay emails for the Mail* config options.
    
     +MailAlertTo config option used for sending a short administrative
      alert for an internal ASP error, server code 500.  This is the 
      compliment to MailErrorsTo, but is suited for sending a to a
      small text based pager.  The email sent by MailErrorsTo would
      then be checked by the web admin for quick response & debugging
      for the incident. 
    
      The MailAlertPeriod config specifies the time in minutes during 
      which only one alert will be sent, which defaults to 20.
    
     +MailErrorsTo config options sends the results of a 500 error
      to the email address specified as if Debug were set to 2.
      If Debug 2 is set, this config will not be on, as it is
      for production use only.  Debug settings less than 2 only 
      log errors to the apache server error log.
    
     -StatINCMatch / StatINC can be used in production and work
      even after a server graceful restart, which is essential for 
      a production server.
    
     -Content-Length header is set again, if BufferingOn is set, and
      haven't $Response->Flush()'d.  This broke when I introduce
      the Script_OnEnd event handler.
    
     +Optimized reloading of the GlobalPackage perl module upon changes, 
      so that scripts and dynamic includes don't have to be recompiled.  
      The global.asa will still have to be though.  Since we started
      compiling all routines into a package that can be named with
      GlobalPackage, we've been undeffing compiled scripts and includes
      when the real GlobalPackage changed on disk, as we do a full sweep
      through the namespace.  Now, we skip those subs that we know to 
      be includes or scripts. 
    
     -Using Apache::Symbol::undef() to undefine precompiled scripts
      and includes when reloading those scripts.  Doing just an undef() 
      would sometimes result in an "active subroutine undef" error.
      This bug came out when I started thrashing the StatINC system
      for production use.
    
     +StatINCMatch setting created for production use reloading of
      perl modules.  StatINCMatch allows StatINC reloading of a
      subset of all the modules defined in %INC, those that match
      $module =~ /$StatINCMatch/, where module is some module name
      like Class/Struct.pm
    
     +Reoptimized pod comment parsing.  I slowed it down to sync
      lines numbers in the last version, but found another corner I could cut.
    

    $VERSION = 0.10; $DATE="05/24/1999";

     += improvement; - = bug fix
    
     +Added index.html file to ./eg to help people wade through
      the examples.  This one has been long overdue.
    
     +Clean config option, or setting $Response->{Clean} to 1 - 9,
      uses HTML::Clean to compress text/html output of ASP scripts.
      I like the Clean 1 setting which is lightweight, stripping 
      white space for about 10% compression, at a cost of less than
      a 5% performance penalty.
    
     +Using pod style commenting no longer confuses the line
      numbering.  ASP script line numbers are almost exactly match
      their compiled perl version, except that normal inline includes
      (not dynamic) insert extra text which can confuse line numbering.
      If you want perl error line numbers to entirely sync with your 
      ASP scripts, I would suggest learning how to use dynamic includes,
      as opposed to inline includes.
    
     -Wrapped StatINC reloading of libs in an eval, and capturing
      error for Debug 2 setting.  This makes changing libs with StatINC
      on a little more friendly when there are errors. 
    
     -$Request->QueryString() now stores multiple values for the 
      same key, just as $Request->Form() has since v.07.  In
      wantarray() context like @vals = $Request->QueryString('dupkey'),
      @vals will store whatever values where associated with dupkey
      in the query string like (1,2) from: ?dupkey=1&dupkey=2
    
     +The GlobalPackage config directive may be defined
      to explicitly set the perl module that all scripts and global.asa
      are compiled into.
    
     -Dynamic includes may be in the Global directory, just like
      normal includes.
    
     +Perl script generated from asp scripts should match line
      for line, seen in errors, except when using inline (default) 
      includes, pod comments, or <% #comment %> perl comments, which 
      will throw off the line counts by adding text, removing
      text, or having an extra newline added, respectively.
    
     -Script_OnEnd may now send output to the browser.  Before
      $main::Response->End() was being called at the end of the
      main script preventing further output.
    
    ++All scripts are compiled as routines in a namespace uniquely
      defined by the global.asa of the ASP application.  Thus,
      scripts, includes, and global.asa routines will share
      all globals defined in the global.asa namespace.   This means
      that globals between scripts will be shared, and globals
      defined in a global.asa will be available to scripts.
    
      Scripts used to have their own namespace, thus globals
      were not shared between them.
    
     +a -o $output_dir switch on the ./cgi/asp script allows
      it to execute scripts and write their output to an output
      directory.  Useful for building static html sites, based on
      asp scripts.  An example use would be:
    
        asp -b -o out *.asp
    
      Without an output directory, script output is written to STDOUT
    

    $VERSION = 0.09; $DATE="04/22/1999";

     +Updated Makefile.PL optional modules output for CGI & DB_File
    
     +Improved docs on $Response->Cookies() and $Request->Cookies()
    
     +Added PERFORMANCE doc to main README, and added sub section
      on precompiling scripts with Apache::ASP->Loader()
    
     +Naming of CompileIncludes switched over to DynamicIncludes 
      for greater clarity.
    
     +Dynamic includes can now reference ASP objects like $Session
      w/o the $main::* syntax.  These subs are no longer anonymous
      subs, and are now compiled into the namespace of the global.asa package.
    
     +Apache::ASP->Loader() precompiles dynamic includes too. Making this work
      required fixing some subtle bugs / dependencies in the compiling process.
    
     +Added Apache::ASP->Loader() similar to Apache::RegistryLoader for
      precompiling ASP scripts.  Precompile a whole site at server 
      startup with one function call.
    
     +Prettied the error messaging with Debug 2.
    
     +$Response->Debug(@args) debugging extension, which
      allows a developer to hook into the module's debugging,
      and only have @args be written to error_log when Debug is greater
      than 0.
    
     -Put write locking code around State writes, like $Session
      and $Application.  I thought I fixed this bug a while ago.
    
     -API change: converted $Session->Timeout() and $Session->SessionID() 
      methods into $Session->{Timeout} and $Session->{SessionID} properties.
      The use of these properties as methods is deprecated, but 
      backwards compatibility will remain.  Updated ./eg/session.asp
      to use these new properties.
    
     +Implemented $Response->{PICS} which if set sends out a PICS-Label
      HTTP header, useful for ratings.
    
     +Implemented $Response->{CacheControl} and $Response->{Charset} members.
      By default, CacheControl is 'private', and this value gets sent out
      every request as HTTP header Cache-Control.  Charset appends itself
      onto the content type header.
    
     +Implemented $Request->BinaryRead(), $Request->{TotalBytes},
      documented them, and updated ./eg/form.asp for an example usage. 
    
     +Implemented $Response->BinaryWrite(), documented, and created
      and example in ./eg/binary_write.htm
    
     +Implemented $Server->MapPath() and created example of its use
      in ./eg/server.htm
    
     -$Request->Form() now reads file uploads correctly with 
      the latest CGI.pm, where $Request->Form('file_field') returns
      the actual file name uploaded, which can be used as a file handle
      to read in the data.  Before, $Request->Form('file_field') would
      return a glob that looks like *Fh::filename, so to get the file
      name, you would have to parse it like =~ s/^\*Fh\:\://,
      which you no longer have to do.  As long as parsing was done as
      mentioned, the change should be backwards compatible.
    
     +Updated  +enhanced documentation on file uploads.  Created extra
      comments about it as an FAQ, and under $Response->Form(), the latter
      being an obvious place for a developer to look for it.
    
     +Updated ./eg/file_upload.asp to show use of non file form data, 
      with which we had a bug before.
    
     +Finished retieing *STDIN to cached STDIN contents, so that 
      CGI input routines may be used transparently, along side with
      use of $Request->Form()
    
     +Cleaned up and optimized $Request code
    
     +Updated documentation for CGI input & file uploads.  Created
      file upload FAQ.
    
     +Reworked ./eg/cgi.htm example to use CGI input routines
      after doing a native read of STDIN.
    
     ++Added dynamic includes with <!--include file=file args=@args-->
      extension.  This style of include is compiled as an anonymous sub & 
      cached, and then executed with @args passed to the subroutine for 
      execution.  This is include may also be rewritten as a new API 
      extension: $Response->Include('file', @args)
    
     +Added ./eg/compiled_includes.htm example documenting new dynamic includes.
    
     +Documented SSI: native file includes, and the rest with filtering 
      to Apache::SSI
    
     +Turned the documentation of Filter config to value of Off so 
      people won't cut and paste the On config by default.
    
     +Added SecureSession config option, which forces session cookie to 
      be sent only under https secured www page requests.
    
     +Added StateDB config option allows use of DB_File for $Session, since 
      default use of SDBM_File is limited.  See StateDB in README.
    
     +file include syntax w/o quotes supported like <!--#include file=test.inc-->
    
     +Nested includes are supported, with includes including each other.
      Recursive includes are detected and errors out when an include has been 
      included 100 times for a script.  Better to quit early than 
      have a process spin out of control. (PORTABLE ? probably not)
    
     +Allow <!--include file=file.inc--> notation w/o quotes around file names
    
     -PerlSetEnv apache conf setting now get passed through to 
      $Request->ServerVariables. This update has ServerVariables 
      getting data from %ENV instead of $r->cgi_env
    
     +README FAQ for PerlHandler errors
    

    $VERSION = 0.08; $DATE="02/06/1999";

     ++SSI with Apache::Filter & Apache::SSI, see config options & ./eg files
      Currently filtering only works in the direction Apache::ASP -> Apache::SSI,
      will not work the other way around, as SSI must come last in a set of filters
    
     +SSI file includes may reference files in the Global directory, better 
      code sharing
    
     - <% @array... %> no longer dropped from code.
    
     +perl =pod comments are stripped from script before compiling, and associated
      PodComments configuration options.
    
     +Command line cgi/asp script takes various options, and allows execution
      of multiple asp scripts at one time.  This script should be used for
      command line debugging.  This is also the beginning of building
      a static site from asp scripts with the -b option, suppressing headers.
    
     +$Response->AddHeader('Set-Cookie') works for multiple cookies.
    
     -$Response->Cookies('foo', '0') works, was dropping 0 because of boolean test
    
     -Fixed up some config doc errors.
    

    $VERSION = 0.07; $DATE="01/20/1999";

     -removed SIG{__WARN__} handler, it was a bad idea.
    
     -fixes file locking on QNX, work around poor flock porting
    
     +removed message about Win32::OLE on UNIX platforms from Makefile.PL
    
     -Better lock garbage collection.  Works with StatINC seamlessly.
    
     -Multiple select forms now work in array context with $Response->Form()
    	@values = $Response->Form('multi');
    
     -Better CGI.pm compatibility with $r->header_out('Content-type'),
      improved garbage collection under modperl, esp. w/ file uploads
    

    $VERSION = 0.06; $DATE="12/21/1998";

     +Application_OnStart & Application_OnEnd event handlers support.
    
     -Compatible with CGI.pm 2.46 headers() 
    
     -Compatible with CGI.pm $q = new CGI({}), caveat: does not set params 
    
     +use strict; followed by use of objects like $Session is fine.
    
     -Multiple cookies may be set per script execution.
    
     +file upload implemented via CGI.pm
    
     ++global.asa implemented with events Session_OnStart and Session_OnEnd
      working appropriately.
    
     +StateDir configuration directive implemented.
      StateDir allows the session state directory to be specified separately 
      from the Global directory, useful for operating systems with caching file 
      systems.
    
     +StateManager config directive.  StateManager specifies how frequently
      Sessions are cleaned up, with 10 (default) meaning that old Sessions
      will be cleaned up 10 times per SessionTimeout period (default 20 minutes).
    
     +$Application->SessionCount() implemented, non-portable method.
    	: returns the number of currently active sessions
    
     -STOP button fix.  Users may hit STOP button during script 
      execution, and Apache::ASP will cleanup with a routine registered
      in Apache's $r->register_cleanup.  Works well supposedly.
    
     +PerlScript compatibility work, trying to make ports smoother.
    	: Collection emulator, no ->{Count} property
    	: $.*(.*)->{Item} parsed automatically, 
    	  shedding the ->{Item} for Collection support (? better way ?)
    	: No VBScript dates support, just HTTP RFC dates with HTTP::Date
    	: Win32::OLE::in not supported, just use "keys %{$Collection}"	
    
     +./cgi/asp script for testing scripts from the command line
    	: will be upgraded to CGI method of doing asp
    	: is not "correct" in anyway, so not documented for now
    	  but still useful
    
     +strips DOS carriage returns from scripts automatically, so that
      programs like FrontPage can upload pages to UNIX servers
      without perl choking on the extra \r characters.
    

    $VERSION = 0.05; $DATE="10/19/1998";

     +Added PERFORMANCE doc, which includes benchmarks  +hints.
    
     +Better installation warnings and errors for other modules required. 
    
     -Turned off StatINC in eg/.htaccess, as not everyone installs Devel::Symdump
    
     -Fixed AUTOLOAD state bug, which wouldn't let you each through state
      objects, like %{$Session}, or each %$Session, (bug introduced in v.04)
    
     +Parses ASP white space better.  HTML output matches author's intent
      by better dealing with white space surrounding <% perl blocks %>
    
     -Scalar insertion code <%=$foo%> can now span many lines.
    
     +Added include.t test script for includes.
    
     +Script recompiles when included files change.
    
     +Files can be included in script with 
      SSI <!--#include file="filename"--> syntax, needs to be
      done in ASP module to allow compilation of included code and html 
      into script.  Future chaining with Apache::SSI will allow static 
      html includes, and other SSI directives
    

    $VERSION = 0.04; $DATE="10/14/1998";

     +Example script eg/cgi.htm demonstrating CGI.pm use for output.
    
     +Optimized ASP parsing, faster and more legible executing code
    	: try 'die();' in code with setting PerlSetVar Debug 2
    
     +Cleaned up code for running with 'use strict'
    
     -Fixed directory handle leak on Solaris, from not closing after opendir()
    
     +StatINC overhaul.  StatINC setting now works as it should, with 
      the caveat that exported functions will not be refreshed.
    
     +NoState setting optimization, disallows $Application & $Session
    
     +$Application->*Lock() functions implemented
    
     -SoftRedirect setting for those who want scripts to keep running
      after a Redirect()
    
     +SessionSerialize setting to lock session while script is running
    	: Microsoft ASP style session locking
    	: For a session, scripts execute one at a time 
    	: NOT recommended use, please see note.
    
     -MLDBM can be used for other things without messing up internal use
    	: before if it was used with different DB's and serializers,
    	  internal state could be lost.
    
     --State file locking.  Corruption worries, and loss of data no more.
    
     +CGI header support, developer can use CGI.pm for *output*, or just print()
    	: print "Set-Cookie: test=cookie\n", and things will just work
    	: use CGI.pm for output
    	: utilizes $r->send_cgi_header(), thanks Doug!
    
     +Improved Cookie implementation, more flexible and complete
    	- Domain cookie key now works
    	: Expire times now taken from time(), and relative time in sec
    	: Request->Cookies() reading more flexible, with wantarray()
    	  on hash cookie values, %hash = $Request->Cookie('test');
    
     -make test module naming correction, was t.pm, now T.pm for Unix
    
     +POD / README cleanup, formatting and HTML friendly.
    

    $VERSION = 0.03; $DATE="09/14/1998";

     +Installation 'make test' now works
    
     +ActiveX objects on Win32 implemented with $Server->CreateObject() 
    
     +Cookies implemented: $Response->Cookies() & $Request->Cookies()
    
     -Fixed $Response object API, converting some methods to object members.
      Deprecated methods, but backwards compatible.
    
     +Improved error messaging, debug output
    
     +$, influences $Response->Write(@strings) behavior
    
     +perl print() works, sending output to $Response object
    
     +$Response->Write() prints scalars, arrays, and hashes.  Before only scalars.
    
     +Begin implementation of $Server object.
    
     +Implemented $Response->{Expires} and $Response->{ExpiresAbsolute}
    
     +Added "PerlSetVar StatINC" config option
    
     +$0 is aliased to current script filename
    
     +ASP Objects ($Response, etc.) are set in main package
      Thus notation like $main::Response->Write() can be used anywhere.
    

    $VERSION = 0.02; $DATE="07/12/1998";

     ++Session Manager, won't break under denial of service attack
    
     +Fleshed out $Response, $Session objects, almost full implementation.
    
     +Enormously more documentation.
    
     -Fixed error handling with Debug = 2.
    
     -Documentation fixed for pod2man support.  README now more man-like.
    
     -Stripped \r\n dos characters from installation files
    
     -755 mode set for session state directory when created
    
     -Loads Win32/OLE properly, won't break with UNIX
    

    $VERSION = 0.01; $DATE="06/26/1998";

     Syntax Support
     --------------
     Initial release, could be considered alpha software.
     Allows developers to embed perl in html ASP style.
    
     <!-- sample here -->
     <html>
     <body>
     <% for(1..10) { %>
     	counting: <%=$_%> <br>
     <% } %>
     </body>
     </html>
    
     ASP Objects
     -----------
     $Session, $Application, $Response, $Request objects available
     for use in asp pages.
    
     $Session & $Application data is preserved using SDBM files.
    
     $Session id's are tracked through the use of cookies.
    
     Security
     --------
     Timeouts any attempt to use a session id that doesn't already 
     exist.  Should stop hackers, since there is no wire speed guessing
     cookies.
    
     
    Apache-ASP-2.63/site/cine.gr.gif0000755000175000017500000000745311721310312014337 0ustar jobjobGIF89a‡#÷ÿÿÿÿ!!!)))RRRZZZccckkksss{{{„„„ŒŒŒÆÆÆÎÎÎÖÖÖÞÞÞçççïïï÷÷÷÷ï”ƵµÞÆÆ{kk1))÷ÎÎcRR½œœç½½ÞµµJ))Ækkç{{ŒBB­JJÎRR­BBŒ!Rcs„”¥­µÆÖÖ1)¥91Î)­Ö„{”ÞÞ­¥Þ¥œÖœ”Þ{k½ZJÆ!B1Ö!µcRïZ9½)µ!Þ)÷)ïÎÆç¥”Ö{c1Æ9Rµ{kç”{ÆkR­9çBJÖ1Þ1絥Ɣ„Þc9Æ„k½cBÞsJïZ!ÎJ„)¥1Æ9µ1ïÆµ„1µBÖBçBÖŒkïk1ÖR1Ö”sÖ{JÖsB½Rk)ÎR÷Z÷Rﵔ΄Zk1œBc)µBçR½{RÞk!çcÞZ)÷Æ¥Þ­Œ÷sÆRÞ”ZÞ„BÖs)ÆcïŒ9Þ{)Æk!Þs½ZÞk÷sk1{9ïkÆkÖkçεï”9„Jï„ÖŒ9ÞŒ1”Z¥ZÆk÷„çŒ!ï”!J)Z1kBÿ”Ö{ç„Þ”)÷”µ{ÿ­!֌ޔ΄ÿ¥„!„Z眜sç¥Ö”ï¥÷­µŒ)Μ!ΜÿµÆœ)kRÆœÿÆJ9ïµÞµ!­ŒÿÎ!çµÿÆÎ­!ç½ÖµÖµZJÿÞïÎ÷ÖïÖ1çÎÿÞÿïÿ÷)ÿ÷ÿÿÖÿÿµÿÿ­ÿÿœÿÿŒÿÿkÿÿZÿÿJÿÿBÿÿ)ÿÿÿÿ)1)BRZçï÷99Bïçï½µ½­¥­¥œ¥RJRJBJB9B9191)191B)9÷ÞçïÖÞΥ­µŒ”ï½Æ÷½ÆÆ”œÎ„ŒÆ19”!)Æ)1ÀÀÀ!ùÿ,‡#@ÿ ð®Ý»ݵ+€€;wDˆ°àv(¨cà€ d¤ð€ /0HçqÂÆŽKžôˆŽ: `qv˜XqaEvu¥X0\C… }.Šô¨»®úÛºµœƒt { lÙ°b¨3ÀÕ_9 Ì#ÒâÅIƾubÀ„(ÄL¸°a´]̸±ãÇ#û+ €«˜%s%À®œ;üÁ3ÄLÚ§{‡ãn1…*Ó U%R‘?Ì‘Án(>Ÿb[/ôT1.®•éÐ6$€µz³’¬…Ü2† àÑŸâš&ÉnŽŸAbäJÚ ÿqn·dGð"5-`'só‡c7¿ÔIo/êËp— àjpàÑá>µŽ,î ˜¬nAdŽT J `€…d:&Í–lá½nvS€u0<âÒéóŽWeç2mù›22rc0C•b P©¸H`¥&Þ`Î`ñ%Ó…ž?pËj¦®Û%aÄe†LÖ¢D¢/ ãàû."‹AÀGŽÇbäå4iÞXà‚#|­¨Åøñ¿ àP#L‰Mü5ç×¥7}€–Ìd&+9y hË8(Àƒ á  ŒGâB"° q©€>ôñ½ˆØBÐÁ ™ÿ+wðE'ªà€! A òc"¼Žép@K“  Žé±ƒ²Ð:ô¡ú‘kq ¬AÌ0 `04ˆaq ^„?¸âŽ cªƒ+b:ÛÀE bá oLƒ“ÀCùô¼½ŽŽ ÓÑÁC Ñp†þ÷>4ÙÀ@! p˜" (-v1Páß †@ c<Â ëØ§?î0ˆA˜(˜ÅÌ cBmlÿ@„y ÛͰ£´M{Œ;>dÏÊÄC€ ³Ã™ãBÄG(â5‰xŵ#5ÐÁWx3d¡z`8ØÔåQéÿàÓ(˜ñ \ˆñ]Óˆ¿û¼:à†wL8 €¤-« s†)ÜPyP@jƒ)^¡‰yl»°E?Ð! 2 ƒ1‚aˆ{1‚ J~roð"Uà7ºá !Œâ‚ÇHÐÌQ„ºv»¬È»Þ÷.€¼ÍŽ|úÛQ‹F#‚¬…öqYÈ÷Àô ‡ðQ»´È ‡= Â¨ØÅVP,ÈaeðGdF³oh£ÖàòðŒiLBîs72äpqFíDhGÑÊÁ˸`€[pC&N±"ü/dŽ‹<0ÀlyŒ@$ø^˜?Ð>"2ÿ ‡StãgåKæNóÅ„'pj_û Ž˜ƒO²½¥ÓŠä;äãA ßÀ —À~Ž¡{\1FKŒ#$‡#ü×½$>w  4à B ©‡€¡{Àc°8r²7…:~3¨;+R4M0 O4¢/6˜,iÒMsƒ:¨ƒ|‚b²[d£>¯ò%¼9íT4í1"Kã7u³ ä`YÐ¥Z˜‚ò~¡608À#€8²8å°ãb“¡ñ6aB%RR4MòZ“&b†¸²%£Ó!˜3eåî!!` ð*juONã«óo¢rWV y w>B 2' ‰©ò(~a:p(ð%ò)å 5– WRˆnO·dOëP4í g%åtKý”Zª‚ïåˆP;sá h„]³ÐÐ8e˜Bô@PHbç .V§3ðg…@áÖ`P4Ø@ɨ,¥(`K1ÀUãu?wS°Dˆ £ · Ä‘éØB0ujs7D˜õ˜k*Ô;Öð Á õô‚i`1“Ð(ÞóXh‘jàŽÞCga@¸@Þ¦!Äâ?-yh¸3tÿ’à‚`-N"vW‘¯â–A+ðti’JÑ3OQ”pÙ”0“8ã(^B`Âm+FW£B=ë€ñ ;3f;gcÀ)ïP<Þócqt(GFfÀcó±d[–9bs/æV|if³Ò&’C+ àÓããƒ:]rbéCW›s8€fh!ï°‰B^ €#¶ïàŽò  @’dÑC¡ôÐ^F&³då tÉïP_ f_´ íp›‹‚O–uWǶ™ Йœb _™®¢a¦V:¯äŽ€Ñé=°­ƒ™ï(;Apache-ASP-2.63/site/webtimelogo.jpg0000755000175000017500000001101611721310312015330 0ustar jobjobÿØÿàJFIFHHÿí~Photoshop 3.08BIMíHH8BIMó8BIM 8BIM' 8BIMõH/fflff/ff¡™š2Z5-8BIMøpÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿèÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿèÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿèÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿè8BIM@@8BIM € €€òÿØÿàJFIFHHÿþ'File written by Adobe Photoshop¨ 4.0ÿîAdobed€ÿÛ„            ÿÀ €"ÿÝÿÄ?   3!1AQa"q2‘¡±B#$RÁb34r‚ÑC%’Sðáñcs5¢²ƒ&D“TdE£t6ÒUâeò³„ÃÓuãóF'”¤…´•ÄÔäô¥µÅÕåõVfv†–¦¶ÆÖæö7GWgw‡—§·Ç×ç÷5!1AQaq"2‘¡±B#ÁRÑð3$bár‚’CScs4ñ%¢²ƒ&5ÂÒD“T£dEU6teâò³„ÃÓuãóF”¤…´•ÄÔäô¥µÅÕåõVfv†–¦¶ÆÖæö'7GWgw‡—§·ÇÿÚ ?îúI¶¬ŒÎšòçý–ÏV‡8’} ÷[@ÜïwèŸëcÿÖU/¬BæçaÑUΩÝF1ïhs‡²·¶ê­nÓ¶·:Çý—þ×T>¹}ŸíØÞ¯¥>‰Þ¶øßßìÞÏK÷7þzÊÄû'Ù³£ìñè·vÿ´ÌzŒú3îÿ‹ôÿ OdŒE‚ež“Åÿ;ÓÃýï[ßeß^-¹WÏ¥ŽÂ÷É Özå®Ç˳䌻ò-¯'.Úq,,yu·Q s³Ñ¡–{?‘ì­a3ì~£?™Íú_jŽGÒ]×CwOõv7fß縚¿›û7ø?øÄ¬ö)ˆÓŠ$“ókÃñáú_ÜkUÓ¬²ÖTpºÍAî 6ºðZÙü÷ oµ[ê])¸‚Œ*Ævm—^ÁVC™f¯Ç©í3¹Ž¯kýOýoùÕͱÁÿìÒ±gÙ?gâÎÈõ2"~ÓÑ»Òüÿøíÿð~ŸøD,ö—òÿ wkçÅ_þ’oýƒ+ÿ+z¿þÅÿ±ZÁ4»&¬óp²§_^8p³!øÃo¹¹×üç¥üë=ÿñKŸýKþÿf—MõwÑÿ›ùû=›lÝ·ÕÛôý'Õý7ý´'±D£ J2Óô?ôH$¡øâáÙEÖO!¦Çšn&÷ú5¬c¿Óÿ ÿý*¥EOÜüñ™—•k·>Á}m“ù•W¢©Ÿ˜“è~Ìé~¤ú{Ù·Ðõ·ÿ5oôOCõÿñ¿à=TÃìÿzŸû8—dÖ²£Zþoú?ôtU‚ì£eÖÛ‘s=llZ)È>•os›^ߥéúž•ž½n÷úßð_£Vqjqûòqi½†‹Ûml&ÏÐãÞǸBú¤ÿ OóŸÍÕmU°>Ŷ޴}–½¿bûVèõ/þsÓÿþ‡Ôý'«ö„l¿°ú:}º}J£ílô¿œgÓÝíÝþ‹þÓKè´ÄPõiü¿ªÇ¥æäR×ãŠ_ÐjÝYú7¶Òë>›=O¥å`Óc¬a®ïfÓöFßu³?ö¢€ÂÜíúi°þñŸÓ7zŽþö¿F}G5ùŸ×üÏSÔThû&êçì›w¾~Ïöµ}#üÞÏÒîGTzzñDÿç=%G ÏP½®¶·ÚÆzn/-­Ì®ÏÑô÷\ÏÑý5 º¾Ùfg«ëms]KÚH~‘ÎnÖ{ÔèþÓéÛw5~Ï´ú¾¼M;¶zŸ™þ“×÷ÿ5é"ôýŸnê›vnõÛ¿fíÓéWüþÿfÿøŸg¦–«}>%ÿÙ8BIMÿþ'File written by Adobe Photoshop¨ 4.0ÿîAdobed€ÿÛ„            ÿÀú"ÿÝÿÄ?   3!1AQa"q2‘¡±B#$RÁb34r‚ÑC%’Sðáñcs5¢²ƒ&D“TdE£t6ÒUâeò³„ÃÓuãóF'”¤…´•ÄÔäô¥µÅÕåõVfv†–¦¶ÆÖæö7GWgw‡—§·Ç×ç÷5!1AQaq"2‘¡±B#ÁRÑð3$bár‚’CScs4ñ%¢²ƒ&5ÂÒD“T£dEU6teâò³„ÃÓuãóF”¤…´•ÄÔäô¥µÅÕåõVfv†–¦¶ÆÖæö'7GWgw‡—§·ÇÿÚ ?éúv^VYËé™6ºÆú´’ã±Ý¥ßºº%Îýj¨ã_‡Õë̻ѼÜwÑÿ¿.‚Î¥„d3âœk„w)£õ‚¬›zMÇÇW}?¥aa žç3ÛûÍX?X/ê9=˜osC+½­$ZíÇGÒm{W[“mX¸ÖäÜG§Sçy€>Šâ~©RÛ:£‹˜øõ«oò üß꣋‡Œ|¢ÏŸîÅEíë¬hq’“æ•–×EVdZbºZ^óäÑ*{O—Þ¹ÿ®y¦žŸ^gô™Ž÷Ú¶ûþs¶¦€I¡¹*sqzŽ~GDêù϶ƽä:³¸ûvŒ«÷:0>¶äV-¦Ì‡1Ú‡zŽ?-kpþËõ7(±¡çïl*™+ë.K›‘‹c«¥ìfÆ6ÒÐc[ôgó”¦1”DD¸j:ˇQóÑBÙ\¿#þÝ?ù$pþµÒí¶Y ãÞãù ±ûëwú{?íãÿ’[?Wzw\Å{ÿh[¹„È~ó1fPWIÿèRWÕÌÅÇëç¤d2܇PçÙ[«ºëK‰ššçðˆ£}r<[wýºòK{ë€?±á%›šTqÔ8¢xz|òì®é.ÀÈé½ ¨\ü‹cé\l{‹`þcž}ŸKóQ?nŽŸÑ¨µÄ]›Ð1ë&I¥ŸÈj}_2™‰NÊ*ÞÊÁqkÏç6ÏQ¿ET§©u,–2ÊúV+Ú6~€ë´‰¼$Ê@ƵB5¤8]#«gVroÉ´:ÂL›ld“ûµ°ícU‹: ÄÆ»#;>êj­¤‹u„ƒù°×;ßîüÅ`u_¬@@é´Ç†ë?òy}S©c·©`ãŒ|«›Lnqp'óÃloæ£2r1‰ÐP_j¾®6.gQë-«')쵌 ­sª£ü.ÚÝï±ÿžµÇÕÌÞNU¤xzöÿä”r3ß‹Õ-ÃÀéØöm¡¶;vÿxÝù­*Çío¬ù]OùÖäQðŽ?z@qI_TXùY1¸Ù¶:Ì —~Šë\jyÿe÷zOUz­Íw\Ìcï;XÊMU}¤ã°Èý!Ú¯ý³¯e~ŠÞ›ŒæH´¿nŸÖb£fv.f.EØ4ú™—>‡íÔ°WôK${”uê¢8oê”éñû“wþI=uÑ}›lËŒéý½ÖIýÝ»ÂׯêÏOsâÈ$I[ýʧS¯£t›ñqò1Ùèd›o-—·`v5­üéN¨Dé+ÿ ®‘‹MÏ4u¶Lnoªlóœý«es¸}K¶—ôN˜û·†~ÚÚê¬ÿ¢¯ágõ‹ì'ºXN¥»Éÿ¥ B@ËQ°ëB tÒYyqôõ<¬S ©©¡ÄŸsÞ'e‘ôYýUO'ëYÆÄ³.Ì­•>ûõO·¸_UÖ¸}Þ×ÀþÁ(Ýo œŽ¥‰u·²—T×V÷5¥ÀŸs€qÝí_>$¢—¼>^-8+ä¯ÐàOGé>¥Smé—Òç†VúË]a #énwµbâàýcm n>cÍ! VX+#oæû¶¯I3 .ðø¿îT_~ûÖ¯û™oÝ_þEUÎéÝfÇcþÐÌö6Ðêýc[xìÈÙ¹ËÂÒR í_OZ¾õnR=Nû°rö^ðÁ}l,.!›šíÎj'ØþµÜË~êÿò+ÀR@pÖ¾Ýÿ†­_~8Z þ¹oÝ_þEgÕÒ¯˜­«2½õÜ÷ã9¯a›Ók$ís›û«ÄRGÓZ{^?:¾×߆Ö¨þ™oÝ_þEVê]3&óŒ:¶cê÷íu®c ƒ£wî}áI$*Ç·Å~Ÿ›ð•ö¾æÎ‰ÒËÇØ3ª7 W¾ënZxXßXqÞnK­¬v°5Æ?¯ízùå$%zñûwÿ;þb¼Ÿ Ÿ…[¾°;.Ëëmŵ‡P\ÝÃhö“¿Ü­ý`ǯ+¥ÙE–¶ŠÜæ—Xòo¹ðßs—ÎI&JýÃÃú?»¾¶§éN—S)ÃcöØËšAñj´¾aI/_»þ³‹þrº?ÿÙApache-ASP-2.63/site/sites.html0000644000175000017500000002641213252377727014361 0ustar jobjob Apache::ASP::Sites using
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
    % SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    SITES USING
    What follows is a list of public sites that are using Apache::ASP. If you use the software for your site, and would like to show your support of the software by being listed, please send your link to asp[at]perl.apache.org
    For a list of testimonials of those using Apache::ASP, please see the TESTIMONIALS section.
      PERSONiO Match
    
      gutscheinwurst.de - a German voucher community
    
      SalesJobs.com
    
      hanschur.de
    
      Webtist
    
      FreeLotto
    
      Hungarian TOP1000
    
      Hungarian Registry
    
      Kepeslap.com
    
      yourpostcardsite.com
    
      WebTime
    
      AlterCom, Advanced Web Hosting
    
      AmericanGamers.com
    
      ESSTECwebservices
    
      Alumni.NET
    
      Anime Wallpapers dot com
    
      Cine.gr
    
      Condo-Mart Web Service
    
      Discountclick.com
    
      HCST
    
      International Telecommunication Union
    
      Integra
    
      Money FM
    
      Motorsport.com
    
      MLS of Greater Cincinnati
    
      NodeWorks Link Checker
    
      OnTheWeb Services
    
      Prices for Antiques
    
      redhat.com | support
    
      Spotlight
    
      USCD Electrical & Computer Engineering
    
     
    Apache-ASP-2.63/site/testimonials.html0000644000175000017500000005010613252377730015734 0ustar jobjob Apache::ASP::Testimonials
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
    % TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    TESTIMONIALS
    Here are testimonials from those using Apache::ASP. If you use this software and would like to show your support please send your testimonial to Apache::ASP mailing list at asp[at]perl.apache.org and indicate that we can post it to the web site.
    For a list of sites using Apache::ASP, please see the SITES USING section.

    Red Hat WebTime
    Anime Wallpaper at Anime Cubed David Kulp
    gutscheinwurst.de MFM Commmunication Software, Inc.
    D. L. Fox Planet of Music
    HOSTING 321, LLC. Cine.gr
    Concept Online Ltd.  

    Red Hat

    
    
    We're using Apache::ASP on www.redhat.com. We find Apache::ASP very easy to use, and it's quick for new developers to get up to speed with it, given that many people have already been exposed to the ASP object model that Apache::ASP is based on.
    The documentation is comprehensive and easy to understand, and the community and maintainer have been very helpful whenever we've had questions.
      -- Tom Lancaster, Red Hat
    

    Anime Wallpaper at Anime Cubed

    Your suite has got our old CGI implementation beat, hands down. Our site is divided into two main areas, each run by a separate developer, and the Apache::ASP section runs head and shoulders above the other side. Anyone who is still using anything but your product to implement their webpages seriously needs to take a look at how versatile and powerful Apache::ASP is. Thanks again for such great work!
    
      -- Al from 'Anime Wallpaper at Anime Cubed', http://www.animecubed.com/wallpapers/
    

    gutscheinwurst.de

    I am the web master of http://www.gutscheinwurst.de , a German voucher community. 
    We use Apache::Asp to run our backend & administration servers for the system. We started using Apache::ASP to see whether it is a valid alternative to IIS legacy systems. So far all expectations in regard of performance, ease of development and integration have been fulfilled or exceeded.
    Thank's for such a great product :)
    
     -- Johnannes Leimbach
    

    D. L. Fox

    I had programmed in Perl for some time ... but, 
    since I also knew VB, I had switched to VB in IIS-ASP for 
    web stuff because of its ease of use in embedding code
    with HTML ...  When I discovered
    Apache-ASP, it was like a dream come true.  I would much rather code in Perl
    than any other language.  Thanks for such a fine product!
    	
    	

    HOSTING 321, LLC.

    After discontinuing Windows-based hosting due to the high cost of software, 
    our clients are thrilled with Apache::ASP and they swear ASP it's faster 
    than before. Installation was a snap on our 25-server web farm with a small 
    shell script and everything is running perfectly! The documentation is 
    very comprehensive and everyone has been very helpful during this migration.
    
    Thank you!
     -- Richard Ward, HOSTING 321, LLC.
    

    Concept Online Ltd.

    
    
    I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not "forced" to use JSP, we chose ASP. It is fast, reliable, versatile, documented in a way that is the best for professionals - so thank you for writting and maintaining it!
      -- Csongor Fagyal, Concept Online Ltd.
    

    WebTime

    
    
    As we have seen with WebTime, Apache::ASP is not only good for the development of website, but also for the development of webtools. Since I first discoverd it, I made it a must-have in my society by taking traditional PHP users to the world of perl afficionados.
    Having the possibility to use Apache::ASP with mod_perl or mod_cgi make it constraintless to use because of CGI's universality and perl's portability.
      -- Grégoire Lejeune
    

    David Kulp

    First, I just want to say that I am very very impressed with Apache::ASP.  I
    just want to gush with praise after looking at many other implementations of
    perl embedded code and being very underwhelmed.  This is so damn slick and
    clean.  Kudos! ...
    
    ... I'm very pleased how quickly I've been able to mock up the application. I've been writing Perl CGI off and on since 1993(!) and I can tell you that Apache::ASP is a pleasure. (Last year I tried Zope and just about threw my computer out the window.)
      -- David Kulp
    

    MFM Commmunication Software, Inc.

    HUFF Realty
    Star One Realtors
    Comey & Shepherd Realtors
    RE/MAX Unlimited Realtors
    Cincinnati Builders
    Blue Ash Airport Days Airshow

    Working in a team environment where you have HTML coders and perl coders, Apache::ASP makes it easy for the HTML folks to change the look of the page without knowing perl. Using Apache::ASP (instead of another embedded perl solution) allows the HTML jockeys to use a variety of HTML tools that understand ASP, which reduces the amount of code they break when editing the HTML. Using Apache::ASP instead of M$ ASP allows us to use perl (far superior to VBScript) and Apache (far superior to IIS).
    We've been very pleased with Apache::ASP and its support.

    Planet of Music

    Apache::ASP has been a great tool.  Just a little
    background.... the whole site had been in cgi flat files when I started
    here.  I was looking for a technology that would allow me to write the
    objects and NEVER invoke CGI.pm... I found it and hopefuly I will be able to
    implement this every site I go to.
    
    When I got here there was a huge argument about needing a game engine and I belive this has been the key... Games are approx. 10 time faster than before. The games don't break anylonger. All in all a great tool for advancement.
      -- JC Fant IV
    

    Cine.gr

    
    
    ...we ported our biggest yet ASP site from IIS (well, actually rewrote), Cine.gr and it is a killer site. In some cases, the whole thing got almost 25 (no typo) times faster... None of this would ever be possible without Apache::ASP (I do not ever want to write ``print "<HTML>\n";'' again).
     
    Apache-ASP-2.63/site/kudos.html0000644000175000017500000003316613252377727014363 0ustar jobjob Apache::ASP::Credits
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
    % CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    CREDITS
    Many thanks to those who helped me make this module a reality. With Apache + ASP + Perl, web development could not be better!
    Special thanks go to my father Kevin & wife Lina for their love and support through it all, and without whom none of it would have been possible.
    Other honorable mentions include:
     !! Gregory Youngblood, Thanos Chatziathanassiou, & Tsirkin Evgeny for keeping the flame alive!
    
     :) Doug MacEachern, for moral support and of course mod_perl
     :) Helmut Zeilinger, Skylos, John Drago, and Warren Young for their help in the community
     :) Randy Kobes, for the win32 binaries, and for always being the epitome of helpfulness
     :) Francesco Pasqualini, for bug fixes with stand alone CGI mode on Win32
     :) Szymon Juraszczyk, for better ContentType handling for settings like Clean.
     :) Oleg Kobyakovskiy, for identifying the double Session_OnEnd cleanup bug.
     :) Peter Galbavy, for reporting numerous bugs and maintaining the OpenBSD port.
     :) Richard Curtis, for reporting and working through interesting module 
        loading issues under mod_perl2 & apache2, and pushing on the file upload API.
     :) Rune Henssel, for catching a major bug shortly after 2.47 release,
        and going to great lengths to get me reproducing the bug quickly.
     :) Broc, for keeping things filter aware, which broke in 2.45,
        & much help on the list.
     :) Manabu Higashida, for fixes to work under perl 5.8.0
     :) Slaven Rezic, for suggestions on smoother CPAN installation
     :) Mitsunobu Ozato, for working on a japanese translation of the site & docs.
     :) Eamon Daly for persistence in resolving a MailErrors bug.
     :) Gert, for help on the mailing list, and pushing the limits of use on Win32 
        in addition to XSLT.
     :) Maurice Aubrey, for one of the early fixes to the long file name problem.
     :) Tom Lancaster, for pushing the $Server->Mail API and general API discussion.
     :) Ross Thomas, for pushing into areas so far unexplored.
     :) Harald Kreuzer, for bug discovery & subsequent testing in the 2.25 era.
     :) Michael Buschauer for his extreme work with XSLT.
     :) Dariusz Pietrzak for a nice parser optimization.
     :) Ime Smits, for his inode patch facilitating cross site code reuse, and
        some nice performance enhancements adding another 1-2% speed.
     :) Michael Davis, for easier CPAN installation.
     :) Brian Wheeler, for keeping up with the Apache::Filter times,
        and pulling off filtering ASP->AxKit.
     :) Ged Haywood, for his great help on the list & professionally.
     :) Vee McMillen, for OSS patience & understanding.
     :) Craig Samuel, at LRN, for his faith in open source for his LCEC.
     :) Geert Josten, for his wonderful work on XML::XSLT
     :) Gerald Richter, for his Embperl, collaboration and competition!
     :) Stas Bekman, for his beloved guide, and keeping us all worldly.
     :) Matt Sergeant, again, for ever the excellent XML critique.
     :) Remi Fasol + Serge Sozonoff who inspired cookieless sessions.
     :) Matt Arnold, for the excellent graphics !
     :) Adi, who thought to have full admin control over sessions
     :) Dmitry Beransky, for sharable web application includes, ASP on the big.
     :) Russell Weiss again, for finding the internal session garbage collection 
        behaving badly with DB_File sensitive i/o flushing requirements.
     :) Tony Merc Mobily, inspiring tweaks to compile scripts 10 times faster
     :) Paul Linder, who is Mr. Clean... not just the code, its faster too !
        Boy was that just the beginning.  Work with him later facilitated better
        session management and XMLSubsMatch custom tag technology.
     :) Russell Weiss, for being every so "strict" about his code.
     :) Bill McKinnon, who understands the finer points of running a web site.
     :) Richard Rossi, for his need for speed & boldly testing dynamic includes.
     :) Greg Stark, for endless enthusiasm, pushing the module to its limits.
     :) Marc Spencer, who brainstormed dynamic includes.
     :) Doug Silver, for finding most of the bugs.
     :) Darren Gibbons, the biggest cookie-monster I have ever known.
     :) Ken Williams, for great teamwork bringing full SSI to the table
     :) Matt Sergeant, for his great tutorial on PerlScript and love of ASP
     :) Jeff Groves, who put a STOP to user stop button woes
     :) Alan Sparks, for knowing when size is more important than speed
     :) Lincoln Stein, for his blessed CGI.pm module
     :) Michael Rothwell, for his love of Session hacking
     :) Francesco Pasqualini, for bringing ASP to CGI
     :) Bryan Murphy, for being a PerlScript wiz
     :) Lupe Christoph, for his immaculate and stubborn testing skills
     :) Ryan Whelan, for boldly testing on Unix in the early infancy of ASP
    
     
    Apache-ASP-2.63/site/objects.html0000644000175000017500000023645013252377727014670 0ustar jobjob Apache::ASP::Objects
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
    % OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    OBJECTS
    The beauty of the ASP Object Model is that it takes the burden of CGI and Session Management off the developer, and puts them in objects accessible from any ASP script & include. For the perl programmer, treat these objects as globals accessible from anywhere in your ASP application.
    The Apache::ASP object model supports the following:
      Object         Function
      ------         --------
      $Session      - user session state
      $Response     - output to browser
      $Request      - input from browser
      $Application  - application state
      $Server       - general methods
    
    These objects, and their methods are further defined in the following sections.
    If you would like to define your own global objects for use in your scripts and includes, you can initialize them in the global.asa Script_OnStart like:
     use vars qw( $Form $Site ); # declare globals
     sub Script_OnStart {
         $Site = My::Site->new;  # init $Site object
         $Form = $Request->Form; # alias form data
         $Server->RegisterCleanup(sub { # garbage collection
    				  $Site->DESTROY; 
    				  $Site = $Form = undef; 
    			      });
     }
    
    In this way you can create site wide application objects and simple aliases for common functions.

    $Session Object $Response->Write($data)
    $Session->{CodePage}
    $Session->{LCID} $Request Object
    $Session->{SessionID} $Request->{Method}
    $Session->{Timeout} [= $minutes] $Request->{TotalBytes}
    $Session->Abandon() $Request->BinaryRead([$length])
    $Session->Lock() $Request->ClientCertificate()
    $Session->UnLock() $Request->Cookies($name [,$key])
    $Request->FileUpload($form_field, $key)
    $Response Object $Request->Form($name)
    $Response->{BinaryRef} $Request->Params($name)
    $Response->{Buffer} $Request->QueryString($name)
    $Response->{CacheControl} $Request->ServerVariables($name)
    $Response->{Charset}
    $Response->{Clean} = 0-9; $Application Object
    $Response->{ContentType} = "text/html" $Application->Lock()
    $Response->{Debug} = 1|0 $Application->UnLock()
    $Response->{Expires} = $time $Application->GetSession($sess_id)
    $Response->{ExpiresAbsolute} = $date $Application->SessionCount()
    $Response->{FormFill} = 0|1
    $Response->{IsClientConnected} $Server Object
    $Response->{PICS} $Server->{ScriptTimeout} = $seconds
    $Response->{Status} = $status $Server->Config($setting)
    $Response->AddHeader($name, $value) $Server->CreateObject($program_id)
    $Response->AppendToLog($message) $Server->Execute($file, @args)
    $Response->BinaryWrite($data) $Server->File()
    $Response->Clear() $Server->GetLastError()
    $Response->Cookies($name, [$key,] $value) $Server->HTMLEncode( $string || \$string )
    $Response->Debug(@args) $Server->MapInclude($include)
    $Response->End() $Server->MapPath($url);
    $Response->ErrorDocument($code, $uri) $Server->Mail(\%mail, %smtp_args);
    $Response->Flush() $Server->RegisterCleanup($sub)
    $Response->Include($filename, @args) $Server->Transfer($file, @args)
    $Response->Include(\%cache_args, @sub_args) *CACHE API* $Server->URLEncode($string)
    $Response->Include(\$script_text, @args) $Server->URL($url, \%params)
    $Response->IsClientConnected() $Server->XSLT(\$xsl_data, \$xml_data)
    $Response->Redirect($url)  
    $Response->TrapInclude($file, @args)  

    $Session Object

    The $Session object keeps track of user and web client state, in
    a persistent manner, making it relatively easy to develop web 
    applications.  The $Session state is stored across HTTP connections,
    in database files in the Global or StateDir directories, and will 
    persist across web server restarts. 
    
    The user session is referenced by a 128 bit / 32 byte MD5 hex hashed cookie, and can be considered secure from session id guessing, or session hijacking. When a hacker fails to guess a session, the system times out for a second, and with 2**128 (3.4e38) keys to guess, a hacker will not be guessing an id any time soon.
    If an incoming cookie matches a timed out or non-existent session, a new session is created with the incoming id. If the id matches a currently active session, the session is tied to it and returned. This is also similar to the Microsoft ASP implementation.
    The $Session reference is a hash ref, and can be used as such to store data as in:
        $Session->{count}++;	# increment count by one
        %{$Session} = ();	# clear $Session data
    
    The $Session object state is implemented through MLDBM, and a user should be aware of the limitations of MLDBM. Basically, you can read complex structures, but not write them, directly:
      $data = $Session->{complex}{data};     # Read ok.
      $Session->{complex}{data} = $data;     # Write NOT ok.
      $Session->{complex} = {data => $data}; # Write ok, all at once.
    
    Please see MLDBM for more information on this topic. $Session can also be used for the following methods and properties:

    $Session->{CodePage}

    Not implemented.  May never be until someone needs it.
    	
    	

    $Session->{LCID}

    Not implemented.  May never be until someone needs it.
    	
    	

    $Session->{SessionID}

    SessionID property, returns the id for the current session,
    which is exchanged between the client and the server as a cookie.
    	
    	

    $Session->{Timeout} [= $minutes]

    Timeout property, if minutes is being assigned, sets this 
    default timeout for the user session, else returns 
    the current session timeout.  
    
    If a user session is inactive for the full timeout, the session is destroyed by the system. No one can access the session after it times out, and the system garbage collects it eventually.

    $Session->Abandon()

    The abandon method times out the session immediately.  All Session
    data is cleared in the process, just as when any session times out.
    	
    	

    $Session->Lock()

    API extension. If you are about to use $Session for many consecutive 
    reads or writes, you can improve performance by explicitly locking 
    $Session, and then unlocking, like:
    
      $Session->Lock();
      $Session->{count}++;
      $Session->{count}++;
      $Session->{count}++;
      $Session->UnLock();  
    
    This sequence causes $Session to be locked and unlocked only 1 time, instead of the 6 times that it would be locked otherwise, 2 for each increment with one to read and one to write.
    Because of flushing issues with SDBM_File and DB_File databases, each lock actually ties fresh to the database, so the performance savings here can be considerable.
    Note that if you have SessionSerialize set, $Session is already locked for each script invocation automatically, as if you had called $Session->Lock() in Script_OnStart. Thus you do not need to worry about $Session locking for performance. Please read the section on SessionSerialize for more info.

    $Session->UnLock()

    API Extension. Unlocks the $Session explicitly.  If you do not call this,
    $Session will be unlocked automatically at the end of the 
    script.
    	
    	

    $Response Object

    This object manages the output from the ASP Application and the 
    client web browser.  It does not store state information like the 
    $Session object but does have a wide array of methods to call.
    	
    	

    $Response->{BinaryRef}

    API extension. This is a perl reference to the buffered output of 
    the $Response object, and can be used in the Script_OnFlush
    global.asa event to modify the buffered output at runtime
    to apply global changes to scripts output without having to 
    modify all the scripts.  These changes take place before 
    content is flushed to the client web browser.
    
     sub Script_OnFlush {
       my $ref = $Response->{BinaryRef};
       $$ref =~ s/\s+/ /sg; # to strip extra white space
     }
    
    Check out the ./site/eg/global.asa for an example of its use.

    $Response->{Buffer}

    Default 1, when TRUE sends output from script to client only at
    the end of processing the script.  When 0, response is not buffered,
    and client is sent output as output is generated by the script.
    	
    	

    $Response->{CacheControl}

    Default "private", when set to public allows proxy servers to 
    cache the content.  This setting controls the value set
    in the HTTP header Cache-Control
    	
    	

    $Response->{Charset}

    This member when set appends itself to the value of the Content-Type
    HTTP header.  If $Response->{Charset} = 'ISO-LATIN-1' is set, the 
    corresponding header would look like:
    
      Content-Type: text/html; charset=ISO-LATIN-1
    

    $Response->{Clean} = 0-9;

    API extension. Set the Clean level, default 0, on a per script basis.  
    Clean of 1-9 compresses text/html output.  Please see
    the Clean config option for more information. This setting may
    also be useful even if using compression to obfuscate HTML.
    	
    	

    $Response->{ContentType} = "text/html"

    Sets the MIME type for the current response being sent to the client.
    Sent as an HTTP header.
    	
    	

    $Response->{Debug} = 1|0

    API extension.  Default set to value of Debug config.  May be
    used to temporarily activate or inactivate $Response->Debug()
    behavior.  Something like:
    
     {
       local $Response->{Debug} = 1;
       $Response->Debug($values);
     }
    
    maybe be used to always log something. The Debug() method can be better than AppendToLog() because it will log data in data structures one level deep, whereas AppendToLog prints just raw string/scalar values.

    $Response->{Expires} = $time

    Sends a response header to the client indicating the $time 
    in SECONDS in which the document should expire.  A time of 0 means
    immediate expiration.  The header generated is a standard
    HTTP date like: "Wed, 09 Feb 1994 22:23:32 GMT".
    	
    	

    $Response->{ExpiresAbsolute} = $date

    Sends a response header to the client with $date being an absolute
    time to expire.  Formats accepted are all those accepted by 
    HTTP::Date::str2time(), e.g.
    
     "Wed, 09 Feb 1994 22:23:32 GMT"     -- HTTP format
     "Tuesday, 08-Feb-94 14:15:29 GMT"   -- old rfc850 HTTP format
    
     "08-Feb-94"       -- old rfc850 HTTP format    
     "09 Feb 1994"     -- proposed new HTTP format  
    
     "Feb  3  1994"    -- Unix 'ls -l' format
     "Feb  3 17:03"    -- Unix 'ls -l' format
    

    $Response->{FormFill} = 0|1

    If true, HTML forms generated by the script output will
    be auto filled with data from $Request->Form.  This feature
    requires HTML::FillInForm to be installed.  Please see
    the FormFill CONFIG for more information.
    
    This setting overrides the FormFill config at runtime for the script execution only.

    $Response->{IsClientConnected}

    1 if web client is connected, 0 if not.  This value
    starts set to 1, and will be updated whenever a
    $Response->Flush() is called.  If BufferingOn is
    set, by default $Response->Flush() will only be
    called at the end of the HTML output.  
    
    As of version 2.23 this value is updated correctly before global.asa Script_OnStart is called, so global script termination may be correctly handled during that event, which one might want to do with excessive user STOP/RELOADS when the web server is very busy.
    An API extension $Response->IsClientConnected may be called for refreshed connection status without calling first a $Response->Flush

    $Response->{PICS}

    If this property has been set, a PICS-Label HTTP header will be
    sent with its value.  For those that do not know, PICS is a header
    that is useful in rating the internet.  It stands for 
    Platform for Internet Content Selection, and you can find more
    info about it at: http://www.w3.org
    	
    	

    $Response->{Status} = $status

    Sets the status code returned by the server.  Can be used to
    set messages like 500, internal server error
    	
    	

    $Response->AddHeader($name, $value)

    Adds a custom header to a web page.  Headers are sent only before any
    text from the main page is sent, so if you want to set a header
    after some text on a page, you must turn BufferingOn.
    	
    	

    $Response->AppendToLog($message)

    Adds $message to the server log.  Useful for debugging.
    	
    	

    $Response->BinaryWrite($data)

    Writes binary data to the client.  The only
    difference from $Response->Write() is that $Response->Flush()
    is called internally first, so the data cannot be parsed 
    as an html header.  Flushing flushes the header if has not
    already been written.
    
    If you have set the $Response->{ContentType} to something other than text/html, cgi header parsing (see CGI notes), will be automatically be turned off, so you will not necessarily need to use BinaryWrite for writing binary data.
    For an example of BinaryWrite, see the binary_write.htm example in ./site/eg/binary_write.htm
    Please note that if you are on Win32, you will need to call binmode on a file handle before reading, if its data is binary.

    $Response->Clear()

    Erases buffered ASP output.
    	
    	

    $Response->Cookies($name, [$key,] $value)

    Sets the key or attribute of cookie with name $name to the value $value.
    If $key is not defined, the Value of the cookie is set.
    ASP CookiePath is assumed to be / in these examples.
    
     $Response->Cookies('name', 'value'); 
      --> Set-Cookie: name=value; path=/
    
     $Response->Cookies("Test", "data1", "test value");     
     $Response->Cookies("Test", "data2", "more test");      
     $Response->Cookies(
    	"Test", "Expires", 
    	&HTTP::Date::time2str(time+86400)
    	); 
     $Response->Cookies("Test", "Secure", 1);               
     $Response->Cookies("Test", "Path", "/");
     $Response->Cookies("Test", "Domain", "host.com");
      -->	Set-Cookie:Test=data1=test%20value&data2=more%20test;	\
     		expires=Fri, 23 Apr 1999 07:19:52 GMT;		\
     		path=/; domain=host.com; secure
    
    The latter use of $key in the cookies not only sets cookie attributes such as Expires, but also treats the cookie as a hash of key value pairs which can later be accesses by
     $Request->Cookies('Test', 'data1');
     $Request->Cookies('Test', 'data2');
    
    Because this is perl, you can (NOT PORTABLE) reference the cookies directly through hash notation. The same 5 commands above could be compressed to:
     $Response->{Cookies}{Test} = 
    	{ 
    		Secure	=> 1, 
    		Value	=>	
    			{
    				data1 => 'test value', 
    				data2 => 'more test'
    			},
    		Expires	=> 86400, # not portable, see above
    		Domain	=> 'host.com',
    		Path    => '/'
    	};
    
    and the first command would be:
     # you don't need to use hash notation when you are only setting 
     # a simple value
     $Response->{Cookies}{'Test Name'} = 'Test Value'; 
    
    I prefer the hash notation for cookies, as this looks nice, and is quite perlish. It is here to stay. The Cookie() routine is very complex and does its best to allow access to the underlying hash structure of the data. This is the best emulation I could write trying to match the Collections functionality of cookies in IIS ASP.
    For more information on Cookies, please go to the source at http://home.netscape.com/newsref/std/cookie_spec.html

    $Response->Debug(@args)

    API Extension. If the Debug config option is set greater than 0, 
    this routine will write @args out to server error log.  refs in @args 
    will be expanded one level deep, so data in simple data structures
    like one-level hash refs and array refs will be displayed.  CODE
    refs like
    
     $Response->Debug(sub { "some value" });
    
    will be executed and their output added to the debug output. This extension allows the user to tie directly into the debugging capabilities of this module.
    While developing an app on a production server, it is often useful to have a separate error log for the application to catch debugging output separately. One way of implementing this is to use the Apache ErrorLog configuration directive to create a separate error log for a virtual host.
    If you want further debugging support, like stack traces in your code, consider doing things like:
     $Response->Debug( sub { Carp::longmess('debug trace') };
     $SIG{__WARN__} = \&Carp::cluck; # then warn() will stack trace
    
    The only way at present to see exactly where in your script an error occurred is to set the Debug config directive to 2, and match the error line number to perl script generated from your ASP script.
    However, as of version 0.10, the perl script generated from the asp script should match almost exactly line by line, except in cases of inlined includes, which add to the text of the original script, pod comments which are entirely yanked out, and <% # comment %> style comments which have a \n added to them so they still work.
    If you would like to see the HTML preceding an error while developing, consider setting the BufferingOn config directive to 0.

    $Response->End()

    Sends result to client, and immediately exits script.
    Automatically called at end of script, if not already called.
    	
    	

    $Response->ErrorDocument($code, $uri)

    API extension that allows for the modification the Apache
    ErrorDocument at runtime.  $uri may be a on site document,
    off site URL, or string containing the error message.  
    
    This extension is useful if you want to have scripts set error codes with $Response->{Status} like 401 for authentication failure, and to then control from the script what the error message looks like.
    For more information on the Apache ErrorDocument mechanism, please see ErrorDocument in the CORE Apache settings, and the Apache->custom_response() API, for which this method is a wrapper.

    $Response->Flush()

    Sends buffered output to client and clears buffer.
    	
    	

    $Response->Include($filename, @args)

    This API extension calls the routine compiled from asp script
    in $filename with the args @args.  This is a direct translation
    of the SSI tag 
    
      <!--#include file=$filename args=@args-->
    
    Please see the SSI section for more on SSI in general.
    This API extension was created to allow greater modularization of code by allowing includes to be called with runtime arguments. Files included are compiled once, and the anonymous code ref from that compilation is cached, thus including a file in this manner is just like calling a perl subroutine. The @args can be found in @_ in the includes like:
      # include.inc
      <% my @args = @_; %>
    
    As of 2.23, multiple return values can be returned from an include like:
     my @rv = $Response->Include($filename, @args);
    

    $Response->Include(\%cache_args, @sub_args) *CACHE API*

    As of version 2.23, output from an include may be
    cached with this API and the CONFIG settings CacheDir & CacheDB.  This
    can be used to execute expensive includes only rarely
    where applicable, drastically increasing performance in 
    some cases.
    
    This API extension applies to the entire include family:
      my @rv = $Response->Include(\%cache_args, @include_args)
      my $html_ref = $Response->TrapInclude(\%cache_args, @include_args)
      $Server->Execute(\%cache_args, @include_args)
    
    For this output cache to work, you must load Apache::ASP in the Apache parent httpd like so:
      # httpd.conf
      PerlModule Apache::ASP
    
    The cache arguments are shown here
      $Response->Include({
        File => 'file.inc',
        Cache => 1, # to activate cache layer
        Expires => 3600, # to expire in one hour
        LastModified => time() - 600, # to expire if cached before 10 minutes ago
        Key => $Request->Form, # to cache based on checksum of serialized form data,
        Clear => 1, # always executes include & cache output
      }, @include_args);
    
      File - include file to execute, can be file name or \$script 
        script data passed in as a string reference.
    
      Cache - activate caching, will run like normal include without this
    
      Expires - only cache for this long in seconds
    
      LastModified - if cached before this time(), expire
    
      Key - The cache item identity.  Can be $data, \$data, \%data, \@data, 
        this data is serialized and combined with the filename & @include_args 
        to create a MD5 checksum to fetch from the cache with. If you wanted
        to cache the results of a search page from form data POSTed, 
        then this key could be 
    
          { Key => $Request->Form }
    
      Clear - If set to 1, or boolean true, will always execute the include 
        and update the cache entry for it.
    
    Motivation: If an include takes 1 second to execute because of complex SQL to a database, and you can cache the output of this include because it is not realtime data, and the cache layer runs at .01 seconds, then you have a 100 fold savings on that part of the script. Site scalability can be dramatically increased in this way by intelligently caching bottlenecks in the web application.
    Use Sparingly: If you have a fast include, then it may execute faster than the cache layer runs, in which case you may actually slow your site down by using this feature. Therefore try to use this sparingly, and only when sure you really need it. Apache::ASP scripts generally execute very quickly, so most developers will not need to use this feature at all.

    $Response->Include(\$script_text, @args)

    Added in Apache::ASP 2.11, this method allows for executing ASP scripts
    that are generated dynamically by passing in a reference to the script
    data instead of the file name.  This works just like the normal
    $Response->Include() API, except a string reference is passed in
    instead of a filename.  For example:
    
      <%
        my $script = "<\% print 'TEST'; %\>";
        $Response->Include(\$script);
      %>
    
    This include would output TEST. Note that tokens like <% and %> must be escaped so Apache::ASP does not try to compile those code blocks directly when compiling the original script. If the $script data were fetched directly from some external resource like a database, then these tokens would not need to be escaped at all as in:
      <%
        my $script = $dbh->selectrow_array(
           "select script_text from scripts where script_id = ?",
           undef, $script_id
           );
        $Response->Include(\$script);
      %>
    
    This method could also be used to render other types of dynamic scripts, like XML docs using XMLSubs for example, though for complex runtime XML rendering, one should use something better suited like XSLT. See the $Server->XSLT API for more on this topic.

    $Response->IsClientConnected()

    API Extension.  1 for web client still connected, 0 if 
    disconnected which might happen if the user hits the stop button.
    The original API for this $Response->{IsClientConnected}
    is only updated after a $Response->Flush is called,
    so this method may be called for a refreshed status.
    
    Note $Response->Flush calls $Response->IsClientConnected to update $Response->{IsClientConnected} so to use this you are going straight to the source! But if you are doing a loop like:
      while(@data) {
        $Response->End if ! $Response->{IsClientConnected};
        my $row = shift @data;
        %> <%= $row %> <%
        $Response->Flush;
      }
    
    Then its more efficient to use the member instead of the method since $Response->Flush() has already updated that value for you.

    $Response->Redirect($url)

    Sends the client a command to go to a different url $url.  
    Script immediately ends.
    	
    	

    $Response->TrapInclude($file, @args)

    Calls $Response->Include() with same arguments as
    passed to it, but instead traps the include output buffer
    and returns it as as a perl string reference.  This allows
    one to postprocess the output buffer before sending
    to the client.
    
      my $string_ref = $Response->TrapInclude('file.inc');
      $$string_ref =~ s/\s+/ /sg; # squash whitespace like Clean 1
      print $$string_ref;
    
    The data is returned as a referenece to save on what might be a large string copy. You may dereference the data with the $$string_ref notation.

    $Response->Write($data)

    Write output to the HTML page.  <%=$data%> syntax is shorthand for
    a $Response->Write($data).  All final output to the client must at
    some point go through this method.
    	
    	

    $Request Object

    The request object manages the input from the client browser, like
    posts, query strings, cookies, etc.  Normal return results are values
    if an index is specified, or a collection / perl hash ref if no index 
    is specified.  WARNING, the latter property is not supported in 
    ActiveState PerlScript, so if you use the hashes returned by such
    a technique, it will not be portable.
    
    A normal use of this feature would be to iterate through the form variables in the form hash...
     $form = $Request->Form();
     for(keys %{$form}) {
    	$Response->Write("$_: $form->{$_}<br>\n");
     }
    
    Please see the ./site/eg/server_variables.htm asp file for this method in action.
    Note that if a form POST or query string contains duplicate values for a key, those values will be returned through normal use of the $Request object:
      @values = $Request->Form('key');
    
    but you can also access the internal storage, which is an array reference like so:
      $array_ref = $Request->{Form}{'key'};
      @values = @{$array_ref};
    
    Please read the PERLSCRIPT section for more information on how things like $Request->QueryString() & $Request->Form() behave as collections.

    $Request->{Method}

    API extension.  Returns the client HTTP request method, as in
    GET or POST.  Added in version 2.31.
    	
    	

    $Request->{TotalBytes}

    The amount of data sent by the client in the body of the 
    request, usually the length of the form data.  This is
    the same value as $Request->ServerVariables('CONTENT_LENGTH')
    	
    	

    $Request->BinaryRead([$length])

    Returns a string whose contents are the first $length bytes
    of the form data, or body, sent by the client request.
    If $length is not given, will return all of the form data.
    This data is the raw data sent by the client, without any
    parsing done on it by Apache::ASP.
    
    Note that BinaryRead will not return any data for file uploads. Please see the $Request->FileUpload() interface for access to this data. $Request->Form() data will also be available as normal.

    $Request->ClientCertificate()

    Not implemented.
    	
    	

    $Request->Cookies($name [,$key])

    Returns the value of the Cookie with name $name.  If a $key is
    specified, then a lookup will be done on the cookie as if it were
    a query string.  So, a cookie set by:
    
     Set-Cookie: test=data1=1&data2=2
    
    would have a value of 2 returned by $Request->Cookies('test','data2').
    If no name is specified, a hash will be returned of cookie names as keys and cookie values as values. If the cookie value is a query string, it will automatically be parsed, and the value will be a hash reference to these values.
    When in doubt, try it out. Remember that unless you set the Expires attribute of a cookie with $Response->Cookies('cookie', 'Expires', $xyz), the cookies that you set will only last until you close your browser, so you may find your self opening & closing your browser a lot when debugging cookies.
    For more information on cookies in ASP, please read $Response->Cookies()

    $Request->FileUpload($form_field, $key)

    API extension.  The FileUpload interface to file upload data is
    stabilized.  The internal representation of the file uploads
    is a hash of hashes, one hash per file upload found in 
    the $Request->Form() collection.  This collection of collections
    may be queried through the normal interface like so:
    
      $Request->FileUpload('upload_file', 'ContentType');
      $Request->FileUpload('upload_file', 'FileHandle');
      $Request->FileUpload('upload_file', 'BrowserFile');
      $Request->FileUpload('upload_file', 'Mime-Header');
      $Request->FileUpload('upload_file', 'TempFile');
    
      * note that TempFile must be use with the UploadTempFile 
        configuration setting.
    
    The above represents the old slow collection interface, but like all collections in Apache::ASP, you can reference the internal hash representation more easily.
      my $fileup = $Request->{FileUpload}{upload_file};
      $fileup->{ContentType};
      $fileup->{BrowserFile};
      $fileup->{FileHandle};
      $fileup->{Mime-Header};
      $fileup->{TempFile};
    

    $Request->Form($name)

    Returns the value of the input of name $name used in a form
    with POST method.  If $name is not specified, returns a ref to 
    a hash of all the form data.  One can use this hash to 
    create a nice alias to the form data like:
    
     # in global.asa
     use vars qw( $Form );
     sub Script_OnStart {
       $Form = $Request->Form;
     }
     # then in ASP scripts
     <%= $Form->{var} %>
    
    File upload data will be loaded into $Request->Form('file_field'), where the value is the actual file name of the file uploaded, and the contents of the file can be found by reading from the file name as a file handle as in:
     while(read($Request->Form('file_field_name'), $data, 1024)) {};
    
    For more information, please see the CGI / File Upload section, as file uploads are implemented via the CGI.pm module. An example can be found in the installation samples ./site/eg/file_upload.asp

    $Request->Params($name)

    API extension. If RequestParams CONFIG is set, the $Request->Params 
    object is created with combined contents of $Request->QueryString 
    and $Request->Form.  This is for developer convenience simlar 
    to CGI.pm's param() method.  Just like for $Response->Form, 
    one could create a nice alias like:
    
     # in global.asa
     use vars qw( $Params );
     sub Script_OnStart {
       $Params = $Request->Params;
     }
    

    $Request->QueryString($name)

    Returns the value of the input of name $name used in a form
    with GET method, or passed by appending a query string to the end of
    a url as in http://localhost/?data=value.  
    If $name is not specified, returns a ref to a hash of all the query 
    string data.
    	
    	

    $Request->ServerVariables($name)

    Returns the value of the server variable / environment variable
    with name $name.  If $name is not specified, returns a ref to 
    a hash of all the server / environment variables data.  The following
    would be a common use of this method:
    
     $env = $Request->ServerVariables();
     # %{$env} here would be equivalent to the cgi %ENV in perl.
    

    $Application Object

    Like the $Session object, you may use the $Application object to 
    store data across the entire life of the application.  Every
    page in the ASP application always has access to this object.
    So if you wanted to keep track of how many visitors there where
    to the application during its lifetime, you might have a line
    like this:
    
     $Application->{num_users}++
    
    The Lock and Unlock methods are used to prevent simultaneous access to the $Application object.

    $Application->Lock()

    Locks the Application object for the life of the script, or until
    UnLock() unlocks it, whichever comes first.  When $Application
    is locked, this guarantees that data being read and written to it 
    will not suddenly change on you between the reads and the writes.
    
    This and the $Session object both lock automatically upon every read and every write to ensure data integrity. This lock is useful for concurrent access control purposes.
    Be careful to not be too liberal with this, as you can quickly create application bottlenecks with its improper use.

    $Application->UnLock()

    Unlocks the $Application object.  If already unlocked, does nothing.
    	
    	

    $Application->GetSession($sess_id)

    This NON-PORTABLE API extension returns a user $Session given
    a session id.  This allows one to easily write a session manager if
    session ids are stored in $Application during Session_OnStart, with 
    full access to these sessions for administrative purposes.  
    
    Be careful not to expose full session ids over the net, as they could be used by a hacker to impersonate another user. So when creating a session manager, for example, you could create some other id to reference the SessionID internally, which would allow you to control the sessions. This kind of application would best be served under a secure web server.
    The ./site/eg/global_asa_demo.asp script makes use of this routine to display all the data in current user sessions.

    $Application->SessionCount()

    This NON-PORTABLE method returns the current number of active sessions
    in the application, and is enabled by the SessionCount configuration setting.
    This method is not implemented as part of the original ASP
    object model, but is implemented here because it is useful.  In particular,
    when accessing databases with license requirements, one can monitor usage
    effectively through accessing this value.
    	
    	

    $Server Object

    The server object is that object that handles everything the other
    objects do not.  The best part of the server object for Win32 users is 
    the CreateObject method which allows developers to create instances of
    ActiveX components, like the ADO component.
    	
    	

    $Server->{ScriptTimeout} = $seconds

    Not implemented. May never be.  Please see the 
    Apache Timeout configuration option, normally in httpd.conf.
    	
    	

    $Server->Config($setting)

    API extension.  Allows a developer to read the CONFIG
    settings, like Global, GlobalPackage, StateDir, etc.
    Currently implemented as a wrapper around 
    
      Apache->dir_config($setting)
    
    May also be invoked as $Server->Config(), which will return a hash ref of all the PerlSetVar settings.

    $Server->CreateObject($program_id)

    Allows use of ActiveX objects on Win32.  This routine returns
    a reference to an Win32::OLE object upon success, and nothing upon
    failure.  It is through this mechanism that a developer can 
    utilize ADO.  The equivalent syntax in VBScript is 
    
     Set object = Server.CreateObject(program_id)
    
    For further information, try 'perldoc Win32::OLE' from your favorite command line.

    $Server->Execute($file, @args)

    New method from ASP 3.0, this does the same thing as
    
      $Response->Include($file, @args)
    
    and internally is just a wrapper for such. Seems like we had this important functionality before the IIS/ASP camp!

    $Server->File()

    Returns the absolute file path to current executing script.
    Same as Apache->request->filename when running under mod_perl.
    
    ASP API extension.

    $Server->GetLastError()

    Not implemented, will likely not ever be because this is dependent
    on how IIS handles errors and is not relevant in Apache.
    	
    	

    $Server->HTMLEncode( $string || \$string )

    Returns an HTML escapes version of $string. &, ", >, <, are each
    escapes with their HTML equivalents.  Strings encoded in this nature
    should be raw text displayed to an end user, as HTML tags become 
    escaped with this method.
    
    As of version 2.23, $Server->HTMLEncode() may take a string reference for an optmization when encoding a large buffer as an API extension. Here is how one might use one over the other:
      my $buffer = '&' x 100000;
      $buffer = $Server->HTMLEncode($buffer);
      print $buffer;
        - or -
      my $buffer = '&' x 100000;
      $Server->HTMLEncode(\$buffer);
      print $buffer;
    
    Using the reference passing method in benchmarks on 100K of data was 5% more efficient, but maybe useful for some. It saves on copying the 100K buffer twice.

    $Server->MapInclude($include)

    API extension.  Given the include $include, as an absolute or relative file name to the current
    executing script, this method returns the file path that the include would
    be found from the include search path.  The include search path is the 
    current script directory, Global, and IncludesDir directories.
    
    If the include is not found in the includes search path, then undef, or bool false, is returned. So one may do something like this:
      if($Server->MapInclude('include.inc')) {
        $Response->Include('include.inc');
      }
    
    This code demonstrates how one might only try to execute an include if it exists, which is useful since a script will error if it tries to execute an include that does not exist.

    $Server->MapPath($url);

    Given the url $url, absolute, or relative to the current executing script,
    this method returns the equivalent filename that the server would 
    translate the request to, regardless or whether the request would be valid.
    
    Only a $url that is relative to the host is valid. Urls like "." and "/" are fine arguments to MapPath, but http://localhost would not be.
    To see this method call in action, check out the sample ./site/eg/server.htm script.

    $Server->Mail(\%mail, %smtp_args);

    With the Net::SMTP and Net::Config modules installed, which are part of the 
    perl libnet package, you may use this API extension to send email.  The 
    \%mail hash reference that you pass in must have values for at least
    the To, From, and Subject headers, and the Body of the mail message.
    
    The return value of this routine is 1 for success, 0 for failure. If the MailHost SMTP server is not available, this will have a return value of 0.
    You could send an email like so:
     $Server->Mail({
    		To => 'somebody@yourdomain.com.foobar',
    		From => 'youremail@yourdomain.com.foobar',
    		Subject => 'Subject of Email',
    		Body => 
    		 'Body of message. '.
    		 'You might have a lot to say here!',
    		Organization => 'Your Organization',
                    CC => 'youremailcc@yourdomain.com.foobar',
                    BCC => 'youremailbcc@yourdomain.com.foobar',
    		Debug => 0 || 1,
    	       });
    
    Any extra fields specified for the email will be interpreted as headers for the email, so to send an HTML email, you could set 'Content-Type' => 'text/html' in the above example.
    If you have MailFrom configured, this will be the default for the From header in your email. For more configuration options like the MailHost setting, check out the CONFIG section.
    The return value of this method call will be boolean for success of the mail being sent.
    If you would like to specially configure the Net::SMTP object used internally, you may set %smtp_args and they will be passed on when that object is initialized. "perldoc Net::SMTP" for more into on this topic.
    If you would like to include the output of an ASP page as the body of the mail message, you might do something like:
      my $mail_body = $Response->TrapInclude('mail_body.inc');
      $Server->Mail({ %mail, Body => $$mail_body });
    

    $Server->RegisterCleanup($sub)

     non-portable extension
    
    Sets a subroutine reference to be executed after the script ends, whether normally or abnormally, the latter occurring possibly by the user hitting the STOP button, or the web server being killed. This subroutine must be a code reference created like:
     $Server->RegisterCleanup(sub { $main::Session->{served}++; });
       or
     sub served { $main::Session->{served}++; }
     $Server->RegisterCleanup(\&served);
    
    The reference to the subroutine passed in will be executed. Though the subroutine will be executed in anonymous context, instead of the script, all objects will still be defined in main::*, that you would reference normally in your script. Output written to $main::Response will have no affect at this stage, as the request to the www client has already completed.
    Check out the ./site/eg/register_cleanup.asp script for an example of this routine in action.

    $Server->Transfer($file, @args)

    New method from ASP 3.0.  Transfers control to another script.  
    The Response buffer will not be cleared automatically, so if you 
    want this to serve as a faster $Response->Redirect(), you will need to 
    call $Response->Clear() before calling this method.  
    
    This new script will take over current execution and the current script will not continue to be executed afterwards. It differs from Execute() because the original script will not pick up where it left off.
    As of Apache::ASP 2.31, this method now accepts optional arguments like $Response->Include & $Server->Execute. $Server->Transfer is now just a wrapper for:
      $Response->Include($file, @args);
      $Response->End;
    

    $Server->URLEncode($string)

    Returns the URL-escaped version of the string $string. +'s are substituted in
    for spaces and special characters are escaped to the ascii equivalents.
    Strings encoded in this manner are safe to put in urls... they are especially
    useful for encoding data used in a query string as in:
    
     $data = $Server->URLEncode("test data");
     $url = "http://localhost?data=$data";
    
     $url evaluates to http://localhost?data=test+data, and is a 
     valid URL for use in anchor <a> tags and redirects, etc.
    

    $Server->URL($url, \%params)

    Will return a URL with %params serialized into a query 
    string like:
    
      $url = $Server->URL('test.asp', { test => value });
    
    which would give you a URL of test.asp?test=value
    Used in conjunction with the SessionQuery* settings, the returned URL will also have the session id inserted into the query string, making this a critical part of that method of implementing cookieless sessions. For more information on that topic please read on the setting in the CONFIG section, and the SESSIONS section too.

    $Server->XSLT(\$xsl_data, \$xml_data)

     * NON-PORTABLE API EXTENSION *
    
    This method takes string references for XSL and XML data and returns the XSLT output as a string reference like:
      my $xslt_data_ref = $Server->XSLT(\$xsl_data, \$xml_data)
      print $$xslt_data_ref;
    
    The XSLT parser defaults to XML::XSLT, and is configured with the XSLTParser setting, which can also use XML::Sablotron ( support added in 2.11 ), and XML::LibXSLT ( support added in 2.29 ). Please see the CONFIG section for more information on the XSLT* settings that drive this API. The XSLT setting itself uses this API internally to do its rendering.
    This API was created to allow developers easy XSLT component rendering without having to render the entire ASP scripts via XSLT. This will make an easy plugin architecture for those looking to integrate XML into their existing ASP application frameworks.
    At some point, the API will likely take files as arguments, but not as of the 2.11 release.
     
    Apache-ASP-2.63/site/pixel.gif0000644000175000017500000000006111721310312014114 0ustar jobjobGIF89a‘ÿÿÿÿÀÀÀ!ù,@T;Apache-ASP-2.63/site/communication_software.gif0000755000175000017500000005351411721310312017570 0ustar jobjobGIF89ad-÷ÿÿÿÿÿ÷÷÷ÿÿµÿÿJssœÿÿ”çï”÷ÿ”ÆÎ¥Þç”ÎÖ{µ½Œïÿkœ¥”ïÿBksJ{„{ÆÖJksŒÎÞ„ÆÖ{½ÎŒçÿ9Zc„Þ÷c”¥ZŒœJ{ŒsµÎk­Æ„Þÿ!9BJ„œµÆÎµçÿ”Þÿs½Þç÷ÿk­Î„Öÿ{Î÷„½Þ„Î÷{Îÿ!„ÎÿZs„c”µ{Æÿ1Rk{½÷ÞïÿÎçÿ!))BZs½ÿ)9ï÷ÿÆÖ猜­ÆÞ÷œµÎµÖ÷­Îï{”­œ½Þ¥Î÷BRcJkŒ!1Bs­ç1Jck¥ÞkµÿZ„µ!ZŒÆk­÷c­ÿ­Î÷k¥ï9Z„Z¥ÿÖçÿµÆÞÆÞÿµÎïs„œ”­Î„œ½Rc{sŒ­”½÷1BZ„µ÷{­ï9RskœÞBk¥¥Æ÷œ½ïc„µkœçBc”k¥ÿZœÿ½ÖÿcsŒœµÞJZsk”Ö{­ÿ1Jsc”ç)BkR”ÿJŒ÷1¥½ç{œÖ{¥ï!1k”ÞRs­!9cRŒ÷)RœÆÎÞÎÞÿ­½Þ”¥ÆµÎÿ­Æ÷œµç!)9„¥ç{œÞZs¥{¥÷Z{½BZŒRsµcŒÞZ„Ö!1R)J19Jk„½Rk¥9RŒ)B{1RœÆÖÿµÆïR{ÞBcµR{çJsÞR„ÿJ{÷)R9cÎRc”9RœBcÆ)ZBsÿksŒ19RJcµR{÷11JœJsï)B”!9„!Zœ¥Æ{„¥Zc„1B„JkÞ9cÿ9RµBcï1Zÿ1)Rÿck”1B”BZÎ1Bœ9RÎB9Z÷!9µ)J÷1!Z)9œ9Rç1JÖ1Jç)BÞ1Bµ1B½1BÆ)9­1Jï)Bï!9Ö!9Þ1Ö1ÞBŒ”ÖRZ¥19Œ)9Æ!{!1ÆcR!­c)1Œ!)”)9ï!1÷)ï!Ö!÷ÿ!)¥œ!÷µÆÞÖÞ1BBÎ11œcRs{„Œ,d-@ÿH° Aƒt˜Ð! aC†:"&tHbÄ‹ /jÄ !€CŠ)R€‰Yˆøë÷ïŸ$HRäüCönM›îrº;‡Ž§¹sçÌ;w쯣Gs%M%«Ÿ>Rü´ügcË+UtÜJRÇŽAYVå¸GË–ý¼)ë寚3þüeªó§.”ÎNÝ»·Ë~EÔ8YâOY¾³+—$›dã ,=´r(@`eË&ªpÚB¤‰'8Ô¨ÁAšôŠ)X|HñÅ"ÿnÄ‘"é 40@ÁÚ¾ÿ\Á‰#æŸ=jž@™AzÆ +¢£@}Á‚&Y~l¢ÁP`€— VÿþNãŠ.6@l âà SøúK“g Z–~ ÔS‡Œ? Ñ?±ˆb`* ôòqÌáÊ?<ðÞ øöb0pÀ%ièW×™üƒˆlôð]xéÐCAüuá?+éÅ׌4¶D %þäu– ^èA =[¸Pp1ÖhäŒýäã_YÐ@ÃB(NVXda‹!‡È`Ã6t¹Ç—`rùe—[r¹å™bŽÙ„—iÒ‘H!¶Ô‚ÕBRÖy=ˆ  "|åŠj£=¹LÃK.ÅDC0ä#Ì+jòŠ&”B©&iPJ†ýÈñÄ|¾8/øÐC&ع•4ìàƒ-ˆÿ£I+©ˆŠ'”üãG]uñáJ?ŽàɃ“¼Çk${Á ÀÁJ¿ý³„qÚ)¢Ô*Š,š²†vüá‰+{d1ªQŽ^eÐеA4A xÀ¹!€ÀMü3Áö₈I¨_?0° O‘_’0Æ*po@c¹í¶Á…] pAðÅ‚?°‘Uº)²º \41É)þ 1þ)ã…þàS5çøbN5½ôC† ¬Ž4f=ÇK, àÎÁJ®5ú5U\0ÊBÍ1ÖüÄδ°!Y¦ NV!wÜNÆ] sß­7Þuóÿ·Üzgv7«Oþ]ÝtÏÝ÷ÞwûÝxãuþ$ÛªÄj§öpœs>›w¾Éè¤Þùé_¡ºê «¾‰ ›Ì eå´cö-\ôŒqÐÑR/ád#üðŸñÆO<>Åãƒ[ÿÐb°ÛÁ\»º&ˆÅ?O‚†Âý #5Ö8C”9Î4SÔ1¾UL1¼“‹ý‡æ’K*»¤bÇ-þÆÀ©½Ø X¸ª¶·ª ¢_h´€C‰FÄ¡"­j‹QtíHš#àà›Ÿµ„\ ÄÐÅÀ‚˜ÄUª˜„+d± ^<£S¹.RqŠ^P¢1 Ú?ÿèðå(A 8(Á T  Ì€@P…×öRÁ80¡”Æü x¡XÀbäÈÁ*ja…ÈL Œ ƒ iIìP©€[Q­žyc¹hF8(ñÇÁL ÃÁî0Ó©ø…%þ¸E+ô·¿Xô£ ZÁáBNËÐ@†P=$шO´â¬ºPkŽt¨ã­îG6>à0IÄ =" ³¶BÈp*§H ~ÄCñX‡:à‘%”ܹL)áf…Aàᲇ8„!7tBè¬8«Yφֳžå¬hEËÙ2Q0 …Cÿ\v´™­g/‹ÚÓ†v´À=moÝ€Ó;œöTõ6ÀMo€“ÜÞúFÝÈå-ºÑu’s¹úÒ•›`Ã8„2a@y`ö¢½f(ozÍ[úž¶æÊ`ˆ( å-à ñ:z·Nq"(¡/,‚kk0dä/h£ˆÀCì$s`®àÉY؃_ü!µF,¡ã€Ç<â±âÇãÅé@G<°‘kØØßp†ŽuÜ f0cÌ8Æ2ž‘‘hK¸Ð²+¤ªÃ] -²°¯&'Ö:ÜÑ ˜ƒ}çh†P¨á¾i£F9TRò— \0µÿRèCϦB7@v¹ÖA x0ˆª%þÀ„ø01|0£f.Ê2ŠAÕFï/µ …¤CQJס>|„.1A´¬‚ ¤”1³çšÉH/2`¨þahª¦Â:úˈŸzê±dZ ëZ%‚€‡Sá¹v& !lAŒ^ÐcÎSA[è€>´Áè«BчgŠ5r$ÌéÅ/„¹BÉá³Ê <à‚ðaŒeæE-€F1î›'¨á3  ?Œ"ÏŒ€ˆPÍO`¾ÃÑŒh¨•%ø€4&a„6˜JœNHJƒð…= búÃÅ,lä‰Pœ€9ÿƒŠ“Q‡•.`Ì™µ#Lñ,wÔCm¼±‹ýõ°%Ä…@á‡ÆÐ ¢ɉ҈R<Ôb{ C'Z.;|$^¨°5¬‘JÔ?6PK”á+¨@=ù’ @N,kÅìpiJckB¨€†à ZXQ¹IB‘Ž$¥nÈ‚è1)ü¡ˆûVÂ’€ƒ'8‡9(€A?¦‡Gôì¹DÀà€ Ø8bˆöð4¨AëyLNžPù=Æ +Ãà†Øaœð¤$'«~à†6|é̉p?ƒd€÷Š~vS¸4 Õþz2g ö,ýøEÿœ`ƒŒº ÎIÁ býdIßB„ *ÉhO¥<Ü~ [li=Ñg2Р5° ðPþB~q rfJÐ|ð3?45-à @ð »÷Pø¢K®€QàhsÛQR%qJ™œA 2x Ð6°Ð,ó-`+0%¬— ò £pP°uPÈÖ LžÐ®°€ºa pz_ðPöb!’@+2þ°[0ä†FqJ¥$X•ЄÓ{á G€Õó5Lð0[÷¨ð2 z“ðw uÿ`¶â =³Wqÿð'óà"ÿð( ÈÔO1y$ý…€9pXë¢Uð[ÀJ2 ç·|'°vgч”° uÐ Ù RŒ Rm=— ¯à60j€ ýpÏDBB#êt@ p  €ÿð …à2&@Jmcx™!‹FÐ20T`odaƒ•#Ò€(hv åð•À 7ÝÀ ÞRh+ƒq€GkÀ™€l>óT½rJÁ Ë "^5ð{”a‚À„°x˜PØ Ô&”@¡ë€í`whÝ– ” ö¶ ÒÓ ÷îÐT36ý ÆÀè çþ@Xà{6Y›0•Ðô · Ü É “ D ãÀû°üÀôð{qˆa`" ²p äÀ øÀG"#þ€ ûÐ]Éù  «/ã6(ÕM@®Ð„ÙI˜…Ù-`˜†©˜Ž‰˜Ù½Ðô@w@ô0 Š`‹0e_`l˜y˜Œù˜‰yšˆ¹&×™¬ÙtJ#7‚°:µ ƒªS›ºy·¹›¶ ƒ‚œ«Ã›§ò5 š#œÃ™›®3œ¯ÃœËÙ›Ñù:²#;)@]è'Ð…\(7P6@3`7ÿrA€v95€P<%x °O ’.Øs5˜’ü‰ƒ+©’[ úŸ>8“29„2Y“1‰`8Ö„z`Oë™VŠVHrB ”2Ð+ q)૨œRÙŠÄhŠÇ•‘éX‰ypou9p­i¶ 渗÷o—¹–þ†ðv/꣔Çm/wÜF—~ y®é–÷–ÄIqÐÙŠRj¢ËX¥'ª/ 2€- ò û()@Œo秇|„W°–¸(n¬—‹àö•&ŒZÚ…Ÿù§™Œ`zš402`šÉ(€½øŒ•×m,:w< ›mé•Ùÿˆm阛¬©¬¸Œ›ÙŠÍ©yõ˜yôˆ›‰›·)¥¥7ƒ•)°Š•*•¶ †Uê§\øêÛ¹/ÐßI6P9 CP`pU8IÐüd‘€µH@vàrÌuO @sCÇsBÇ’ÚŸ?·’9¸’þ “DØtj ÞZb~„c ŸM(‰dWqUAP…FyB5Ë¢"z¯ªY¥÷•îÖóön,j›Cê¨v‰ŽÜ&°šº¯èèsw—†ç°Júx#À¢p‡¦o?ê—ÏÐ)–çp8ú°) ™˜qcÚŒ©¹Œ§©²¬¦]*D`*1p˜ X²˜ÿ¸p#Ûv‹lj€gsª¥4pŸ9´}º+@2p~ZÛ ¨”J•…êš_É£Øx›Ä©›œÉ€Ô¨¬Œ¬¸œ¤jzÄ´¨*¥¹Yz‰¶¬ªÀµÍ|bëŠÇ(K{·/°…@à5 ©7@«ã™Cp…{žaðOìÉžx¥bpzfhD ‚L'tþyƒ: [ÀƒJ“غ­1Ù­ÞštuP¨ V9&¹q$ð„æµ®%p`v`P@5 €!¢*p˜Äè¾XŒ‡°Cz±î–Žfš¤ÑK±Ð˜¤˜ª|ñhx Ç¢×Æ½Ž xUÿÛ£[¦§çÏëŠÐ ˜ùHq—çò&wáë¤Ú†¤éH²Î(qcj¥*+ h¥ÚYm^*«ŸÙµzŒ,`½‰½ÞÆ<*}о#°<Þi«¶ê·kÜ{G»ûH©ƒZ½ÙëmUû•(LÂè|«X¼éª\8ûØ4;¦a •6lÇ©¶ÊYªR:¢ÈY©);ÄÌŠ$ªÇ™O«ìK)3PÞY;¸„KrS0¿:gkeWxucàr%m¤ ÐZ i܃œ+ /ét7Hº¡{º2™ºtº¬«ºà PP®v€ÌÕÇpÅOì zEkr70) ‡ YÚ€¢)Œ+ eH†Ê‡½Ï½+,iŒÉ닎 w‡J¿èH±"{—×Ö¨Ïw¤ K×û¡É›šÃÂûг7+p+°é¸wGÊ™Š©W*€/€‡ ÂȪ§Lû²ÿ¹Ò·³zÙ¡ˆŒ4ŒŒù‹¢+›<¿×´\U|ÎU ¸èŒÎ éÁO œ˜ðÆÙvÂ&,ËéÃcúÂ׫vÊÕÐ]kùk¼6œš9<¶ù‹Ë©ù‹EL¶¥wÀ'ºÕiÎæÜ9¸;:0…;X€¸ O÷©Vpy¦gcðº =ðŸF‡ƒPׯsLÇtlǪÛÓupÇw̺«KGð@±Ë‘bà\}%…C 5e§È‹ 30´wz§°úÌÙ|À© †àHËbÊô8-бŒ©I€PI€qˆGÌ@Ìœ|¤Âù|ífœ×ÿÑÉ¥}íŒ÷¡ |š¬è€/ÐÌ­¨© ÊÛm¸)œ„ª+੉Ðlí‹Éø™¢¹´[ ÖY´<\XÅ3ÐÏ9ÀžËÌö¬Ø®Ý¨ã<§I{;¸6PÛëœÛç ¸®ÚÛƒJq—l°§m©ŠÀ#*¢¿è1ðµú·­*«½´¾}·Ä¶7ŒÝûØ‹-|Ð…ÃŒ ŒeÛÖ6¨ yÞ ž3°Î;pÛ ÒCS ^P…A`ju»·ëOÕÒq€FÙŸ;àU×t.uUu j v ÔtðÓ?ýà>Ô«[ábp €'@‚v5pPNmWÅa`…ÿbŠ r3°â.@3«´Ÿé…K+µ™‡Ü‰À´ÊÏø¡¢ºŒjͲy ¦5«ÉëvЋèxÖ8NÜŸÜäи§g˸ܿ¥ù¡©ÙœÍ…ÕyÚxk©· |€¹ÂÌ݆ㄊÜRú¶–]žMÝÓ-1LÝ9À]?R¸+nÍJÛâ-N´šÍ˜`ˆÀø†Â¯­Ø;&À³MÛ´}Ûî½µéŒéŒ.žâi´<ã”LÊ·Éóë¨_Á¾XªÊ •ËÝÜéÜ7~ËêÔíâ­z}㟩¥.€§ ü§”üµa›ëmMÑØmêüØP)èÝÈxž4 ìíÞ:ðÑÿ»Zr^°ùÐåÔàOþ ÀuygqPü¤X@঻h°ì®îk@ïïðNqïÔA]v@yÆ„þ¾ºzv}¬Bú~aÀjö4~Õ¸"N »VŠ,9°â@ð™¥ý™Öü1°å'ËœÁ|Á(ªøûvf>q,q+ïÐ8<¦ÍLÐH;©d]¿_ΛiˆŽÜèhã<ŸÖ*»¿À=ØÕ™š­ª´¬~§9[m󈾙„z¦öøô@›ó9o. ª¼^ô¹ÎæZMÝœ ã¸ê5à€‘T r­öÀ»Ñ¯ì¬ÙeKÎ߸°¯L›ty›ÿþ¨; }ß÷: ½Fé…¿:éžø.žUì·0ܵ‚ ™Ã9ÎéÈ™Z*1¸ì3ÐöW­êLúÇ÷JßÛ è˜XZØmÞªÍë¬ ûvz«j?žC0¸´ø¼íMÐG`b j0AðFmÅVÐÕ¸0b ŸzFƈ„=àD„ úŸ<€DÀý@Àý8€âD0þxšþˆèoþ'ˆcp q cpzcu5”‰Ôiv¥È!3nä°qãÆ †/n¼ ‘†Œ)\¨HÁBÆWtLÁñcÅK~¼˜¢¢ Š)(²œÑÿÅD˜,U°@bE‹-PÜTñó§F¡@Q˜´£ +VÈxÊ’%D©#ʈøPaV cH„xEÉGS˜8›äР#F$ëB® .^´|Éòk×½Z»ÎÈ£ň5‚ü“÷q¾ ;räСãñdÊ4r,\øBsE´&P¸E±ÁíÑ#4ŒýÙÄŠ¬;”(ÙaäµÙ®m¿ŽM{‡ #/o½댧ozFîVùrÔ&^¸ x1Æt3Ïœ£ÆõÇ]~ÿn0ÇëÂ¥ŠŠšg¢ŸºÙ%Äê2fPÜ|räÉ;lq¶&š8b 1ÔXC 1.(„ÿ%$À àÐÃ;Æ8ÁÁBÀb‹4F$qD:z€@@YD Efœ±Åm¼ñÆp Gzl ã ãã–|PB €àI–$`0ÊCŒ)Ž€b¬»¬¼l¨Î»êHJa’œúˆÍ6™JSÍ4á| £:ï²ë<èãꆮ¬Z)¨œ’ª£4 ¨B×s)¯©ö|(¢¯ú38ðÀL¡ònK¥ŽPp­³B54¨‹Ž3Á…·X8•®<7ÛŒáøÊÊ ê‚ûË¡bø®… KìŸ|jØaÈtðò1ɲ“LÓàÞ{N,´PMÑPaLÁ©¬ÿ”Hâ5%ŒM\s‡—6ÙhÓÁ±0ý\«çœ2 ¹£¸½÷¨ä:O8‡Z6;Ê(»”¡ßÂ;øƒ’¿Íäz•0YeÎ>—f­OÖêbph/#ór‡va#6#,p Õ€ã|f£œrI (RÃ;À˜ÀÁ`ð‚Ž4„zh:¶€áåavæ¥ x€¥!ôPj©¡žº€ ïÐã1>0€É)'”’f*8AŒ2Ä#Š#¢(‚Ùl@(ﬓ´QÍô¾ >¿ÿ†Ž¢bXÁ_Í´¢3„ºÌî‰BâH•ìlÑ:!Ÿï…î‚)«‚Å»T¡¬#]€¿n¢‹ÿîÂü¢”RªüŒB«)ŠñóëÏLïÆÛ`Ð1ËAM 1y’(V]t‡"yd#“ ïàfp£æ>c´£žjM '¼w"üð½Wb‰ï¿'_ÜÜ(“~/èH"JÐë=k޽„ª›{tè÷ÏaˆüØd¶ŸÑpt÷{Èí`åžçĪb{²Šçþ²1ü¬yè*É\óš&a ÊÒÔ‡#„kV£´¤(-‰p0Òâ! P@цf44€á2›“¨ö¤Ñ̈Š͆(µáFš¡’!"QJd»Zà †,aáM0ÖþÀ¤¿ÉaO}Û“Äî‘ÿû`%‚m”‰DÖ:ð4ÎcÇàebÐ?ƒ 6¬ô…5`\é¸Àý5’Íê›|$©@: :üâÇðG&»)î;$£ÇØÆxŠÉG’€®%,¡|å#×É”Ð<þYç+3΢D¥­ŒÀP9á bã=*HÁ Å)J CC0†-²mKyž#õ˜É/”L¥„7Á2õ‰©Î§~(ó1t=yÆê§Â4Ó°óÀ ‚ƒ×ÝF'U<úæceõRZ•€¬ä¥UJ¸ ©·zjÆa;c¬´z);•€ÐóMÀ”õ @fAø•<€u¼$¸Ò æke+ K0Ž2¤›œ>¥_ú2laMDlàšfS ¦­ÂŠY*P¡™W¨‚1Çgæö]ñÚ£æLÒ‘øe#öñ«g9\t w•¸¹ [ÙêÖ¶Ë7·âK!¡Ã1Å`&}'až¹!«•ÿ¯,ß’ðò*á™T˜ÂưÞ5Ä! ØQ€(!(M©?RÀ pÆÁ¿-€š;l”娎€‚N‰ŠL’Pƒ"PÒD©¤WTb ™(†ÂAÒQjšD¨ PSZ°¤ )LŒM.²fiÎbÁË!Yªu€`D~§:ìÝð&Púô`,a\\ZÖ­c7Np¨/k梛jÿÚº\晓¶ÄB,‡+›!$¡;×TØuƒKïì%S“âëA¤*0c3­éž%Ó<-ç ŠULbûó¹– æ`ìÊåù€{ŠS¢ÆÒKŽ4¥­‘ÿ®°i+pZÓšf­¦7}…ÖB³œóñ}ìª9;…Q®fYeüJW\è ×UgL[æÍ¸×§ìŽÿÔ•økOԳ˙‚ü˜ ä`rî'fi¾Èš÷ L¸6y¥ð„+t½cHè N\€  @%¦i} Ä  @\jÿŽa&\‡}ó»e¹Ñݤª­t¥TrR”†8Ø!Hº" <@†J55°%½À¶˜%1º²Ôu¸Üõcà`ËÕ|Ìv¸Èwî¹ËÌ[¥øš0ÙǺr ´½ŽQ·°[§+¼»’Ðlsþz¸çn­ÿ¥Ùž—o I˜ õ²åÝ9KŸ¨#`µ|óbe°ìË3»ÿnXÅ.v¼Ï¼‚âÞÚÖFA|æ{M˜}C7…h®"m*ËF<â R˜oµ²°ø,Œú Yõ¨‹‰Lq%7;¤sÈy÷w7±I3™Õú]Ÿ›×ƒµ&®¹T?ÜØTõÙ70¼V 7×3Rï71w¶™“~ÈÌÍ6ÐùT+ülc{ÛªmñzÕÀ2!$àÄ À@pn,¶€z°€—]qÈЂ€µ¡Àîhì°‡0ÀEBBxÍ*R,F(þRóþÔ?C ) û)B©+’°Y€(‚ѯ$àÿ©5ƒ1Øñ!{ WZ¥è9ëp9¿"+9ƒ'íµt»@=ð¡»K&ï>ÙØ.3¡2ƒøÒ>»Õ›Àò‚Òƒ¬óÑAña¦%ÀªÌË”ù‹ßY˜¨"«²Z®Yjž§ó5ÖC9”—H@CŒà¶,°.`¼Ç[Ð>ȃ> …= >˜Ú©åƒK¸eÀ$˜ÿšõ @q)YÍ9±òsΗ] >™*€Û¨J[êc9H…ºÝlÙ¼ÕÛ½åÛ¾õÛ¿ÜÀÜÁ¥Sl˜…[pW°2@NøSç$‘5 ê“’x(Ø(£Yƒ!ྸ¥ÅÁ ˆUï¬N>XZ=ðƒ>xÚ<ȧmÝ×å> †Kƒll(“’x€Xµƒ;À `œÈuN1© ¹YÐ7¢¡ä…š…“=½mø†o˜ÂÕÞíåÞí –îßð_‘Õ†[¨ÛSÊ©‹*ÙUwÖ30¯ ( Èà=‚° ˆƒ>`Ú¥eÚ®Nÿ`ÕEàÙåƒ:¡¬€ ›I½ƒ1¸°!zY‘\p0©)ó304ð(!X‘@88R¸…^è…_à†ñ…á–á¦áî[%Ó¶“Ó}0‡x0s`lX†Ux…W82è °TE5…û½©Þ•_~£ 9^-€€‡£7 X¡ƒ§=`Õ5àÕíƒÕEc?Pc50¸¥I!”¢™ªN‚°IÈ!Ú(1€ ˆ!XK¿:@^@.€ ÀKx…Yèmxa–äI&Üï¥äKÆä@«Ââ9¥¶+žÅ ´Äplè…[XQ°„@`‰+€|Ë\¢Qÿ?1èÙ¥Á8ð·h,0Ââ`8±þ¸€8X]ÕõƒÔ]cVæeVã?Þ£™’"±–¿;°F)º\~3*¦à_¹Ü;Ø·~«0°_È9p…RHæn¸†y‡L¦çz¶ç{žäÅ –}ÞØåg}îd@Óáyw‡iP†^XR8K¨Õ°Üæç«â"X€š]hT¿ô›Æ fû…ƒ‡³N!› >Pæ4NiNæ5þa`€$±ËâjÔ8 %)€" h30âÕ›·BN?ë< ˜K8…Ymh‡pwÀç«Æê¬Ö“ê¾µdO–‡~øê°ë°öäMþdã –y˜w˜†iX†[¸KH9Þ–Zù¥hôóãñßhÔƒ:ðNÀ¶N @Oÿ­N;€ƒQbïûƒ3V]>Pi—þƒföb TCµ©š’8)q€#¨æ¹CÍ·ó#giø‚U Qí¿>ì<0g©‘€08…SH…]l ‡xÞêÝ®ÿgKæíßÞä|àg´¦B¯&kã>nöçÖäy`‡yÀv(å[`…S˜0X(õ+miT0 ÝîlÀFÚ;à8ÈÆ!ƒ=PÚ<8‚$ àƒ`8ã5¶oc˜l?ÀÓ?(†d¸„ 8C…’úJ©¥^ƒ'z¸Ð^7!0’îV?=÷óß= ïN­Î=ˆƒñóàE®ÛYÐÜÎ^àñ'qNŒ|Pks¨Êïm»~k6n´>Óÿ·êwî’=ÙThh2è‘9 Q¿iükòÖep]Ö®N¥EÝ=è$ñÃv8Ñ€ƒd€ìfÞïýVcüöƒah8p*p•‚ÿ™ à°=!tÌ):6êŽbí'‚|Óƒ=èÎM½ð:8˜i©F~Vxdlhµ>Söíáþê~(ñFwôGgSyPñ4Ýgäöm6Í^C×ôçôyh‡v l(ߺI8yÏ Áåïìõ³ÆÒ]òXoï=8ï€<8Š’¸ø¾cýþüv?0†c7†c†d˜„"ÍŽ™ ñßøÜƒ1Ð i¢îì·êlõ:‡häTïäÔqßZÇ0Àšˆ~…]èBC/SNž÷CÿjHÇw7½ô|¿gs˜çMxPÞw5Íô‚ïtWëy?ßT`ÜÉÿh®yp¤5Ý ¯ÆöÖ1~ÝÔ̓?p휺i±ƒX¡ƒdbßòaç<€—?÷§¯ C¡û-’Bw©‘rŠì ×ÔÿÍøqσràŒ'…8øh^ÆWx…Ör‡Bgq¿tNVî«/n2tsXSn~û°ßÛÅr‡®&nz'x2¥ñ×ôLïô‚Wsà“=_9(AçšîäšrÏs1vÚ¦EÝcFiÖ]fTØZ©A€^~¢™À•ßo`7<¸?€8)Ò],Zši7 v ®©xq¯óŒG]vZÔ-|–àó>1x!Q@Vpdr`ÿ‡xÿg¯îg]k4ýä²Öd±Ÿá7~އt@Ss`täŸqNW ¶W{‚&Ó—þ„7u˜{”-…S¬y€Fýãöï>(1Ï©0Úßeà)1ùc/öý†c<@<`à(l¨°cîäÑ#°@„Aî쩳§¢=yòôѳgOŸ‘%ûø!ÉÇOŸ’~üè Ï €™T*Uª^äÈ…›7ïRyJ—þ“×)ÔG£B5êÎ)R£T¥Buꕽ~ý–bÝjö,Ú´jײmëö-\ªeãÒ­k÷.Þ¼jçžÊUí<¯MÉFçŽÿ»iÚR½zeIŽ €Égž’'3ŒY&Ë™4E‡í'Ø% Ôàh'˜ tÀóçc¸qó§„³2\H|BD0wâܹ“DA…$â2²bI>$3ËÌã‡K–Ÿgš>a†aR¹zT[¸víü&­¿•þßühù>¬ô)z 8 n  *¸ ]|! ~|¹SYcý—•|×hÓË*?áF’ÉG|d&ÒJ)W‹ Ö’h¢Ý–ÀÂD{ØG²A@—3Ó}üñÒ‘@L@“ ÁB’±PF{,Dðt‡f)¥äÿx1ÉÄÇK๣Œ§¥f!I)?õ¢ÍPìhµ[ø™¥'ƒ}úù'  :(]ü9Ø¢TMH!YLAÕN|ÚhsK*¤ˆ" ²)+Š™YKp|çy/¥)ÆLÂàŒn @ÌQ @ÙÁÄÓwdúÇÂG\q e™Ý†“‘€Ç| $¦wyÀá]y1†–2ÞæªÉœ€ ! )ïÑÙ;gjŸ~|íÕ¡‰êÛ¡ýúË‚ÿ <°Ye0Âú×(†Ci³ ¥¤ÌF™}˜H^K`a*ih#Á SLn·év“ÿA 0ÑzĆi›˜ e«¤“L>ÉÐd.ÀÁQqœ€@ À‘±˜ça ®pàÖíLÁü! `ä–²n¯& L„—¤2˜ڰ3¿mËõ¶ÂxÊ 7Áu °Ýy Š·ÜïËèÂXÉ3ÏPØôÂX¥ÄN¦4*fÎôY0Ä^P²1 ïæj1`p0É´Š›nå†Å¶Zv4r pªqMÝñ¡x”±?Ùf ˆÁœeI\06À0 ¬C¢9n2|\pÉø1Œ1ÆøáªÉ8‰M@“…¶6ØÈwa¾sÿ•Á~›¯7úé«¿þ]GUþ¾sá-xàUµCÿ6¾RÊ)xä‘ÅÊ„¦é¡ 0ÀdžA¤qE/“Èàй™Hoz¹Á‰BD<Øá5PP@r1í”$$&—“,…@)D‰š °XRŒmŽr¸Yàm’1ºá]âk[³`0’† HI¦hÏ-z ¢8ªoôŠ›ÛèF/¾±¯‹ ò"õâ¾÷YQ‹dDS.4µåïaqšD˜X€”ì‡hŠ\N"A«KeÀ]p.f<;ŠÂÐB DÃGX¤áA[$ÝÏhç€Û‰df“¡ 0€£ …ô9⤠a8ÆôŠÿ“##J€ÂT¼b» SQø”ŵ…‹âã—1èÌe2³.\„ßÏGF¯ÌÅ(ìÈ_/nÁ¿@ 0†a¼*ÏÁg(s:ó!8 ‘ )fB&niL5b Ã:x1,h+!MB"’<ÁgP‚R–`¨£;À¡Ñ1@ïF©²dÔÈœ`ôú8#Í%„†‘r¨1¨©°r@…+|))sÌÃ[4c4_ú7hº-™Í¼)NszEšî.òâ`ªŽkî¯ ‘³¹tÎ(FÆÐ\q"Á#Z0 ,œÌð m,$0!–d=Øaq‚®²$„ÿ T ŒÃ ²´€™ÌH$ ¡L§q U˜s!ăôìø‡óÈ Ròš&>Ü¡Þ ‚%âÅipÃÜØG`ÜbÓ+f±¦ç­N†ÚÔþë§1Åâ0µ8¿iføË&¥,‡@$‚À`Õ¸D32Ëœ•‘õ"@×4 [%ÉHh“E"‡G¸ YÅЀO–` ©xCb‡8!®³{R튀;=ˆ!®ë(‡:c\btÄyì䬆&ͱ H»)TâÕ̼νÝ5›+X¡ n„£(æ˜×øhêÚ½¬eµ¬½0†¾ ÌŒ†é?âÓÃîÿ—˜l„PFÏU»©œ!‹Kß¾$&|М® ðÉ ÄA;éjfààÞ -fwBF’V+;è¡Mï[P³ƒf‘VZ(€ Àa^æ£Ê|S¬‡8òcCŠÉb—×ÂŒ<@ . vBÒ‡™!-%ÀÃ)ò,EnåÁº×k_ûab’v|>4¢ dL÷ÔÐf42C ¯ Q*¦/ÚåÄ6õ4ÄBHˆ‚@<Ä$ –l”«ãÉTf$m•³²<¶8ppc(A– p1ä¼¾öµŽ]¡W·³ÒÌre1` ã ¬à«ð+„(­ YŒn|€ÙE@¹Òÿ©¤uÚJ8Àiƒ%´™¶p˜#„Žð1ãíèB—6Ñþ²°½?ÙÂvÞ^ô©)–’ãp»HEÿÂ0084/±šð¨ý³ÙLîͤÀqŽ–lëÕNî¤\¦ž˜ î- àðkðÒ¡åq(÷ì P‚8Ø#cPöä^5.–5jHˆÚäÍØq(–céºj¡Jר“ïp„L¦r¨t/|Ák˜c‹z­ž>L7HëkÂpKcPó­ |«¨ö7ˆßÝoi†šæñ,R± Ç„JȪ(Ãó#¡â7Ô&”¢ä²µöaÖK€ß“ €„¬N¾¼ÿ„ð±¡9"!÷';øºå¦¶¢T14§¬` Àð[# ¾x˜Fˆc¢Ü)M;ÒÞ¶ÒV¤¼òL†òÖ ×É„A®(E/æô‹x¸û™‚.#…E[vˆÃmÿ~ÝÌ.vxK³mc4íØ—òvh#oÀ€ É’%%ê)â@ä(×8 qÙ]õAeá^“tÔ]‰”ÙÔÁ>YV„AEÔ@ߘ¦ˆüÌ 0‡ìÓ%ýÝT…‡ ÃïÝ×\-Wé¼Î˜Ÿâ!Àuu“‘^x‘×v@ ÀA)¸‚+d:€ƒ8Ôiñ O™ßLíž ü5u_P-ZvŸ½ÿ±Ý÷M…šÙ½]ŠOˆRäÃÅÕ^¥"&ÁeIN()†°ç#ö©•®  Ü.ÈÂ2tƒ:Ä‹}œ(ÀaßU g‡§5&Úq2Ó¥ç1aTc…QE;p7lˆ+œ‚%ÒMN2Y½*y=@ '\ÊX&^®!`ÁøiŸjAlA„Ct^ÔXI†ž"¦,f (EÄA ‡GDå‘UÍé_ÍÌ“–$®’¢²d‰”úªŸ¢Á„@Íx(Ý‚ÚØÉNL%çleŒ"¥Š.çsÿÂ(rêë"¡B…6zj1å+ݬѱƒ¤DßOH‚=%@­èÈåi«Ü}ë;®%\úWF,`Á#ŠikŸú @„êä“• ¤B€ˆéð€{MDZŠ”C<’Ž"°.íð@@D Â+œBPÔæÚ0jW Zö5ÚsžßÛ!¥þ&¿‚ ,×£¦¢íVDãQx-n-RØ ;°Ã¶ß)ÌÂ$ŒAÈÜK’ž *àr @d`¬­ì KFt¬xÁhÁÒ¦ÁhÁ«M€ÀAY' ¬Fô`)DlÒ±ÿ6GÔ0™ >™¬Mv«·Žgä=–’bÑñA,-ïŽìb"@HÕîÂ/Í­VÐÏ…¼­Lgi¹­ÛÎë¾&çØ†Q€Ü‹UÂíón*`g1ší‹&'ªCþÌÂ,ˆÂ,ÈÁ@ ÀÏ–ìÓÓNÀ’ÊŽŒ!ž²À^â‚f¸¯ëH®äR®ŒÕÀ,T¼žØ_ô€ ÂÀe ëph°Þʹbò Õ5)yªÐ±Lܸj‰ßIGìîÈB®äN®°>-x@ÙPíœx;$å‰òÁ:o1ÆÝ¿ÂV¦V¯Ÿ øfÅ×ΛÁZQhu-L q€*þÿ´Â¥‚%,Q>ÁtКfü.&‡>ÉÐ~+âbì¬ÀåN®ÿ ó@–ZÌ,Ôì•d,@Í(Í«VÖî€ÀÀbL¶œ`o”8(Ærqí!ƒ œðäB®#§ñ™j@ \‚%…åÏ<´ƒ`ÜË__Ú*q¡¡VôR/ïÍòò°¤Âí({r¯E‹­ÀE88L/”ácœî’ÄAËiqË­˜WìŠqþŠ±Ø„”ñ#›±ðÒD«k¤¥lH.ÞÁ€b~Šbà/{E.i‹±!ß®B(2C.k·³ð@|&€IUr,ì6LQ0ÿcÙÙk(ŸV*cß‹’ß¾–² ´í)óT„„íT”oN*l½2ù”ŸsÎC8”*‹‚)ÄÐÊ\ xt¬Á,æJ 1“gíM:·3KOn3w ÌÁŽX ®é_Y™ @P@a* GGdëbºÊ²Ô¯1ëìüH(²øÀ³s;7³º¾!Hñ,ä÷ÌVìøþp¥º¨T*4¥‚5A†n.Œr6eôƾ çÇõ?åVLˆ!ÿ´Àð²H¶H·„óbc¬*]–¸ìSkeK¶Óž)ÀÁ$°‚,¤|$oRå>7ó¢²\ÏèP.ôYp3!lñæøuj?ãpÛеØÚ ;ôÛ(Å7„»Â$°ÀC € œ·A@Áy?mb+vk£ô!?6ð€}C¶}ß·  ͕̀!VÉ"mt€ÁyA–žéJu|‡°·¶Ðð…d÷@~ç7à€ ¨dA ô‚,È‚¤ÃÚLÅ)ooko¶µ‹ 4(/·^h…Q4a‹§íX_£ô¶(@CçŒ×‡8|Ã*€Ø‹½"*b¯+b¶g‰Ù?+Ûƒ½Û³}ÙdÜϽك}Ù÷:¯—½Ðùس"Çç\¤%ˆ‚(,R•?ÀØË¹œC9ÞϽ–̽ڿ½ä·=Ý—}¶£}äS>Úãý“ŸÀ$l-ÿˆØ¾»¤Ë5+7´¹[½£ØðÒt¿'qF4é ÷?§~Cªß`Ã4LÃ3Ž$H ð+Ì$¿ $?Âñ3?,ó3¿óS?ó/õOòW?ö[¿öC÷?ÿ$ÜÁñ«Â)°‹%ÄXªJ1К! ¿ü??ò¿ò_¿÷‡ÿö{¿ö‡?@Â3Px 8PàÁƒðLš3©—¶gܵ›7ïß?yA† ù±£9‘'I‚LyåÈ&E®ŒÙR¥K›7iÖdÙQæNŸ?îì”(Ë•C‘í9´£;£B‹â”9êÓ›L~äÈ®¶iÚd)cuêTªÿ²dO™:5êÒÚ¶§.2%×RÚº£ÈZšKV-ÛºnÉÒµ{ŠTßÂñÊeK˜¬ÙTf-‘bÕöV[³¤N±š¥ù,ZÏ—îÖ+¯èº…OiÊ«ö”¥Xyá6…¸î[Ñ­OÅõµjK¬v-“µM™¶yä4ÎK¹<ä¾yÎŒžSguŸT­Rêq;÷«ÝÁ‡¯t;Ó¤Ö«z'ŸþhöôÒqe>}&;vóÔa{FKV/ÿþgée–Çð1 LeW^IåVL°À”°ÂÜì• ËŠÐ”WvaEÄ[Òºe—]z9E+3VTF Ü¥Æ S¡ñ@ ]‰PÁ!Ä-°,CœpÇÇlü‘AU «—g´ÉH#’ÚCO»øè+I*ôÎs/Ëù²¤»¨°ÿÏÌ3ßS/L+Ç´®L5—²2MøÚIJ:0í„iûÚal´y@Q P5t—YN\ôDF0@ý¯RB'%ÔÆ^PÜEY<½E™[ücEÔþz‘…™enéomD U™PÿƒôQGO°P] °×\g™4SFw…”ØDoE›eµÁ†r¸Úhº7ÅœsM¬°½2%˜ì„ÏÎl«íMùÆ 7½]SNoãD7ÝïÖ¥ÖÝêœ*ʼŽ8êó«pe¶¢ÿ ø_ Øà‚þ÷à….¸—nºQæI(±ñ³"@!ÖFZ46Eãe+z5á‘V˜ä“KÔägþ„6¹iÝ£ÿ¶ËtñüöÊøj¦9;yå-×çÄqNæ¬lW]kÕ|÷Þw“.z]—öTgžk¦é*r´!ЭÿìÚë¯Á[ì±É&[›>%çhçé›v*Ʀu †X™ºñ®»ì½ùî»ìn´áZnžƒ.Ìváezi¤ÓÌùº§™f÷çðz&WÝ*»¹iÌ¿tÚè;•~ÜËžIRßãþi§Ï>¡­˜híƒ]vû^§}öÚk‡÷Ûyß=öß_ogä›§g÷$gÏÀíS‡öç›wÞvàqÏ}zß©×]ûì¯ÇžgúÜs£ñEÇ\Ÿî’ó›Õ#Ýó:C2¼òÉ»“Ç~ÄÙL<¢ËŸÿñ•êå%5™C&ŸÀ'´äœŸÄCK'‰V8²vü#Z|ÚW®ÁŽkˆÏ>ÜSø°áAgtÐyÉ‘^Ù¡Žk¼í‚÷q†øF¨ÂyTL‚LÎÔ6bºklp‚ÆÓà}f¸gDdÄ$28iì©bÖX" ‘Avtb‘ðÓêîÄ,Îã…Kâ4hˆ VŒ‚Ñê¢ùÔŽk¨Îx‰üþap¼ä I½¸e¿’¬O[#ÊâvÆ¥ÑYr>›ŸQî'ÀCF.'š›—ù)È™ð@"0!z¬Æ÷è’€C9¢Œ(IilD#e|ŽŸÜá”­ü#„Ïqÿ;ÜÁ‘ :—ó @þ±ÁUŽD-M‡Ã H Æ< €|b#èpG2Õ!Žk€Ä)ÙaêL§Åy¸#  `€_Á”Æ+ çŽv޳Ü„Â)±tÇ7²Jg˜¹Üˆ,§Ö”jŽoœDè<¬1Á`âË%à@Â8JvÄt‡GìøÇÏ9ŽNrRŸH?×9FÒïL÷ûHY3üÍs›cüÈ@â@„A§ 1IªÇvSZ }N0uˆ/tX£)ÿpLd €X#‚×8f½Æùœm‚ÃtÒ8æ<Èÿp€X㚘À6Ýh¸«zd›æàªGµBÁŽ@‚>'Ñu¯ÿP‡;À1O¬›ää hT•#o:äá”TƲÛÌ¥3ÛÕc>±dÀ„DÕaÃéõH úáDêñà€ L®!n4L\éáüÇ>o=•=Šd)ÿ(÷R¥‚‡g1{ÏLûÝìÎÇ$ ¼¤¢ñNpà &€`à€øDGŒˆ04ÕøÄ|‘À‰øB€o3!áŽHÌ×µN1‡hŽx@‚ æÅD$Ô‰þbB—ÿ€FS¢ ~ úí4ÈÐS ì¾H0ŒØÿjx"˜îˆFˆt¸#™À„'>¡aLT#$ÛìÈ5 cóndÀÖ)'Âð h’ÆK¥,ä Ê €ðo;btðä#ñ˜’9@ Á¼ƒå'È@hÈã—,,ÚKǽ^õHÀ úaŽHp‘0"&:2ÇNhøíõIÊ[›Šd´›v-êÀo}8•nJŸK4—NW’íkäx®®JÎ'!•IHEbL€‰ü‡†=,õfà˜Z wÄẌñ„ 1‡Aˆ1|½ÞL€8@{ÝÑ_“¤Î¨ò­#ã{†¡“˜À{Û\Xÿ•Êר‡‰â¡Ê¨‹%'2€®b¢§>ve}É[Ÿ΀nà?âqI ¼û½òزý8ñqsÀÎpF 'ìÜà0A½?å„'|Íã¤Êÿø&¯ %O ˜ äŽücŽÆ%ÃpØ0@ ‘¥L g[2ÄÀ$²1IÐò”×Ú&C4"¾ã2n¦8ítvÛמPÛ‹ºòˆ‡N]štTK:*…èDºyá\¹îp ÐñÞº#‘éàŠIòrâ1F ?ö @¾ˆ@42â>å„”áÜ‘«Ä¶w¿çm!AYÐýž™9ä[H„ÿ˜@Búzh¨÷ý˜r:ú!ä’d8´ÇÉàÓÚÚÝ¿—D‚§‰ Ü3Æøüë[¿f6‡a¨sæ a“¹½¤~«| “Æ&*3ÑüxBöu@ÌŒ |@”ý2ØÉøQ´õýÀD¶1Љ¸Îý=ý Í!pœsŸæ|¨®,­&¤2-+PÏ~R/ÒI»0nfêJ)]*pÁ€ª|*·ªÁ~ ÁÚÌ!ÆÔNüà#ª¡ä ôˆâ6°¢AÌt Zí¥l¢¶ÊäÁ?Æ,·®. A¿2LÃÒìÿœ<í0@\°#„írË#úÁÖäÁ¶0 à áÖ^ÑÐ̶ÏÓŽ/¼^*Èë”@/úážðÌ~žÌô0?€`ðZ+ÍÒën M“šéàZ 9ÍjkòÒ!|-óRí:¬y" éâhÒ¶D;Þ¤éºî‘¾.sbâ¹cêXJ6ífh+>mÇŽW sd*(hŽ<ðTàæË¼8ʶŒ–Jï ÊΧخ#ÁO¿ì‡ãBOõ@ñtÊx ¡öAP°·QÎ æHŽ ¯°Â ¢ô>bñþáÿœúAºì<`míœâù:¢ ’Ëäa:áò0 é‘;R£ð¶šÔËãáÆ/ ô~JùZíÕ„ÍðÿAðàbϱ™š‰r L”Cçú!að#ÄïŽqÌ œBW"©@͹+r ­©‚JL¢ÒÂ.iŽ2醯¨°Ž¨k'È©¬Î¶>à½Ìaæ>€Åâ!Æü#f·"`ò²pÕR°#.):ÁïM§(.ûì «ÁYÌ ‘ÌÎ)R2oñÎÊ¢aŽs¾î~ÒÁ)+@iñÚ¬#³Ð( ÐÁöR‚ lÍá’öîÿ¥Ú,Æ, ŲPÁÚ‹âpë#VîNáVóÒcåN¬Ñ}ŠŒ½r«è0‹0¡:‚rˆ0á¹­#Ækîòî°Î§Å.¹È »J±) )’ É<‘†üO;.ðÑJJ: N½@ØÈŒ$ÐÎ§È ÉÆO¿|ͱ²@â’“è#8Žog/æäKðÀb,H¬M;BÖdL’lÿlÌÎLàPóB§ì§Aá&¯ $òÈ#¸Õ&n¾bÌÄ!Ô«&NÄÌ‹ÝØrŽÒë¶HbÊÈÿÍ|ºLáÞ ±¼Rñ" $>¡§Âï¼0·Ö Œ;ØÎ¶ðÌØ Àæ:" 4ö¬í?/é+ÃÌAiJq®²'˜‹*ûH:­L R=㳦Üøâe»”®iP­ËC:`¢ìóÀ“;âAâMب¬H‘­¾¸Ó÷@©Ö0!ŒÚ1ÄŽî3à½<¡§òÓäÆŒû0ˆ§ ÖëÒáEy½P.Ò ? .áNN#3€ÇTÓ¶´­ú¯¶|Š€Ì¡’ ÕêB´å|-í–õEá1Æîþ(‹?læ ´#>A¨ ã!½ˆ"¡ä„ 9Ì~VìÈÿ’Ù| ÐÄáí„f`EwÏ9Ë÷B0ÅL? nM”Q*ÁÛ3)—Ë“qÔóé.V&˜‹Òšk¤~â×>‹’%@ à„2õ ëhð€D‚ S"8¢^Dq¶äÁ8°#4n©"¯¾>´æH(ÿ!5%ëèèèfûÁ€2áaSÒά·8‚$ì‹:A׸ƒÇV¢N‰ $ (i=­ СQo–®Í\m&N)$ú²P¡Á.n:‚‹;( EåÀˆ^Ç:¡¼¾ƒ$>ÁÔ¯#ˆV”VìÌ>·Kv=LQ<ö=òt=M\x1cß3Uÿb£’ð‡¶ªvQ·d£\-버#˜ ©Rr”L¶9íßâNíH?*: 6$øq©œ*Õ¬Ž'Ö‚F%vg="ƒ²$`—\MRO¶&ªAym>‡··âhgçH¯%º¶ùn&ÚŒú²nHgOö4®íB)Žþïr0V<*-t5–ë<÷N/VOÓsb½®N?M~#6º²z«AO7: CÁ¼)޶L%>S”D"Lgwmb9’ªweÑ*_ê¦÷#„ÖŠ²L”±£ØJg•—·,x'ägzÍ!‘7”¼l$¦ ©r Ñ2=˜íDdG—d½SJs¦r‡×Ó)Ù(¶îÿ¤’øÉéÂå„+tjëˆKu­2Õ2Ц×(ú4áw'Ì! GÑj±vŒ¹`F#¸qGQÎPÖhaÆÀôšS‚¥C¬ÁBÐ\Ë $2Ìyç†ß©ÇÞ÷ (¹ì$Ú‘Š›¢'âV”˜+‚oÔȘbËÓb5w'W÷÷›²~E7ˆQ t1¹P)×(Ÿ“€²w[ð˜)½ +ŸSK„k(jñ3…Ò©@„áwŠGÉtFIä~îV :Ö*#¸™@ v_Q‹ß&È 8¡˜8L6¯÷pkã>€Ç¨(ŽN/8”Ž"%JI¸h ‹Cø…â#Nöd©äOñ7iøºø´ƒ>I-“¡ »€øg0~#pžã‰9÷cíT¹Ì¤*79)ñT{;¡ÈÖ•:ÿaQôÌŒH¯á;a®0AÃ(:¡µü­’š) !J3¿.®nµÄ]½-Íz Êbï:¡“äüÍ››)£ºuï—“Ë’Œfꎦ Г“ÿ¨?$D‹ n2Œ0Ç*kÙ&š½dúU7Y‡E™—ΞµKŸoÊPE­’ÇÓZ˜Z“¯ Щ—z³+rð”xs›ãªüÔ”My[ì'¨R"·^.ƒL¿ÒùžÌ~LVûA­A0ê‰jR °’‡jQ‚SÂQ³¹}£#ªªpnߨ©[ûÝÚ +Çã]Ë;À±ì—üÊãŽ)Pm¡¿~«™Î:rXëgÜyž w¸º¸ÚÓÓ}‘<ë¯^ìå}ÐÁCd;Ýy~%ŠüÑ}ÇÿWå›8$;Apache-ASP-2.63/site/resources.html0000644000175000017500000002702313252377727015243 0ustar jobjob Apache::ASP::Resources
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
    % RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    RESOURCES
    Here are some important resources listed related to the use of Apache::ASP for publishing web applications. If you have any more to suggest, please email the Apache::ASP list at asp[at]perl.apache.org

    Articles Reference Cards
    Books Web Sites

    Articles

      Apache::ASP Introduction ( #1 in 3 part series )
    
      Apache::ASP Site Building ( #2 in 3 part series )
    
      Apache::ASP Site Tuning ( #3 in 3 part series )
    
      Embedded Perl ( part of a series on Perl )
    

    Books

      mod_perl "Eagle" Book
    
      mod_perl Developer's Cookbook
    
      Programming the Perl DBI
    

    Reference Cards

      Apache & mod_perl Reference Cards
    

    Web Sites

      mod_perl Apache web module
    
      mod_perl 1.x Guide
    
      Perl Programming Language
    
      Apache Web Server
    
     
    Apache-ASP-2.63/site/powered_by_apache_asp.jpg0000755000175000017500000000315411721310312017322 0ustar jobjobÿØÿàJFIFHHÿþ&File written by Adobe Photoshop¨ 5.0ÿîAdobedÿÛ„         ÿÀXÿÝ ÿÄŠ"!1Aa2Òq‘±BR#rt‚3ƒ$%5!1AQ‘RB’ÿÚ ?õ ’ ¬b ,î=º FÞIk®ùeXׯ@XôñÓK%ãZd9<•¬´;7Û¸îŽÿ-‹æúÜkÊ-¢m&^S#F²êeö€|ºë:cD@¬ç$‰‚É:#7€OÙ×BM—ŽÞ‡L䈧G#Ì)§Ý¦ÓE㶃Ÿ‘YFØÓ¢¹òR@?v…Z;Zù‚Yäw£^e@|‹tŽ’Y:Ò®`rrlP¢e%‡UH÷iá—ŽÒ’§Í9%ƒa=EA"°WPwt[ñXÊ'uJ•å²ÿÐô/2åxÎ-ƒŸ3’=xJ/¥V•ÚFªŠÅ>=~/‡I²ðY3˜¥›ÄÖÉÐbkÛ‰f„°@uê~!׸i¢±–',W ÷ÐÛêjqâý?Ë«yei¡xÍÜ¥bWUjÍ7aî_¿SLº±È2Õ#äMÇEwK·Ö™|Ødh»É;‹–^¾_âÓ‘¸îgÞA‰G 4{úJ½zâ½Uß­VΟrb›+UþŽ-ŽûŒ«´ö†òÓ×'L,M¬ 2æ¦c%”-²7‘!I$vv 6+×ϯŧ+Y'fáC‰5¬†<2eŽkÒe£-« açps¤…OMXoêýºŸž¹F ”Eë›ã±QŽQFÛÝ„”}$RÃÆÎ€‡uM¥Sµ•ÛJV68}”RàW¹†Fú–iš¶hÜ‚3!‚Ú*³#vî]ŒêFîß=8<¦ŠYö*ØàÿÑèÿû¹›ùì*…U–µI%fK"Eªd²ÚDGîêÎÛ?—IÂG?c¥Äñ ­Iq¼Ž!C¼ «]ã:ú§<¦­û|w,[úY>]ád:0{\î«êqì¨>ÞµdŠè7í«š`òsˆJ€0P¾Ïö²|ºgL/‡Æ]äæëáÿ”÷u­'Ë §¾®q—b ¹¨fÿ¡É©þšO—A¯}KÌ|þÉ’þ5¤ùt¯qBüeØIÊyE‹8Yá›ð«ž¤: ûI½Æñ:ZPŸêÿÙApache-ASP-2.63/site/config.html0000644000175000017500000023444413252377727014505 0ustar jobjob Apache::ASP::Config
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
    % CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    CONFIG
    You may use a <Files ...> directive in your httpd.conf Apache configuration file to make Apache::ASP start ticking. Configure the optional settings if you want, the defaults are fine to get started. The settings are documented below. Make sure Global is set to where your web applications global.asa is if you have one!
     PerlModule  Apache::ASP
     <Files ~ (\.asp)>    
       SetHandler  perl-script
       PerlHandler Apache::ASP
       PerlSetVar  Global .
       PerlSetVar  StateDir /tmp/asp
     </Files>
    
    NOTE: do not use this for the examples in ./site/eg. To get the examples working, check out the Quick Start section of INSTALL
    You may use other Apache configuration tags like <Directory>, <Location>, and <VirtualHost>, to separately define ASP configurations, but using the <Files> tag is natural for ASP application building because it lends itself naturally to mixed media per directory. For building many separate ASP sites, you might want to use separate .htaccess files, or <Files> tags in <VirtualHost> sections, the latter being better for performance.

    Core XMLSubsMatch
    Global XMLSubsStrict
    GlobalPackage XMLSubsPerlArgs
    UniquePackages XSLT
    DynamicIncludes XSLTMatch
    IncludesDir XSLTParser
    NoCache XSLTCache
    XSLTCacheSize
    State Management
    NoState Caching
    AllowSessionState CacheDB
    AllowApplicationState CacheDir
    StateDir CacheSize
    StateManager
    StateDB Miscellaneous
    StateCache AuthServerVariables
    StateSerializer BufferingOn
    InodeNames
    Sessions RequestParams
    CookiePath RequestBinaryRead
    CookieDomain StatINC
    SessionTimeout StatINCMatch
    SecureSession StatScripts
    HTTPOnlySession SoftRedirect
    ParanoidSession Filter
    SessionSerialize CgiHeaders
    SessionCount Clean
    CompressGzip
    Cookieless Sessions FormFill
    SessionQueryParse TimeHiRes
    SessionQueryParseMatch
    SessionQuery Mail Administration
    SessionQueryMatch MailHost
    SessionQueryForce MailFrom
    MailErrorsTo
    Developer Environment MailAlertTo
    UseStrict MailAlertPeriod
    Debug
    DebugBufferLength File Uploads
    PodComments FileUploadMax
    CollectionItem FileUploadTemp
     
    XML / XSLT  

    Core

    Global

    Global is the nerve center of an Apache::ASP application, in which
    the global.asa may reside defining the web application's 
    event handlers.
    
    This directory is pushed onto @INC, so you will be able to "use" and "require" files in this directory, and perl modules developed for this application may be dropped into this directory, for easy use.
    Unless StateDir is configured, this directory must be some writeable directory by the web server. $Session and $Application object state files will be stored in this directory. If StateDir is configured, then ignore this paragraph, as it overrides the Global directory for this purpose.
    Includes, specified with <!--#include file=somefile.inc--> or $Response->Include() syntax, may also be in this directory, please see section on includes for more information.
      PerlSetVar Global /tmp
    

    GlobalPackage

    Perl package namespace that all scripts, includes, & global.asa
    events are compiled into.  By default, GlobalPackage is some
    obscure name that is uniquely generated from the file path of 
    the Global directory, and global.asa file.  The use of explicitly
    naming the GlobalPackage is to allow scripts access to globals
    and subs defined in a perl module that is included with commands like:
    
      in perl script: use Some::Package;
      in apache conf: PerlModule Some::Package
    
      PerlSetVar GlobalPackage Some::Package
    

    UniquePackages

    default 0.  Set to 1 to compile each script into its own perl package,
    so that subroutines defined in one script will not collide with another.
    
    By default, ASP scripts in a web application are compiled into the *same* perl package, so these scripts, their includes, and the global.asa events all share common globals & subroutines defined by each other. The problem for some developers was that they would at times define a subroutine of the same name in 2+ scripts, and one subroutine definition would redefine the other one because of the namespace collision.
      PerlSetVar UniquePackages 0
    

    DynamicIncludes

    default 0.  SSI file includes are normally inlined in the calling 
    script, and the text gets compiled with the script as a whole. 
    With this option set to TRUE, file includes are compiled as a
    separate subroutine and called when the script is run.  
    The advantage of having this turned on is that the code compiled
    from the include can be shared between scripts, which keeps the 
    script sizes smaller in memory, and keeps compile times down.
    
      PerlSetVar DynamicIncludes 0
    

    IncludesDir

    no defaults.  If set, this directory will also be used to look
    for includes when compiling scripts.  By default the directory 
    the script is in, and the Global directory are checked for includes.  
    
    This extension was added so that includes could be easily shared between ASP applications, whereas placing includes in the Global directory only allows sharing between scripts in an application.
      PerlSetVar IncludesDir .
    
    Also, multiple includes directories may be set by creating a directory list separated by a semicolon ';' as in
      PerlSetVar IncludesDir ../shared;/usr/local/asp/shared
    
    Using IncludesDir in this way creates an includes search path that would look like ., Global, ../shared, /usr/local/asp/shared The current directory of the executing script is checked first whenever an include is specified, then the Global directory in which the global.asa resides, and finally the IncludesDir setting.

    NoCache

    Default 0, if set to 1 will make it so that neither script nor
    include compilations are cached by the server.  Using this configuration
    will save on memory but will slow down script execution.  Please
    see the TUNING section for other strategies on improving site performance.
    
      PerlSetVar NoCache 0
    

    State Management

    NoState

    default 0, if true, neither the $Application nor $Session objects will
    be created.  Use this for a performance increase.  Please note that 
    this setting takes precedence over the AllowSessionState and
    AllowApplicationState settings.
    
      PerlSetVar NoState 0
    

    AllowSessionState

    Set to 0 for no session tracking, 1 by default
    If Session tracking is turned off, performance improves,
    but the $Session object is inaccessible.
    
      PerlSetVar AllowSessionState 1    
    
    Note that if you want to dissallow session creation for certain non web browser user agents, like search engine spiders, you can use an init handler like:
      PerlInitHandler "sub { $_[0]->dir_config('AllowSessionState', 0) }"
    

    AllowApplicationState

    Default 1.  If you want to leave $Application undefined, then set this
    to 0, for a performance increase of around 2-3%.  Allowing use of 
    $Application is less expensive than $Session, as there is more
    work for the StateManager associated with $Session garbage collection
    so this parameter should be only used for extreme tuning.
    
      PerlSetVar AllowApplicationState 1
    

    StateDir

    default $Global/.state.  State files for ASP application go to 
    this directory.  Where the state files go is the most important
    determinant in what makes a unique ASP application.  Different
    configs pointing to the same StateDir are part of the same
    ASP application.
    
    The default has not changed since implementing this config directive. The reason for this config option is to allow operating systems with caching file systems like Solaris to specify a state directory separately from the Global directory, which contains more permanent files. This way one may point StateDir to /tmp/myaspapp, and make one's ASP application scream with speed.
      PerlSetVar StateDir ./.state
    

    StateManager

    default 10, this number specifies the numbers of times per SessionTimeout
    that timed out sessions are garbage collected.  The bigger the number,
    the slower your system, but the more precise Session_OnEnd's will be 
    run from global.asa, which occur when a timed out session is cleaned up,
    and the better able to withstand Session guessing hacking attempts.
    The lower the number, the faster a normal system will run.  
    
    The defaults of 20 minutes for SessionTimeout and 10 times for StateManager, has dead Sessions being cleaned up every 2 minutes.
      PerlSetVar StateManager 10
    

    StateDB

    default SDBM_File, this is the internal database used for state
    objects like $Application and $Session.  Because an SDBM_File %hash 
    has a limit on the size of a record key+value pair, usually 1024 bytes,
    you may want to use another tied database like DB_File or
    MLDBM::Sync::SDBM_File.
    
    With lightweight $Session and $Application use, you can get away with SDBM_File, but if you load it up with complex data like
      $Session{key} = { # very large complex object }
    
    you might max out the 1024 limit.
    Currently StateDB can be: SDBM_File, MLDBM::Sync::SDBM_File, DB_File, and GDBM_File. Please let me know if you would like to add any more to this list.
    As of version .18, you may change this setting in a live production environment, and new state databases created will be of this format. With a prior version if you switch to a new StateDB, you would want to delete the old StateDir, as there will likely be incompatibilities between the different database formats, including the way garbage collection is handled.
      PerlSetVar StateDB SDBM_File
    

    StateCache

    Deprecated as of 2.23.  There is no equivalent config for
    the functionality this represented from that version on.
    The 2.23 release represented a significant rewrite
    of the state management, moving to MLDBM::Sync for its
    subsystem.
    	
    	

    StateSerializer

    default Data::Dumper, you may set this to Storable for 
    faster serialization and storage of data into state objects.
    This is particularly useful when storing large objects in
    $Session and $Application, as the Storable.pm module has a faster
    implementation of freezing and thawing data from and to
    perl structures.  Note that if you are storing this much
    data in your state databases, you may want to use 
    DB_File since it does not have the default 1024 byte limit 
    that SDBM_File has on key/value lengths.
    
    This configuration setting may be changed in production as the state database's serializer type is stored in the internal state manager which will always use Data::Dumper & SDBM_File to store data.
      PerlSetVar StateSerializer Data::Dumper
    

    Sessions

    CookiePath

    URL root that client responds to by sending the session cookie.
    If your asp application falls under the server url "/asp", 
    then you would set this variable to /asp.  This then allows
    you to run different applications on the same server, with
    different user sessions for each application.
    
      PerlSetVar CookiePath /
    

    CookieDomain

    Default 0, this NON-PORTABLE configuration will allow sessions to span
    multiple web sites that match the same domain root.  This is useful if
    your web sites are hosted on the same machine and can share the same
    StateDir configuration, and you want to shared the $Session data 
    across web sites.  Whatever this is set to, that will add a 
    
      ; domain=$CookieDomain
    
    part to the Set-Cookie: header set for the session-id cookie.
      PerlSetVar CookieDomain .your.global.domain
    

    SessionTimeout

    Default 20 minutes, when a user's session has been inactive for this
    period of time, the Session_OnEnd event is run, if defined, for 
    that session, and the contents of that session are destroyed.
    
      PerlSetVar SessionTimeout 20
    

    SecureSession

    default 0.  Sets the secure tag for the session cookie, so that the cookie
    will only be transmitted by the browser under https transmissions.
    
      PerlSetVar SecureSession 1
    

    HTTPOnlySession

    default 0. Sets HttpOnly flag to session cookie to mitigate XSS attacks.
    Supported by most modern browsers, it only allows access to the
    session cookie by the server (ie NOT Javascript)
    
      PerlSetVar HTTPOnlySession 1
    

    ParanoidSession

    default 0.  When true, stores the user-agent header of the browser 
    that creates the session and validates this against the session cookie presented.
    If this check fails, the session is killed, with the rationale that 
    there is a hacking attempt underway.
    
    This config option was implemented to be a smooth upgrade, as you can turn it off and on, without disrupting current sessions. Sessions must be created with this turned on for the security to take effect.
    This config option is to help prevent a brute force cookie search from being successful. The number of possible cookies is huge, 2^128, thus making such a hacking attempt VERY unlikely. However, on the off chance that such an attack is successful, the hacker must also present identical browser headers to authenticate the session, or the session will be destroyed. Thus the User-Agent acts as a backup to the real session id. The IP address of the browser cannot be used, since because of proxies, IP addresses may change between requests during a session.
    There are a few browsers that will not present a User-Agent header. These browsers are considered to be browsers of type "Unknown", and this method works the same way for them.
    Most people agree that this level of security is unnecessary, thus it is titled paranoid :)
      PerlSetVar ParanoidSession 0
    

    SessionSerialize

    default 0, if true, locks $Session for duration of script, which
    serializes requests to the $Session object.  Only one script at
    a time may run, per user $Session, with sessions allowed.
    
    Serialized requests to the session object is the Microsoft ASP way, but is dangerous in a production environment, where there is risk of long-running or run-away processes. If these things happen, a session may be locked for an indefinite period of time. A user STOP button should safely quit the session however.
      PerlSetVar SessionSerialize 0
    

    SessionCount

    default 0, if true enables the $Application->SessionCount API
    which returns how many sessions are currently active in 
    the application.  This config was created 
    because there is a performance hit associated with this
    count tracking, so it is disabled by default.
    
      PerlSetVar SessionCount 1
    

    Cookieless Sessions

    SessionQueryParse

    default 0, if true, will automatically parse the $Session
    session id into the query string of each local URL found in the 
    $Response buffer.  For this setting to work therefore, 
    buffering must be enabled.  This parsing will only occur
    when a session cookie has not been sent by a browser, so the 
    first script of a session enabled site, and scripts viewed by 
    web browsers that have cookies disabled will trigger this behavior.
    
    Although this runtime parsing method is computationally expensive, this cost should be amortized across most users that will not need this URL parsing. This is a lazy programmer's dream. For something more efficient, look at the SessionQuery setting. For more information about this solution, please read the SESSIONS section.
      PerlSetVar SessionQueryParse 0
    

    SessionQueryParseMatch

    default 0, set to a regexp pattern that matches all URLs that you 
    want to have SessionQueryParse parse in session ids.  By default
    SessionQueryParse only modifies local URLs, but if you name
    your URLs of your site with absolute URLs like http://localhost
    then you will need to use this setting.  So to match 
    http://localhost URLs, you might set this pattern to 
    ^http://localhost.  Note that by setting this config,
    you are also setting SessionQueryParse.
    
      PerlSetVar SessionQueryParseMatch ^https?://localhost
    

    SessionQuery

    default 0, if set, the session id will be initialized from
    the $Request->QueryString if not first found as a cookie.
    You can use this setting coupled with the 
    
      $Server->URL($url, \%params) 
    
    API extension to generate local URLs with session ids in their query strings, for efficient cookieless session support. Note that if a browser has cookies disabled, every URL to any page that needs access to $Session will need to be created by this method, unless you are using SessionQueryParse which will do this for you automatically.
      PerlSetVar SessionQuery 0
    

    SessionQueryMatch

    default 0, set to a regexp pattern that will match
    URLs for $Server->URL() to add a session id to.  SessionQuery
    normally allows $Server->URL() to add session ids just to 
    local URLs, so if you use absolute URL references like 
    http://localhost/ for your web site, then just like 
    with SessionQueryParseMatch, you might set this pattern
    to ^http://localhost
    
    If this is set, then you don't need to set SessionQuery, as it will be set automatically.
      PerlSetVar SessionQueryMatch ^http://localhost
    

    SessionQueryForce

    default 0, set to 1 if you want to disallow the use of cookies
    for session id passing, and only allow session ids to be passed
    on the query string via SessionQuery and SessionQueryParse settings.
    
      PerlSetVar SessionQueryForce 1
    

    Developer Environment

    UseStrict

    default 0, if set to 1, will compile all scripts, global.asa
    and includes with "use strict;" inserted at the head of 
    the file, saving you from the painful process of strictifying
    code that was not strict to begin with.
    
    Because of how essential "use strict" programming is in a mod_perl environment, this default might be set to 1 one day, but this will be up for discussion before that decision is made.
    Note too that errors triggered by "use strict" are now captured as part of the normal Apache::ASP error handling when this configuration is set, otherwise "use strict" errors will not be handled properly, so using UseStrict is better than your own "use strict" statements.
    PerlSetVar UseStrict 1

    Debug

    1 for server log debugging, 2 for extra client html output,
    3 for microtimes logged. Use 1 for production debugging, 
    use 2 or 3 for development.  Turn off if you are not 
    debugging.  These settings activate $Response->Debug().
    
      PerlSetVar Debug 2	
    
    If Debug 3 is set and Time::HiRes is installed, microtimes will show up in the log, and also calculate the time between one $Response->Debug() and another, so good for a quick benchmark when you glance at the logs.
      PerlSetVar Debug 3
    
    If you would like to enable system level debugging, set Debug to a negative value. So for system level debugging, but no output to browser:
      PerlSetVar Debug -1
    

    DebugBufferLength

    Default 100, set this to the number of bytes of the 
    buffered output's tail you want to see when an error occurs
    and Debug 2 or MailErrorsTo is set, and when 
    BufferingOn is enabled.  
    
    With buffering the script output will not naturally show up when the script errors, as it has been buffered by the $Response object. It helps to see where in the script output an error halted the script, so the last bytes of the buffered output are included with the rest of the debugging information.
    For a demo of this functionality, try the ./site/eg/syntax_error.asp script, and turn buffering on.

    PodComments

    default 1.  With pod comments turned on, perl pod style comments
    and documentation are parsed out of scripts at compile time.
    This make for great documentation and a nice debugging tool,
    and it lets you comment out perl code and html in blocks.  
    Specifically text like this:
    
     =pod
     text or perl code here
     =cut 
    
    will get ripped out of the script before compiling. The =pod and =cut perl directives must be at the beginning of the line, and must be followed by the end of the line.
      PerlSetVar PodComments 1
    

    CollectionItem

    Enables PerlScript syntax like:
    
      $Request->Form('var')->Item;
      $Request->Form('var')->Item(1);
      $Request->Form('var')->Count;
    
    Old PerlScript syntax, enabled with
      use Win32::OLE qw(in valof with OVERLOAD);
    
    is like native syntax
      $Request->Form('var');
    
    Only in Apache::ASP, can the above be written as:
      $Request->{Form}{var};
    
    which you would do if you _really_ needed the speed.

    XML / XSLT

    XMLSubsMatch

    default not defined, set to some regexp pattern
    that will match all XML and HTML tags that you want
    to have perl subroutines handle.  The is Apache::ASP's
    custom tag technology, and can be used to create
    powerful extensions to your XML and HTML rendering.
    
    Please see XML/XSLT section for instructions on its use.
      PerlSetVar XMLSubsMatch my:[\w\-]+
    

    XMLSubsStrict

    default 0, when set XMLSubs will only take arguments
    that are properly formed XML tag arguments like:
    
     <my:sub arg1="value" arg2="value" />
    
    By default, XMLSubs accept arbitrary perl code as argument values:
     <my:sub arg1=1+1 arg2=&perl_sub()/>
    
    which is not always wanted or expected. Set XMLSubsStrict to 1 if this is the case.
      PerlSetVar XMLSubsStrict 1
    

    XMLSubsPerlArgs

    default 1, when set attribute values will be interpreted
    as raw perl code so that these all would execute as one
    would expect:
    
     <my:xmlsubs arg='1' arg2="2" arg3=$value arg4="1 $value" />
    
    With the 2.45 release, 0 may be set for this configuration or a more ASP style variable interpolation:
     <my:xmlsubs arg='1' arg2="2" args3="<%= $value %>" arg4="1 <%= $value %>" />
    
    This configuration is being introduced experimentally in version 2.45, as it will become the eventual default in the 3.0 release.
      PerlSetVar XMLSubsPerlArgs Off
    

    XSLT

    default not defined, if set to a file, ASP scripts will
    be regarded as XML output and transformed with the given
    XSL file with XML::XSLT.  This XSL file will also be
    executed as an ASP script first, and its output will be
    the XSL data used for the transformation.  This XSL file
    will be executed as a dynamic include, so may be located
    in the current directory, Global, or IncludesDir.
    
    Please see the XML/XSLT section for an explanation of its use.
      PerlSetVar XSLT template.xsl
    

    XSLTMatch

    default .*, if XSLT is set by default all ASP scripts 
    will be XSL transformed by the specified XSL template.
    This regexp setting will tell XSLT which file names to 
    match with doing XSL transformations, so that regular
    HTML ASP scripts and XML ASP scripts can be configured
    with the same configuration block.  Please see
    ./site/eg/.htaccess for an example of its use.
    
      PerlSetVar XSLTMatch \.xml$
    

    XSLTParser

    default XML::XSLT, determines which perl module to use for 
    XSLT parsing.  This is a new config as of 2.11.
    Also supported is XML::Sablotron which does not
    handle XSLT with the exact same output, but is about
    10 times faster than XML::XSLT.  XML::LibXSLT may
    also be used as of version 2.29, and seems to be
    about twice again as fast as XML::Sablotron,
    and a very complete XSLT implementation.
    
      PerlSetVar XSLTParser XML::XSLT
      PerlSetVar XSLTParser XML::Sablotron
      PerlSetVar XSLTParser XML::LibXSLT
    

    XSLTCache

    Activate XSLT file based caching through CacheDB, CacheDir,
    and CacheSize settings.  This gives cached XSLT performance
    near AxKit and greater than Cocoon.  XSLT caches transformations
    keyed uniquely by XML & XSLT inputs.
    
      PerlSetVar XSLTCache 1
    

    XSLTCacheSize

    as of version 2.11, this config is no longer supported.
    	
    	

    Caching

    The output caching layer is a file dbm based output cache that runs
    on top of the MLDBM::Sync so inherits its performance characteristics.  
    With CacheDB set to MLDBM::Sync::SDBM_File, the cache layer is 
    very fast at caching entries up to 20K in size, but for greater 
    cached items, you should set CacheDB to another dbm like DB_File 
    or GDBM_File.
    
    In order for the cache layer to function properly, whether for $Response->Include() output caching, see OBJECTS, or XSLT caching, see XML/XSLT, then Apache::ASP must be loaded in the parent httpd like so:
      # httpd.conf
      PerlModule Apache::ASP
        -- or --
      <Perl>
        use Apache::ASP;
      </Perl>
    
    The cache layer automatically expires entries upon server restart, but for this to work, a $ServerID must be computed when the Apache::ASP module gets loaded to store in each cached item. Without the above done, each child httpd process will get its own $ServerID, so caching will not work at all.
    This said, output caching will not work in raw CGI mode, just running under mod_perl.

    CacheDB

    Like StateDB, sets dbm format for caching.  Since SDBM_File
    only support key/values pairs of around 1K max in length,
    the default for this is MLDBM::Sync::SDBM_File, which is very
    fast for < 20K output sizes.  For caching larger data than 20K,
    DB_File or GDBM_File are probably better to use.
    
      PerlSetVar CacheDB MLDBM::Sync::SDBM_File
    
    
    Here are some benchmarks about the CacheDB when used with caching output from $Response->Include(\%cache) running on a Linux 2.2.14 dual PIII-450. The variables are output size being cached & the CacheDB used, the default being MLDBM::Sync::SDBM_File.
    CacheDBOutput CachedOperationOps/sec
    MLDBM::Sync::SDBM_File 3200 bytes read 177
    DB_File 3200 bytes read 59
    MLDBM::Sync::SDBM_File 32000 bytes read 42
    DB_File 32000 bytes read 53
    MLDBM::Sync::SDBM_File 3200 bytes write 42
    DB_File 3200 bytes write 39
    For your own benchmarks to test the relative speeds of the various DBMs under MLDBM::Sync, which is used by CacheDB, you may run the ./bench/bench_sync.pl script from the MLDBM::Sync distribution on your system.

    CacheDir

    By default, the cache directory is at StateDir/cache,
    but CacheDir can be used to set the StateDir value for 
    caching purposes.  One may want the CacheDir separate
    from StateDir for example StateDir might be a centrally
    network mounted file system, while CacheDir might be
    a local file cache.
    
      PerlSetVar CacheDir /tmp/asp_demo
    
    On a system like Solaris where there is a RAM disk mounted on the system like /tmp, I could put the CacheDir there. On a system like Linux where files are cached pretty well by default, this is less important.

    CacheSize

    By default, this is 10M of data per cache.  When any cache, 
    like the XSLTCache, reaches this limit, the cache will be purged 
    by deleting the cached dbm files entirely.  This is better for 
    long term running of dbms than deleting individual records, 
    because dbm formats will often degrade in performance with 
    lots of insert & deletes.
    
    Units of M, K, and B are supported for megabytes, kilobytes, and bytes, with the default unit being B, so the following configs all mean the same thing;
      PerlSetVar CacheSize 10M
      PerlSetVar CacheSize 10240K
      PerlSetVar CacheSize 10485760B
      PerlSetVar CacheSize 10485760
    
    There are 2 caches currently, the XSLTCache, and the Response cache, the latter which is currently invoked for caching output from includes with special syntax. See $Response->Include() for more info on the Response cache.

    Miscellaneous

    AuthServerVariables

    default 0. If you are using basic auth and would like 
    $Request->ServerVariables set like AUTH_TYPE, AUTH_USER, 
    AUTH_NAME, REMOTE_USER, & AUTH_PASSWD, then set this and
    Apache::ASP will initialize these values from Apache->*auth* 
    commands.  Use of these environment variables keeps applications
    cross platform compatible as other servers set these too
    when performing basic 401 auth.
    
      PerlSetVar AuthServerVariables 0
    

    BufferingOn

    default 1, if true, buffers output through the response object.
    $Response object will only send results to client browser if
    a $Response->Flush() is called, or if the asp script ends.  Lots of 
    output will need to be flushed incrementally.
    
    If false, 0, the output is immediately written to the client, CGI style. There will be a performance hit server side if output is flushed automatically to the client, but is probably small.
    I would leave this on, since error handling is poor, if your asp script errors after sending only some of the output.
      PerlSetVar BufferingOn 1
    

    InodeNames

    Default 0. Set to 1 to uses a stat() call on scripts and includes to
    derive subroutine namespace based on device and inode numbers. In case of 
    multiple symbolic links pointing to the same script this will result 
    in the script being compiled only once. Use only on unix flavours
    which support the stat() call that know about device and inode 
    numbers.
    
      PerlSetVar InodeNames 1
    

    RequestParams

    Default 0, if set creates $Request->Params object with combined 
    contents of $Request->QueryString and $Request->Form.  This
    is for developer convenience simlar to CGI.pm's param() method.
    
      PerlSetVar RequestParams 1
    

    RequestBinaryRead

    Default On, if set to Off will not read POST data into $Request->Form().
    
    One potential reason for configuring this to Off might be to initialize the Apache::ASP object in an Apache handler phase earlier than the normal PerlRequestHandler phase, so that it does not interfere with normal reading of POST data later in the request.
      PerlSetVar RequestBinaryRead On
    

    StatINC

    default 0, if true, reloads perl libraries that have changed
    on disk automatically for ASP scripts.  If false, the www server
    must be restarted for library changes to take effect.
    
    A known bug is that any functions that are exported, e.g. confess Carp qw(confess), will not be refreshed by StatINC. To refresh these, you must restart the www server.
    This setting should be used in development only because it is so slow. For a production version of StatINC, see StatINCMatch.
      PerlSetVar StatINC 1
    

    StatINCMatch

    default undef, if defined, it will be used as a regular expression
    to reload modules that match as in StatINC.  This is useful because
    StatINC has a very high performance penalty in production, so if
    you can narrow the modules that are checked for reloading each
    script execution to a handful, you will only suffer a mild performance 
    penalty.
    
    The StatINCMatch setting should be a regular expression like: Struct|LWP which would match on reloading Class/Struct.pm, and all the LWP/.* libraries.
    If you define StatINCMatch, you do not need to define StatINC.
      PerlSetVar StatINCMatch .*
    

    StatScripts

    default 1, if set to 0, changed scripts, global.asa, and includes
    will not be reloaded.  Coupled with Apache mod_perl startup and restart
    handlers executing Apache::ASP->Loader() for your application
    this allows your application to be frozen, and only reloaded on the 
    next server restart or stop/start.
    
    There are a few advantages for not reloading scripts and modules in production. First there is a slight performance improvement by not having to stat() the script, its includes and the global.asa every request.
    From an application deployment standpoint, you also gain the ability to deploy your application as a snapshot taken when the server starts and restarts. This provides you with the reassurance that during a production server update from development sources, you do not have to worry with sources being used for the wrong libraries and such, while they are all being copied over.
    Finally, though you really should not do this, you can work on a live production application, with a test server reloading changes, but your production server does see the changes until you restart or stop/start it. This saves your public from syntax errors while you are just doing a quick bug fix.
      PerlSetVar StatScripts 1
    

    SoftRedirect

    default 0, if true, a $Response->Redirect() does not end the 
    script.  Normally, when a Redirect() is called, the script
    is ended automatically.  SoftRedirect 1, is a standard
    way of doing redirects, allowing for html output after the 
    redirect is specified.
    
      PerlSetVar SoftRedirect 0
    

    Filter

    On/Off, default Off.  With filtering enabled, you can take advantage of 
    full server side includes (SSI), implemented through Apache::SSI.  
    SSI is implemented through this mechanism by using Apache::Filter.  
    A sample configuration for full SSI with filtering is in the 
    ./site/eg/.htaccess file, with a relevant example script ./site/eg/ssi_filter.ssi.
    
    You may only use this option with modperl v1.16 or greater installed and PERL_STACKED_HANDLERS enabled. Filtering may be used in conjunction with other handlers that are also "filter aware". If in doubt, try building your mod_perl with
      perl Makefile.PL EVERYTHING=1
    
    With filtering through Apache::SSI, you should expect near a a 20% performance decrease.
      PerlSetVar Filter Off
    

    CgiHeaders

    default 0.  When true, script output that looks like HTTP / CGI
    headers, will be added to the HTTP headers of the request.
    So you could add:
    
      Set-Cookie: test=message
    
      <html>...
    
    to the top of your script, and all the headers preceding a newline will be added as if with a call to $Response->AddHeader(). This functionality is here for compatibility with raw cgi scripts, and those used to this kind of coding.
    When set to 0, CgiHeaders style headers will not be parsed from the script response.
      PerlSetVar CgiHeaders 0
    

    Clean

    default 0, may be set between 1 and 9.  This setting determine how much
    text/html output should be compressed.  A setting of 1 strips mostly
    white space saving usually 10% in output size, at a performance cost
    of less than 5%.  A setting of 9 goes much further saving anywhere
    25% to 50% typically, but with a performance hit of 50%.
    
    This config option is implemented via HTML::Clean. Per script configuration of this setting is available via the $Response->{Clean} property, which may also be set between 0 and 9.
      PerlSetVar Clean 0
    

    CompressGzip

    default 0, if true will gzip compress HTML output on the
    fly if Compress::Zlib is installed, and the client browser
    supports it.  Depending on the HTML being compressed, 
    the client may see a 50% to 90% reduction in HTML output.
    I have seen 40K of HTML squeezed down to just under 6K.
    This will come at a 5%-20% hit to CPU usage per request
    compressed.
    
    Note there are some cases when a browser says it will accept gzip encoding, but then not render it correctly. This behavior has been seen with IE5 when set to use a proxy but not using a proxy, and the URL does not end with a .html or .htm. No work around has yet been found for this case so use at your own risk.
      PerlSetVar CompressGzip 1
    

    FormFill

    default 0, if true will auto fill HTML forms with values
    from $Request->Form().  This functionality is provided
    by use of HTML::FillInForm.  For more information please
    see "perldoc HTML::FillInForm", and the 
    example ./site/eg/formfill.asp.  
    
    This feature can be enabled on a per form basis at runtime with $Response->{FormFill} = 1
      PerlSetVar FormFill 1
    

    TimeHiRes

    default 0, if set and Time::HiRes is installed, will do 
    sub second timing of the time it takes Apache::ASP to process
    a request.  This will not include the time spent in the 
    session manager, nor modperl or Apache, and is only a 
    rough approximation at best.
    
    If Debug is set also, you will get a comment in your HTML output that indicates the time it took to process that script.
    If system debugging is set with Debug -1 or -2, you will also get this time in the Apache error log with the other system messages.

    Mail Administration

    Apache::ASP has some powerful administrative email
    extensions that let you sleep at night, knowing full well
    that if an error occurs at the web site, you will know
    about it immediately.  With these features already enabled,
    it was also easy to provide the $Server->Mail(\%mail) API 
    extension which you can read up about in the OBJECTS section.
    	
    	

    MailHost

    The mail host is the smtp server that the below Mail* config directives
    will use when sending their emails.  By default Net::SMTP uses
    smtp mail hosts configured in Net::Config, which is set up at
    install time, but this setting can be used to override this config.
    
    The mail hosts specified in the Net::Config file will be used as backup smtp servers to the MailHost specified here, should this primary server not be working.
      PerlSetVar MailHost smtp.yourdomain.com.foobar
    

    MailFrom

    Default NONE, set this to specify the default mail address placed 
    in the From: mail header for the $Server->Mail() API extension, 
    as well as MailErrorsTo and MailAlertTo.
    
      PerlSetVar MailFrom youremail@yourdomain.com.foobar
    

    MailErrorsTo

    No default, if set, ASP server errors, error code 500, that result
    while compiling or running scripts under Apache::ASP will automatically
    be emailed to the email address set for this config.  This allows
    an administrator to have a rapid response to user generated server
    errors resulting from bugs in production ASP scripts.  Other errors, such 
    as 404 not found will be handled by Apache directly.
    
    An easy way to see this config in action is to have an ASP script which calls a die(), which generates an internal ASP 500 server error.
    The Debug config of value 2 and this setting are mutually exclusive, as Debug 2 is a development setting where errors are displayed in the browser, and MailErrorsTo is a production setting so that errors are silently logged and sent via email to the web admin.
      PerlSetVar MailErrorsTo youremail@yourdomain.com
    

    MailAlertTo

    The address configured will have an email sent on any ASP server error 500,
    and the message will be short enough to fit on a text based pager.  This
    config setting would be used to give an administrator a heads up that a www
    server error occurred, as opposed to MailErrorsTo would be used for debugging
    that server error.
    
    This config does not work when Debug 2 is set, as it is a setting for use in production only, where Debug 2 is for development use.
      PerlSetVar MailAlertTo youremail@yourdomain.com
    

    MailAlertPeriod

    Default 20 minutes, this config specifies the time in minutes over 
    which there may be only one alert email generated by MailAlertTo.
    The purpose of MailAlertTo is to give the admin a heads up that there
    is an error at the www server.  MailErrorsTo is for to aid in speedy 
    debugging of the incident.
    
      PerlSetVar MailAlertPeriod 20
    

    File Uploads

    FileUploadMax

    default 0, if set will limit file uploads to this
    size in bytes.  This is currently implemented by 
    setting $CGI::POST_MAX before handling the file
    upload.  Prior to this, a developer would have to
    hardcode a value for $CGI::POST_MAX to get this 
    to work.
    
      PerlSetVar 100000
    

    FileUploadTemp

    default 0, if set will leave a temp file on disk during the request, 
    which may be helpful for processing by other programs, but is also
    a security risk in that other users on the operating system could 
    potentially read this file while the script is running. 
    
    The path to the temp file will be available at $Request->{FileUpload}{$form_field}{TempFile}. The regular use of file uploads remains the same with the <$filehandle> to the upload at $Request->{Form}{$form_field}. Please see the CGI section for more information on file uploads, and the $Request section in OBJECTS.
      PerlSetVar FileUploadTemp 0
    
     
    Apache-ASP-2.63/site/perlscript.html0000644000175000017500000002755313252377727015430 0ustar jobjob Apache::ASP::Perlscript
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
    % PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    PERLSCRIPT
    Much work has been done to bring compatibility with ASP applications written in PerlScript under IIS. Most of that work revolved around bringing a Win32::OLE Collection interface to many of the objects in Apache::ASP, which are natively written as perl hashes.
    New as of version 2.05 is new functionality enabled with the CollectionItem setting, to giver better support to more recent PerlScript syntax. This seems helpful when porting from an IIS/PerlScript code base. Please see the CONFIG section for more info.
    The following objects in Apache::ASP respond as Collections:
            $Application
    	$Session
    	$Request->FileUpload *
    	$Request->FileUpload('upload_file') *
    	$Request->Form
    	$Request->QueryString
    	$Request->Cookies
    	$Response->Cookies
    	$Response->Cookies('some_cookie')	
    
      * FileUpload API Extensions
    
    And as such may be used with the following syntax, as compared with the Apache::ASP native calls. Please note the native Apache::ASP interface is compatible with the deprecated PerlScript interface.
     C = PerlScript Compatibility	N = Native Apache::ASP 
      
     ## Collection->Contents($name) 
     [C] $Application->Contents('XYZ')		
     [N] $Application->{XYZ}
    
     ## Collection->SetProperty($property, $name, $value)
     [C] $Application->Contents->SetProperty('Item', 'XYZ', "Fred");
     [N] $Application->{XYZ} = "Fred"
    	
     ## Collection->GetProperty($property, $name)
     [C] $Application->Contents->GetProperty('Item', 'XYZ')		
     [N] $Application->{XYZ}
    
     ## Collection->Item($name)
     [C] print $Request->QueryString->Item('message'), "<br>\n\n";
     [N] print $Request->{QueryString}{'message'}, "<br>\n\n";		
    
     ## Working with Cookies
     [C] $Response->SetProperty('Cookies', 'Testing', 'Extra');
     [C] $Response->SetProperty('Cookies', 'Testing', {'Path' => '/'});
     [C] print $Request->Cookies(Testing) . "<br>\n";
     [N] $Response->{Cookies}{Testing} = {Value => Extra, Path => '/'};
     [N] print $Request->{Cookies}{Testing} . "<br>\n";
    
    Several incompatibilities exist between PerlScript and Apache::ASP:
     > Collection->{Count} property has not been implemented.
     > VBScript dates may not be used for Expires property of cookies.
     > Win32::OLE::in may not be used.  Use keys() to iterate over.
     > The ->{Item} property does not work, use the ->Item() method.
    
     
    Apache-ASP-2.63/site/planetofmusic.com.gif0000755000175000017500000000707111721310312016434 0ustar jobjobGIF89af-÷ÿÿÿÿ!!!)))111999BBBJJJRRRZZZccckkksss{{{„„„ŒŒŒ”””œœœ¥¥¥­­­µµµ½½½ÆÆÆÎÎÎÖÖÖÞÞÞçççïïï÷÷÷ïçç÷ïïÞÖÖçÞÞ­¥¥kccZRRcZZRJJ÷çÞ¥œ”½cÿ{÷ïç÷çÖ91)cJ1Œc9”c1„R!Îkï{ïçÞ„Z)ÿœ1”ZÿŒµcÿŒÖsÿ„÷Ö­÷Μÿ½ksR)ÿ¥9ÿœ!¥cÖ{ÿ”­cÿŒïÞÆ÷Þ½÷ΔÿÎŒ÷Æ„÷½kÿ½c÷µZï­RÿµRœk)ÿ­Bÿ¥1ÿ¥)ÿœÿ”ç„÷Œÿ”ÿÞ­÷Æ{çµk÷µRÿ­1ÿ¥!÷œï”ÿœçŒ÷”÷çÎïÖ­ÿÖ”ïÆ„ÿÎ{÷½Zÿ½Rÿµ9ÿ­)ÿ­!ÿ¥ÿ¥ÿœÿç½ÿÞ¥ïΔÿÖŒÿÎs÷ÆkÿÆcÿÆZÿ½Jÿ½Bÿµ1ÿµ)ÿ­ÿ÷çÿïÎZRBçΜÿÞœÿÎkÿÆRÿ­ïçÖÿÞ”÷­ÿïÆÿÆ1ïÞ­ÿç¥÷ïÖÿÖRÿÆÿç”ÿ÷ÖïçÆÿçsÿ÷½ÿ÷µÿ÷­ççÞ­­¥ÿÿïïïÞccZRRJÿÿÖÿÿÆçïçÆÎÆÞçÞµ½µ¥­¥½Æ½Œ”Œœ¥œ„Œ„s{skskckcRZRBJB9B9!)!ç÷ïçïï÷ÿÿÞç祭­ÖççÞïïRZZçÿÿBRR9JRç÷ÿ„”œZs„BZkZck”¥µs„”Jc{çï÷ï÷ÿ¥­µ„Œ”cksJRZBJRJZkBZs9RkÆÞÿRc{BZ{9JcÎÞ÷csŒBRk1Js)BkÞç÷½ÆÖçïÿBJZJZ{!1Rµ½Î­µÆŒ”¥s{ŒJRcs{”ÎÎÖ””œ„„Œkks{{„„„”{{Œ÷ï÷ÿ÷ÿÖÎÖçÞçµ­µÆ½Æœ”œ{s{skskckcZcRJRJBJB9B9191)1)!)!!ÀÀÀ!ùÿ,f-@ÿ9p el­ƒ*\Ȱ¡Ã‡#Jœ˜p‡mÆ„H)„…Š1_Û|eS¢çΆ[ 0€`N*Ÿ8°À€(êÜÉS¡Å…Û4ù)〠°ð5`ðJ‚›¢Jíà¡äËÀaN4`Рႆ§( Jjƒ» 8±f;jU›¤Ü­ `B€.X¨Pó¦ÀŸ i}Ð!Ã'eÇ0±A®]ªæ9pPoA«¬< !4teXu)¦"lØ  Àþ&Ä `ÁC|ð€!@ 0À€?jO à¼‚MžU)¼2€@Á‚ò|…ÿò“%ˆ7oøh]`_I¬P¡ôÖD‹¤ÞqпÐ"âÃü÷Ók¯½óZOîGË.š8†P0‘F!wðÑi’à†“ˆOpRÈ[ÌAm$á‹/¶è"OˆÑâK+X¡É6U9àIaà3€@å;9Ý•ÓU_½¨dDÿ áx  8CB+ DÐölæå< ´²€xà@÷,pÁj ½ãÁ pÕ;€)þXW§] `çþHp•þ´'€ae Á(@àWip@OQ$‚1WA×@2µ¢E ÒLà _™Ú$Á N-ØÇU¥ÿÁ£øÃ °; Ð* ø#ð *p+?P,ùX0?ÔÄŽB95Ñ]Qq Aæäa Æ´l£n6»t±ÅtœÐ’ôh¯÷æ‹ï¾úÎæï¶ä’M.¶dcËlïð«°¾ /ìpÃ÷Ú²b€±g° n"g TïÇKì BÔñslA[ôЃIÐBU;U%Äm’ çÜŸ@±±EM$‚&X¥“2¢<µA&Œ©@H>4 N:çüŸŒhôP'åÐ^óðåĪöUDp¢<„³@ÙÆeSÕÍÐl%ÿŒ5ß°VÕÁà;¿ À#XÈp.%0ÐÀ l0  4Ð Âxò]+¨zPŠ@PÓCGùSÏUªøÓ ø£äléÏh Ú•s g_D€=põÔSXE€;°M èÐŒ3¯ŒÂ h¦Yf4 t €i÷´·÷S­ËSX×cW L  U´gSÜtA¤bJ)ïèJ*0óå¯xÛÅ\ÂBqDF„¨/ZÁ€ r%VP€ñAZÌ-HpÀä¨ åµàþ¸`ü±& ¸"`€¸â׉" ÈT;ÿØ7t@¦ (`‚„#2ˆÐÁ2ºqäPO  NÜ`\¨Ä;\å|eŠx¥ºK¬¢¢66Údm5KU˜W#G9‘1úb• r€$ì  Æ0†&ÈHJ‰X$]IPDÀlã ¹¨¥0!b Q|±Œ¸ƒöÀ.´´àÏ0§)lpÀ {„z°$¸¬a°ƒ(|AÆÁMenÔ¤—/‡5Ü¡•|Xš@…+¬ ‚¨…-Nqÿ¾@°‚ÇtºHC¾PƒÚÀBø"1Æ1jñ ](€v)Õ›NñT•â:}‘/…<œ"€-à Õ@ÇO‹À?ÿZ@x:CÊ“%b=ph-`®8@°HÀ×+º!è+„ÚS_åÔ$Y;åÀ|á$Ü!¿T\¡½UŠ©HJ=<Љ°mxUñÀ$`šQ¥[Äsc‘„•¾ *Y]ˆ/q"0c)ÈÄ”€5]ÀþLÐñÈù.ƒ @Aûså0@α‡ m×€°†·"”i]½0 xàÿø5cR*Híµ¼}ã–(à °á‰¥( ¢€‡êázÐc3lE=Pš4€+¯"…U €5 ®«ÕpÀ¦@¡] €§d ã…áJ‘ V$ '±¸ÕwË[lÉõààDT0Žhxâè@0ƒ½çfÏ ø(ä4(¾†·6mn<ÀÚ xÀ°À)èá W\é U#€Tà¦WfÈ€ X ºŠO^Õ ”bê F(kð‚hs½DÎ(àèÀÐä51„ìðÀÆ‹•§Ô±¦0*@“£”é* ëQ(TPàÿ5‰Ç®²xP@écû›˜¸ã8Á9¶‘ 2Ø¡ÉxÔæQA ÀEÊ3¾ÇiDg§VE«@ø1ç`pR€@$Ã÷*€ú’cb=@ÊðmGí§ ¦p ¡…ˆ8pZ€A7„Q‚Ø/Vè š1.2!Q‹]ž¢´÷Ø¡ælÛ m€ ã(ÐoX8À€êÄúÑJW" @c°*LˆÓ(£buã @¶¸C: /Zâ$*ƒ;^)ªBòbI8&>ǹ`à€(0`•¢1§’Æ÷‘ÁªËâ^@ Ìa FbƒÀ:Vá€{ `‹ èà1¢0‡;PÂc½ííà'Ѝâdè„{ Ò¡Ú¸-=°ÚbÍQVá tçêØE ¡…),Àˉj@À\ø‚ dˆ—(yÚ¨7„[À4å  àa 4ð‚Žñ˃pí z C ÎöódpY¶I8 ÑDP €ØCìâ W˜ÀøÂ·}I"|ö@9´áÈ  è ‡/¤ëÙžP½º‹3|!Ü4¼ †°(öïÎÚGvñäAK8ác;¬JÀyÒ“ô´']= •S  žy´çÚ¦z‰ÿ`â9ÅÔ+ètIP@ï<b.p†,(&)^å¸¸à ”Ö+.1  |äJçIÏG«9QàÌ3 @/pr.1+îQ`âd  $ ’€2 ×` š€eW± p Pa·ð ¿µ5AVaHó¢¢¢¡ð0P £°qþà•1¦  O ^vó³‚emVz¡WÜÁ(@µ¶MѰ Ñ“î@Pp˜@ ç 8°°ÕXÉâr“6ˆöetV@H@HcW ¡õP«p ² øÿðu°À ƒÐgP гLp†° V`}U[7&D1 /Q p Åk0 µr€M`²¶p§D˜çPÙPj°³eЧ8?>±3ppú¤ ðN5𺠰À4@ ” šSbð4ðPÇ(†´#p¿€b0#hz``¹ufà|°{ KrŽ‘Ž" 3)òsð"}ðbX`%’ ɹVU6z¥"CPh`cÐüø|àj;PZb‘È;aƒP8à"8H€:z¥’,g9Zr#*BP pÐ8bc8);Apache-ASP-2.63/site/syntax.html0000644000175000017500000003166413252377730014557 0ustar jobjob Apache::ASP::Syntax
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
    % SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    SYNTAX
    General Editors
    XMLSubs  

    General

    ASP embedding syntax allows one to embed code in html in 2 simple ways.
    The first is the <% xxx %> tag in which xxx is any valid perl code.
    The second is <%= xxx %> where xxx is some scalar value that will
    be inserted into the html directly.  An easy print.
    
      A simple asp page would look like:
      
      <!-- sample here -->
      <html>
      <body>
      For loop incrementing font size: <p>
      <% for(1..5) { %>
    	<!-- iterated html text -->
    	<font size="<%=$_%>" > Size = <%=$_%> </font> <br>
      <% } %>
      </body>
      </html>
      <!-- end sample here -->
    
    Notice that your perl code blocks can span any html. The for loop above iterates over the html without any special syntax.

    XMLSubs

    XMLSubs allows a developer to define custom handlers for
    HTML & XML tags, which can extend the natural syntax
    of the ASP environment.  Configured like:
    
      PerlSetVar XMLSubsMatch site:\w+
    
    A simple tag like:
      <site:header title="Page Title" />
    
    can be constructed that could translate into:
      sub site::header {
          my $args = shift;
          print "<html><head><title>$args->{title}</title></head>\n";
          print "<body bgcolor=white>\n";
      }
    
    Better yet, one can use this functionality to trap and post process embedded HTML & XML like:
      <site:page title="Page Title">
        ... some HTML here ...
      </site:page>
    
    and then:
      sub site::page {
        my($args, $html) = @_;
        &site::header($args);
        $main::Response->Write($html);
        $main::Response->Write("</body></html>");
      }
    
    Though this could be used to fully render XML documents, it was not built for this purpose, but to add powerful tag extensions to HTML development environments. For full XML rendering, you ought to try an XSLT approach, also supported by Apache::ASP.

    Editors

    As Apache::ASP supports a mixing of perl and HTML,
    any editor which supports development of one or the 
    other would work well.  The following editors are
    known to work well for developing Apache::ASP web sites:
    
     * Emacs, in perl or HTML modes.  For a mmm-mode config
       that mixes HTML & perl modes in a single buffer, check 
       out the editors/mmm-asp-perl.el file in distribution.
    
     * Vim, special syntax support with editors/aasp.vim file in distribution.
    
     * UltraEdit32 ( http://www.ultraedit.com/ ) has syntax highlighting, 
       good macros and a configurable wordlist (so one can have syntax 
       highlighting both for Perl and HTML).
    
    Please feel free to suggest your favorite development environment for this list.
     
    Apache-ASP-2.63/site/redhat_logo.gif0000644000175000017500000000233411721310312015267 0ustar jobjobGIF89aŒ)¥ÌÿÿÿÌ33™ÿÌÌÌff3fÿ™™33Ì3Ì33333333Ì™™ÌÌÌf333fffÿÌ™™™™f3ÿf™ÿÌÿÿffÿÌ̙̙fÌf3ÿÿÌÿ™ÌÌ™ÌÌ3f™3ÌÿÌ™™Ì™33™3f™ff3ff333f333fÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!þCreated with The GIMP,Œ)þ@€pH,ȤrÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍNÄa"·ïeøC±Pì  x†^ €Ž} T•]—‡R“ $r(pŒ”M™F¬®O šO …FuŽ|d°EÇ CµD°®Íb~Ã'¯Ò •Ãb¬ Ç C˜\¾‘zq°|‹ª¯làÈäæ\øYÚ€¯DÙ12IQ*< ¶tÔ/˜I*>ê¶…#€z’1ô@ŒÉ²#µ H…áÒ™0¶ê³`Ú.”N0 SþÏ%Ð×Aá=!B7ÐiD„  | R‹AÄZ © pÀmHteF š¤ná qÌUcá`Jä±@2møQncx‹@Œú!Ã1}qãVhÂŒ¾= ÐìÍ)cÉbH„Äq§I:qÖ,ˆx‘ˆ…™€Ó ±ç”Œ8“SóA+™é23l7Òp´€ÛZsÔ <INƒq#:0ùK5€íM5  Jø°Hã]6 \fÈßef÷4ˆa401Ð<§w,DSyL4b‘+qÀ Dr¹bØ1B€41Š‘óJý!‘ÿþ]AL#Ï-¼”^ZEÀUtDgA8ÃAhH'•£a‡CT"ÀdNwßE1€ Ò8`‚,8¶J#˜W!‡¥Æ@á¸5#ŒGaH›,hÐAŸTT¤ˆÇHà€x„ #\(#”Q*fÕ1Aš8ä8¤¥2rцã˜FÈôÄެéÀᨠÈ-µù{`ZX¡Á]SL2ã,NGèEIGPYã…@rd\ B \°h8%Tà€ TB-T ˆþ$ñäEqÁÂÜiúÖ!÷* 6ºg¤‚ Jq¬|6*ñÙ1ë×Î^~aÕ2ÜA¨×B1]”\@Z{Ô Gã ±éae@Ü|`Ú©7.©Wê„ã#Ô—È \Pm™ì_\ªYW]u2·W´­î4ñN LÀ[l`1h@PÁ¨Kˆ ñ°z,ïÄ\T?¯l,]v]÷2sõ:‘ìÍšöYñ¶üÝWsÛ¢·`S—öÞ€K!€  üøâR(7Ot17ã”C1yå•_Žù朓ahç^h^F;Apache-ASP-2.63/site/asptitlelogo.gif0000755000175000017500000001554411721310312015520 0ustar jobjobGIF89a ,÷ÿÿÿÿ½½½ÆÆÆÎÎÎÖÖÖÞÞÞçççïïï÷÷÷çïïÆÎÎÎÖÖÖÞÞÞççµ½½­µµ½ÆÆœ­µ”¥­¥µ½Œœ¥½ÆÎœ¥­µÆÖœ­½”¥µ{Œœs„”k„œÎÖÞÆÎÖ­µ½¥­µ­½Î¥µÆŒœ­„”¥{”­sŒ¥c{”ZsŒRk„Z{œJkŒBc„9Z{1Rs1Z„!Bc)R{1ZÖÞçµ½ÆBsRsœBcŒ9Z„1R{)Js)R„!Bk!J{9c1Z9k9s)Z1k”¥½s„œsŒ­k„¥c{œZs”RkŒJc„BZ{9Rs1Jk)RŒB{9s1k)c1s{Œ¥Bc”9ZŒ1R„)J{9k1c)Z!R1{Œœµ„”­k{”csŒZsœRk”JcŒ9R{1Js)BkB„9{1s)kœ¥µc{¥BZ„)J„!B{9s1k!ZÆÎÞ¥­½„”µ{Œ­s„¥k{œcs”ZkŒJZ{9R„)Bsµ½Î­µÆ”œ­Œ”¥œ¥½”œµŒ”­ççïïï÷ÆÆÎÎÎÖÖÖÞÞÞçµµ½­­µ½½Æ¥¥µÀÀÀ, ,@ÿ©x¡¢† @ƒLˆðàB‡Fl(‘áÊ-N¼H±#ÇCj™±$Æ“EšLI%È–,W¾\$aA*8©Y#%ˆ¢€À@#!B¤ä\Ê´©Ó§P£JŠsÍ=‚8Ц —!ktRK¶ìÔ5QFÕJô_u\$J†@‡EÀ—-·b¦¬ñ"EJV¶B'>`€€![†È âŋͪT¤D©W¨œ"†!„‹Ò‚C¤l9¬7#FBë-úÎé! 00t¥*C®¨8$úÀ€3‚© åì×À‡0'ö´)` qްkrûý›È΄µ‹ ÿI®9PgDnRIãA´s!lÂJ™ò=è_ ^¥xÙ9ÄŒm àDRSOUœ—AnG€ ¦ dÕ:ü‡_xUÇ€ +Ì1EaÊy1!kBÒA€èåV ](µŸeíדyŠéecbX „`„àPWd™ejÌV€:©žP*äôâC¹µÇ"NñßbEì(EXU–N¸e%W^¤šZIIå@\™X©'Ej’a¦”X<6ßž_Þ”gaS ñ¡™AäqÞˆ•HdaH sö„SAa¥&E ZýEÀ”ü‰™˜S %D¢B–ZX Õ4Ъ·T°jÿ)WªÊM*±*Ÿ§ù1ÅMˆ‘‚Mü@ê AÈ“­Bœ!,±>:*©]б£d5(RtüàD ÊÁ„Ò*U©¸Ž*ëM[„Jíµ“*G¡ŽzF°Ï¦à°F¸Sf¯Âzì–fÁ-©t$—bCˌÕÛ…ߊ¡±°û œ”RÉZµ-®°ZûaXû]ôÐB/˜rÊ­*ÐÊ“®úr…•ÊhDÙªaó~ cŒ7±Ê2N0ûÜsC4ûLtÍ,Sv«0J=4C¬õÍ©: cÓB.Í3Í64Óh¯<×e\kÍô‹=+ôuSæ¤'^ŠeÖÞ|÷ÿ½Ô=\9˜‘Å ~'®¸Sÿzé%\FU·ž”Ûú« ç´S¤–âíø™35¤A¤ãDaIªâ"K¨^fŽÈv`Å5ŒÀ@uÕA „­[0Õƒ pößñÕ-0B‡¶~ùw]=ï¼ ˆ;K‘ÛºmP_fÈZ·éQDÅPß»<Ø rUA€!;í¬NR`!{ v°Ct0yÑE =À ¢ˆR€Ç|F™‘BÎs, NDk°Š­j€%Ož*QC(“"Ñ4 ÉQÚMnR˜2Ê ±‚ŠЂ¯ fN«Ăä5(ᨠºâÿ<€—¾Ô0kŠ›ŠÂ¢¤dKØÁN˜~D¦¸¬!PHN0„‚Ô „ œÍ_$àDxºSA÷+ùak.ɪÁ¡—;ÌÌ2F  QÖ*[¹À(@ð¢::@0­rSís€8ùŒÓœ¶9,t¦() R¸ É)€¡3Ô¹†ÆE" ŽØBðæ0"€˜ÁŒþMa !†Ù—ä@?ÙñÔ$@*`a HÓj™™[æÒ/„Œf/O0&™Qê ZÕa9ò‘2uX‹“šää”À+ ABçÙ¥4ÉY  ?9d$~"Dÿ¶® -!±šÚ\7 UF µÚBÖbœ¬ 6 è~T•-ˆNæE’Œ×ÖÒö6ÊXMjr£(ŒdA¥Ô£p{Ïb¤ª™Q¥4£ŒÛ827°ÙmasYLÖQµ!”)É¢Ëùt2Ô j®¨HªRºTÓ%•©PuªR%“š§J5ªDmjV±jÔ«zu«_í*XÇ*Ö²ÖM2’âªUÉúÔ…PhtQN²Àñ@ ˆ[œ^÷Úª#X/m@a†ª7Íõ°qM¬ak:Ä.V'< ÂêZA.!.O Kú ê±/2ÀQ 4V ¡uŸji€¼ÊI‘ˆæ¬Cÿ“ðŠ«È*F'¼¥† sªÓaw˹H±tR‘o9W§Ja%S úPq)&ÜÌ׷ªrùD·Ì`×)) –ä”f2•AA;”A èj–‘ËF†áNóQ$KXÊÒFE€ç³²Ég= @Áe°r²_cÄí4’;²›v¸ëH®jxÁ ¹_f Ï­ÑŠB&|8ƒQx#ÖbŸÙ0føÕ`ò”LF¶á¼ÊB¼é‚¯¨ny""[ˆ u=™Ë|ìÏä¡Ç´”\•sbœIX/€àš®03x2¤\"› ÄL²ÿÌYâQ­Ä=ìÐgN#ÃlÀ‡¯PJ®ùJ¸ˆ½™ _¦ àiµKT<A”s^"T–›‚µHÍðÞ…-OpšÐˆ¥0óŠm`00A tRȪY-€&0^=)­£:¸œÔÏæ~¥ -p—@¤Aý26%0Bèèd [§w´Êä `·…[à‚Xò«C΅бCO‚…OØFüM@”¶¨Ÿ!à`‰pdˆú"“7ÈÔÅÝG;h1 ]H„!RÕ`uªD‚ÑŠRÕ(éÒÜ%)‚Ä t‹‹»È%Êdp>Sÿ°ÖÎpÍ[º¢‚ÿâðU¯zŽèƒWl³ÊŽ'©Ëa‡6´ÁF€Ñ0,«©ó@ª2»G’Yà ÀhP!0l0ÐNð(ÑÍÓSh`ÈkÃ[ ¬°S*Éп¹bʾ2D*3Ø!ˆ ÀüJA 5À T)à ˆx!€ Þ…û¥4:ÒÛ€úàH£ÊÁ9´‹s<Ã!2U€GláÄ_Sè¡‹H$i.°w @H‡;À+Σû„ˆߨ˜`”'^ИF@2ˆíÒ@.ÿ“¡ºŽá;Zf ê*3@À³æ‹ÿÃJëÁø9âÁ›‰ÞkÑTÕQß /¦‘Â;;PÿŒ #¢,±æYŒ1.P'Cpî‡(t'Â'#`€Õ‘V! F}}A{Á^±}Íd€Œ!׿V‚1óg”c.<Ó2Hf)1×L@m§Ô\zÂ%>³59…¡ƒ[2„ž3.óDz\3ƒ¥-§2+ûqr–‚-ã'8#ƒ:¨eÅ%ŸÓ'B³]WwS¨‚2…”–7>(/â8BÈ„#á„7e¨‚MÃq&Õ4$E3Bó58³6µÆxh3:Mè5(e5OÓ6GsSÿe`xV…?s5534$u…‡•؈fxPUH:j¦‚PŽÈ4i¶6)¸‰¦˜Š/R–ñV‘X`²ÈCwdn±xG±Xx&$£ã5³¨‹ºX‹vŒ³˜‹ÆŒ_C‹ÄØ‹anË芥,ƒg°3B"´¨°øŠÁ‹g‹ÛxŒâ؋ɸ‹æHu,#‰¶¨ŽæŒðÈŽñ8$Ï8ï(øHöèŽüXùxúøý¸þ 9Y É yî(rÃŽÔØ%§ãTí8Ž™‘¹‘Ù‘8s7UuY’y’&ɑŀTùŠG9 £'ÊB’rµ%hÿu:V;’‚*¶HVÓŽ!ƒã-`fP8ƒ‚’L™’Mé‘`b¡Up2ªò”N™•Xy;8àH‰”90`q•æT‘Õ?'€Жvz t9Ù⃂ƒa–…ƒ”‡Âˆ‰˜}˜S©GKi“Ñ4…ñxGôM6”‹É2=áƒÃ¹9§3œÆHTÈÙΩœ‰Ç™–ÉéƒkD[ Aq¤1(ò±Ê™‘ÿAœ:¹nf)!cœÉr‹CYœçY5ˆCmD91–h'?ªH(5€—a‰F[`™Tžš‘'Y–fP–Ó“•–)à8ŽÇ¡ò³n<¤¢”c”H™id(5í9íb•z:Ç”£ÉB‹r5A*ÖHh°Mf"H0G¢A‚Ò.EŠZaGt¦4ë6F)à:yGA•,N:ŠTƒ°.QXŸ…7ðI¼DHõtzÙ"†BcZ4Lð+IÂ?Qÿ_ÀKö±K “f p€LG› WqV†ÉY`Ÿ… ™!¦Â›R@ª4'€ƒÑ* ùM´‹§Uún§T@{u^C@eB‡SrQ8“!( V¦e2ä‚ % ¡ˆJÃk°«z!FÂ÷ir"SJª)kZœWy*FF!¥1æn¢‘˜ýyJס—š{q!ë:?¢ênlQ€ÐîÑb"8'—M¤^þAEß´M¯È–§0äk‰Qƒ XÄ9Ïec@`Ypzk„ùUge[T`FB](Ô8R¬‡bû¡²óÿ¥j4ôFFÀ;@mß6UñdP¦M6ob°22^lqŠpéB*[ ‰@×aòn„_ZÒO«¦ ³el•Xò´Á£©Ae~* slèwND)y2HzA8‘´ë­ˆ„¶¢h+&OG2?äF¦D£¤VðÁ)‰q¡J6D@šT¹Da×ÖGú5uKQe¶ÌÆeTW%±d#nq£Ä÷‚Ja)lÐ.êµ±Da;r¢I:Nw'µ{W¼W`Êë¹À6J:pgàÔ;’bF@ÔK½.0ÿw A lÁzc³cR>à:ò+`€ªÉ±@@7DJŠ(ŒÑÂx Aà™ A´¸•Í&utQèÆŒœAc:»’â¼RgpŸ.sd@³[à»d2w^†&wÇEÊqoŠ!›ÑÔ§Š·#G–Ausd§ˆ'Y0£N«; "más YR”r>°@à—¦:@%sRJØ{a3U“QpÃÞf$Pæe f„¥ÿõ¹pí§šD`9Œ%¤)¯¹KŒàbÉ!‡˜uŒÌ6ØTh´‹ +yp 'PÈ…zÀ‚ÿ¼'ºÁוA@óg £eG†` ‡ '6ÅRØFS€ ¶´;>¢Àa°1Ð’+_‚R$¹9t(Ê÷Y3„W>¨³`´CLaþùa1«z13k°F_gh³.WhÃ']d8'HòT¤Mw"({ ’2Ì‘_`."R.<=Íãi¼C•ŠZ RpSIfÐ\…ñ–ÂñÛHKà‚Á‹;'òÒ8˜%ˆªÄ ]HA1w#/©2‰”Ï܃‹Ð0%c+ó9‡$lFgœ¼6à¹ß’Æ&›ûŠiༀˆQÿB…!3ê•R§®º‘ë#U“¾îã0俨u23B•-g˜Ýw»é±zRîs/Ø„sãÊ#4Ìn‰âþãêÁqžN+ÄQGC‰ý¶¨ÅìK î.UQ”èãääùŠ‘l‰k4îŽ^ aS`2•×ý^4(ûãf2ÜÛ½g@–eí\™Œœ»S4µí˜¨ï~ð•ˆ4S̹ˆèŸ6A™ñ(Ë O5?ìì ò¿ï-£óOÌ-7¿ÎR.[ÒYóÕ^R–R:(sóשBïóßÎòöþë?óJW'Òêêîñ±4ÈÞŒ.•óö>ó.o`¾]‡5Oß讜SfP9‰AóE6š˜Ð<þö‰éxŠA™fßøÊèÊpÏŠ{ïèÚhê²HðUè÷Ý.7ÿö!åò·¨ÝH’553µ^ù'õ‰Šÿi¹ýD;êÛÿ˜ëì]·)™ŸQ¨ù%\çŽùƨ"­×ƒÙЗ׌BÐ$Pø˜{0ðA°ßú³çvCP{Žÿ˜9°‚Q QOs®nUºÏp&pk[€ûpúÿèø ³Ìø~VŽ{W¥u³C£ƒ'bt·–ê& ˜²5,!"Xèbl‡•'#X©R¤P âÅKÁ5§Â…áˆ:œ2p*j¨¬¡""C.»4„hq£Â†B*d9DâÃ3nLèqŠC9§la³ñ`G)w!ˆ1Л · Ys4áB’+ ÊĨhJ!K7"…JGÈH†Qý¹fHЉRb¬J…­ÌŒk5zÑX—î̲[YÎ 2UnÓ­‘@Àg„˜|ÔjÜ‚^Ó¤ÂÒ'Ç‹S!¯Õ‹9pe¿€=kžùÙñL«jò öŒÙïÔ5˜9Öu[YÿÓÀ¡ƒ´n˶6mÞ×íLY0d·|?_Ä[›3UçªãÞ "ÝîQßQõ«±zQ·G]8PÞÀÅR2ÿ¹Y;ßáÉgú•ï»yvçµ·Ëݶôö¹R@í|ƒÏ»¹Jð­×²C0¿¶¬ ? !üͶŸ$¤Nà ßÚŒ6»¦“ º K3ð½ gò(‡3Zlq¦î³­¿ëôî. 7«D©:-5íÂRÀÛŒ2èG ’:ëô³*»×˜ì-?Ú:L±B,áj’Ê)¡ ïDÕBœŽ¶.‘ôñ®ùÞ*K )†ˆ±Ëù S IÚ”L󷃼ïLçÌ<²²ýÚ‘¿<ñú®F£›ÿpÄáJ”­'y$SÈ2ÕüòK-âl-MyŒÐÉÞ / ý¾æDMŽ=™@<²*¹.-ÒTRÃÄôTY·ã ÕS5ö2¢Ìa JÕ-º`e2.[U5ÈU`¥«AjYÝÏkaM¶U\ïòV@ƒ’µKhà 3ZdÉ 7Ùg§cW\ëÌ­Øwu×Ù0Ÿ¥«\}Õe7_fqü·T2Å}·ßt½e7]¼4wZXlÜ&Çm7ßzÖádï]5y÷åxÔˆ¿TZ]UuX+Ct5.]/lâél´åqA®«;UÐ[;É5ÞÞìüÔ[acud›§t6裗õg’lA`][]g“>ôâêÂÕ‘/»¾ ùæcqû»B³5xÒµ7à†¿­ÏTŒëÖ6`»Ë>¹C¹uV6bm…Æ]o;Apache-ASP-2.63/site/license.html0000644000175000017500000002255013252377727014653 0ustar jobjob Apache::ASP::License
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
    % LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    LICENSE
    Copyright (c) 1998-2018, Josh Chamas
    All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
    Apache::ASP is a perl native port of Active Server Pages for Apache and mod_perl.
     
    Apache-ASP-2.63/site/sessions.html0000644000175000017500000003165513252377727015105 0ustar jobjob Apache::ASP::Sessions
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
    % SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    SESSIONS
    Cookies are used by default for user $Session support ( see OBJECTS ). In order to track a web user and associate server side data with that client, the web server sets, and the web client returns a 32 byte session id identifier cookie. This implementation is very secure and may be used in secure HTTPS transactions, and made stronger with SecureSession, HTTPOnlySession and ParanoidSession settings (see CONFIG ).
    However good cookies are for this kind of persistent state management between HTTP requests, they have long been under fire for security risks associated with JavaScript security exploits and privacy abuse by large data tracking companies.
    Because of these reasons, web users will sometimes turn off their cookies, rendering normal ASP session implementations powerless, resulting in a new $Session generated every request. This is not good for ASP style sessions.

    Cookieless Sessions

     *** See WARNING Below ***
    
    So we now have more ways to track sessions with the SessionQuery* CONFIG settings, that allow a web developer to embed the session id in URL query strings when use of cookies is denied. The implementations work such that if a user has cookies turned on, then cookies will be used, but for those users with cookies turned off, the session ids will be parsed into document URLs.
    The first and easiest method that a web developer may use to implement cookieless sessions are with SessionQueryParse* directives which enable Apache::ASP to the parse the session id into document URLs on the fly. Because this is resource inefficient, there is also the SessionQuery* directives that may be used with the $Server->URL($url,\%params) method to generate custom URLs with the session id in its query string.
    To see an example of these cookieless sessions in action, check out the ./site/eg/session_query_parse.asp example.
     *** WARNING ***
    
    If you do use these methods, then be VERY CAREFUL of linking offsite from a page that was accessed with a session id in a query string. This is because this session id will show up in the HTTP_REFERER logs of the linked to site, and a malicious hacker could use this information to compromise the security of your site's $Sessions, even if these are run under a secure web server.
    In order to shake a session id off an HTTP_REFERER for a link taking a user offsite, you must point that link to a redirect page that will redirect a user, like so:
     <% 
        # "cross site scripting bug" prevention
        my $sanitized_url = 
    	$Server->HTMLEncode($Response->QueryString('OffSiteUrl'));
     %>
     <html>
     <head>
     <meta http-equiv=refresh content='0;URL=<%=$sanitized_url%>'>
     </head>
     <body>	
    	Redirecting you offsite to 
    	<a href=<%=$sanitized_url%> >here</a>...
     </body>
     </html>
    
    Because the web browser visits a real page before being redirected with the <meta> tag, the HTTP_REFERER will be set to this page. Just be sure to not link to this page with a session id in its query string.
    Unfortunately a simple $Response->Redirect() will not work here, because the web browser will keep the HTTP_REFERER of the original web page if only a normal redirect is used.
     
    Apache-ASP-2.63/site/powered_by_modperl.gif0000755000175000017500000000617411721310312016672 0ustar jobjobGIF89aX÷ÿÿÿÿ111ccckkksss{{{œœœ­­­µµµÆÆÆÖÖÖÞÞÞïïï÷÷÷ïççµ­­Œ„„kccÆ­­)!!„ccŒ))Ö!!­9Zs„”ÆÞÖZR½1!ΔŒµRBc)!Æ!sJBçŒ{½cR„)­!Þ!µkZÎR9ŒJ9µœ”sZRÖ{Z½J!œŒ„½ŒsÆ„cc!scZÞœsÞ­ŒÎZ÷ֽΥ„çÞÖÆ½µ„{sïÞÎÆµ¥B91sZBÞÖε­¥ÿçΔ„sÆ”BB)B9)½µ¥÷Þ­91!skZÆ¥JÞÖ½Öε{sR½¥)kZ­œçÎsk)kc!¥”ƽJskÞÖB÷ïBïï祥œZZR¥¥Œ))!!!ÖÖ{ÿÿkµ½k”¥kBJ1{œœRZck{”Zc„­­ÆJJZ­­Ö„„¥ŒŒ½””Ö))B””÷ssÎJJ”ccÖBBÎ))Œ1Jcs{”­ÆÎŒRJ¥kc­ZR”B9Œ1)s)!ckcœ!çÖÎÿ9ƽï9)„)Æ1ï1Î{k­!R9½JçRÿcR„ƽ֔Rÿk!ç1„ZÞR½)ck÷µ¥Æ¥Œ½9kc½{ç”9Þs)­”ÿ­1ÿœ÷”÷{k„µRïέޭÿc9s­ïµ)ç½÷{¥”Æ­Þk1{cBk½çÞZ÷Æï9B{9„ÖïÞïÆ9Îïç樂¥JBJ÷÷ïïµ­çÞÞÎcZ½„µ¥Œ÷Æï1)Þ9½œ!„RBç½÷ÆÎ)¥ÿcÖ½ŒÞk½ç!­Öœœk½„ïœç!œ„RÆŒ­ï„œRÞsÖÆÎµ¥­½{œ½kïÎÞÎZÖJ„ïc{9­!RÆJçJç­½÷Bc!1ÎZsÆ1½BZœ9J„RZÖ1Jç!Æ„Œs½s{”Æ,X@ÿðeذ/_$lÐàà "|0ñàć9Ð𠃂_0*ÔX0#E%~qØÀ F†0c>x°@‚ èŒ8(`€4Å||ü2ã úà©ÐaBaÁÙ´i#?¤6``U (9N´P±Âƒ¿·þ0 Sa ±§ #àÁäl Þ˜)8¡ äˆ>ÂyÒäÅ!÷†Xñ!ß»tã@Ó,ر`»zͪÕë%I’ ä§O€{ží)u S&UÀjëUíÝzÃP0P 0 ä$G˜ ”2T¶p9CÅ_´ zÐÿSÑ9ž»6ØÈG¯ ö…¸" (FT82ÁÇÅ€j01>ô0CuÍE(¡Ä–“N=@€„A@€a„ñÔ(}è¡G!ˆôQ…¼Q$vÐqG ŒD؆w(RÉzð‘È&zøA‡‚ ‚Õ@_8÷TY6@Lƒ.ðOKˆñC Ä _áƒ`€A@x©Ä¦ €<œ töÎ;ëŒ3Í4É(cŒ1µÄrÊ'“H"ȶý#@|É\sNÖØ2qFXì‘…Pü“†&Ÿ$b€'‚”BÇ}ÃÀN 90€€›Dÿ†#¹DË(ÓL3Ú83 ¯LIA=,qÀ GÀ Ãk+Ëd’_Q–B;ÐÿМpÖÙ:átÓM2Ô$Ó§)ðÏ“ˆ†q€XO6¶üS 9EøÀc„ÑÃ/|+ÆO€AŒÎå]ƒ ´‡ C `W>ñhŽ6Óì .¬Ä"J&˜¼v ìñn}xr +¶øÆÌA S¡cc!ÿáB9JjNNÔyšÐ²‹$PÊ)œ ¸á‡p@ö°2(`>øÂ}@ŒRܤȢ †"L€ùð‡<‚0iY1Æ&)$ 6°Á€…*œA R2`iÔ•àŠ%€²Àÿžqm€ã`à:‚À)pÆ 2h`;ø †Q€#ø«9T“Bˆ“XÅÕ™K¼! `L™FeÙñŽv«Pð—à€ ÃBDÈëaï¤"ÉÈF:ò‘„dÀ80–„!IB2¸d&+±ˆBà†¥l2“ùˆJ(²€Q#9˜|&3’Z6¤&bˆÀ… d7a ƒâ> …ØÄ‰qAÔh Ø)â ¬Œ‚ dqƒ‡©e z΂ÊÈ1„!ħœ €›øƒæ°ˆ:ÂlÈÃ& ¡ÿˆHØÁÐD„Øà-B„`Ä!–=Ã…0/¡i²¤©Qàs|ð‚3¼àeQ^– 3C<ÅEÄa•`À¡‰Àa.rÒ¡ˆE$`‰xÄ( ˆD<ÀzhVŒÀ„€ ,@`€>F, (ÆÞ2>@d(ÀDà?X‚¼¥€1õ 08wˆˆ¢êˆzP&£€ààvü@yÂ1 jtc0Àݪ J:a–ØjòD p `®³ô€>æŽãŽu$ÈD0” Nž ÂAXcÿ f±PE&bÐáyÅ0À¢ i¶É` ƒ`àƒá7øÂâæº RpÒX!#xLÀA Æ+lОé5”q'e‡ªP…ñ(AAÔQÿèƒ% †1 à%³,·Â$À JˆÂ´*8Já D CŠAÛPNÈT€~øCNî ïç àcx¸ð“(&ÁâúÂÎ À(P Sœ¢ò5F8¸A!rÐ… /×8ô@JÅÐ%IŽ0üh‡ØAw¬CјÆ1”ñŠWð·øÄ': P4B6…8Ä!Æð<`ÿ¡PD*Z± ^ðÂËÚȆ6Æ|xÀXAc“¾wäƒQ Sø‡ `—ÉB² ƒ0ŒA EhB—€ ‹=ÔÈÉ“,Æ>rÖ@€à)ä°ŒMc×p†+Èð€'d@ÈÝZ@ƒ$ݱЙ,aŒ€-\ {˜ ~ €44‹xA)á K h@@_üBÅ#Ö°*î™ãÎ0ÀÞál¤(†Ðñƒ}< i8†ëœ_zlIB¬@….tVðäÁ lX³íF5dHCýàÇLð ì#øpû4ptÀ@"­(ˆ „{W·Š€€ŽðD nsvtC„‰ø:àÁ‘™08ô¡yðãõPÇ‚0{ÀÃ=˜«Ösþ½±QG( P@N|Ѐ±=àIÖexÈñG”ô@! K˜’¶¤¸ÿKîu§ûÖÒ1ÆE!`¢Èèàð€” #° Á;þð€ù$_€Þò•¼ä'ïøÍ;þó üá_€€;ÀžpÈ» ¡äÇÕìÁM[»ýà@4…šÔhæØ@LP‚`@ *$3¯( ÿáA0€m€X‹×.8íÎß Êa1qšê¡ß¾ú×ï( ×IiÅÜAM|Ð4 £äÐÑ‚ˆŒ#%4è3RR`4°âtÈ#øNïO®õ€X¨Àø ‚h;Apache-ASP-2.63/site/oscon2000_speaker.gif0000755000175000017500000001155311721310312016143 0ustar jobjobGIF89a‚’ÕýýüÿüûýóðþúùûÓÌð$ð%ð' ð+ ñ.ñ6ò="òD)óV>ó[DôbMôjUõp\ö|iö†u÷‘ø”„ø”…ø˜‰÷›øø “ù§›ù²§úÀ·üÜ×ýèåòM8úÇÁüãàö•ÿýýÿÿÿúúúøøøõõõóóóñññìììæææâââßßßØØØÐÐÐËËËÈÈÈ»»»´´´¯¯¯«««¨¨¨¢¢¢›››ŒŒŒ„„„RRR""",‚’ÿÀŸpH,ȤrÉl:ŸË’tJ­Z¯Ø¬vËíz¿X!xL.›Ïc1zÍn»¯ê·|NçÆëøüü®ïûË|Z$ˆ‰Š‹ŒŽ‘’ $^X“¢£¤¥¦]œU$¡¦³´µ¥ šZ­T!¶ÂÃÄ![¾R ÅÎ϶ ½?Z“  Ùã㲈äéÍ‹  ÆÝ‹ ã ‰êäì铲(»0)A‡ V€B„?ÀCô°"€C‹6 N‘CŠ@€A‘Ň+"1ñQ¶ «aaORˆû€Ña‡ÿ p E€*U È€„0r¸!ƒ$%Lª´Ó 0¡èWH D„‘y¥ê¤Î%ÐdB\Ì–Á"¼Š, ÄÔºÙ®fÕ ÀoS¾é•0iÃÚ,%}  ã=n ¥Ù±##E`ø¤â’Œú:’-…I.ca'I#šë&J€ÂÑžIþÑ3UÅvc@Þ(!uX$o‚W_ç áò`@£Ÿ ŒÃ@؃¬„Ô¡/p€|°©=–è@žÃö£ñ¥ƒ|l€UþH‚€nWÌ'I¬ÄšCqpÖI}ÁF‰ÜÿZC`UÂ`Ødià $ 0hÿ="MytýTt´UW œ£Wäh4]k DPuHñøRt¢i‘0àbÄèÒP #Ül‘5Ò@ &†öQ ´A‚&u)cy°b#ä[V|Ixø  ¥iB™ÈCUÀ£p¶'" ŒÄAx`©ÉXM€•MIM“p€.ˆ ¥\—ˆ ŨQ "¨4PZÇ¥i ŒÔœiYJÅ‘‘xð@ )lcrÉ•R~iÛ" P”Å"ÂatvÔ±@9F›–îA“®S\c%"ŒôPèQUÿ"†*ª"£h§äyP“‰vYב’j#@1mÁL$¸@@Á·Šcœ#ø”B™ýÅ”)ü—ãPÖPà s" xÌÝ4o 4Ãd3î3Û“ X¼ Ê4׬ºx®ž€bóÏЬÀ¼!­´)•\¢óËDÇÓ›-õÕXK¡LÖ\ç±u×`ËñuØd¯1vÙh“qvÚlÝvÌ-ÈЂ+'œP *äm7xçí÷Ý*Ø·ƒß-ƒ VÄÝÂÞV´¢ÂáG.ùä”W^¹$ÜàÃ=Ü0…a ” ùæ>ì Â;ø°¹>” Cé%¨~ú$ôÐÿƒ'ôðÃT¨°¹íˆ7nµëªoüñÈ'¯|ò·Sñú¥ï û=Ì ºèÐKýì;P¿Ã÷¼ß°{ì>Ì. ªó¢‚î¼—°þî©ÿÝðâCa?­O‘;õæË ûí"AèÄ×>Ýy®Ý“ŸH>ó•}>ðŽ „0·ÿ¹OThEýîÇÁ!äO ÝëKЂÍÉàÄ^ûºwÀV²£u6ºî•jWØ`9øAôý`nVèÞBd0Ðw? IÀDMÀð†´K_º' Î :Ü¡ý>¨è1ÎyÔóŽø|Ѓßí͆ŻÝ8Ã* ÑŠWÌ¡;ÈEèQÿÍuÔ£ÂYDB/*l  ¥XÝ}±dVÈâÐC^AˆzÜ lxÆÜ nu d £A+èn„àRä"™ðA?öà-¨b$ 8>?bpƒ,å>é69Ž ¥Ü_äwö½°•ïóœ WI¾/Bð ´´ýn‰Ë*”P¶[§ØJ<úà6´íNCèiS„¿ûæé’‰ÃD2ó ²t_/‹·ƒPͼ›ôdÐËožž%°ç6¥gÏÓ}ï¡<'#³P·;n RÓ @›Î·¥a™ ]‚úèPµA4¢I˜¨ ÏÇQƒ>P¥G êR‹tìA;!'½Õ)A£ÿ´“7JÓÎ¥[ÜIЂԽ”¢$PA †JÔ¼T¨DM*QÊM8>£HåMm‰ÎxfÁ¥(õi;^Aüä*ðé§Î4sel"‰Î>†´Ó3Lg™Q«RŠI°«tWÖ§~T†TlÞZ#ÉÈàÍt Ï”«Vãz„¾r„K€ãôúzØ’¶œlm‚Z›ÈQÎu¯ChgK9·7ïP±t7H­jo0·Ã‚–u†Õ .{Rª.aš4ÕÂþŠðÙ|ÂV “\]oýhÇ/0Ö±® í`§ Ê#¨Õ ¼Pdoã*?¸ò1ˆ×Y!ykÅÙB³„•(âlz…Äzp±Cÿßû §UâBQ»tånr¿[[s’òtä%cÙ»]UÞMsÙ½+ýF`“Ra².õU½›ÇúfV ‚%ÃnÏÛßÝÝ`´BØÝt†WæIšf]<á8Ú÷¶î‚iy‹ÞŒÊoÅJ8 Î¦wÏËX¹eBò늻íwºuÅ^‘ðaþ‰ÎÆmðrÈP©va½>0ç¾¹ƒö¢ŽuàËr•‘ ÍÙ=OÄÄ-±ðp*^¿B—x,îïD›hÓÓ"ô©3îò¾,„ ÓwÉØÓ,œ¨X5еÔäïWŸFcÒ™ŒwαŽ[»A9Êñí­GOÛ^@ÇwšœµnÄ<Õ3á¹fî1“ÿû,eA "ÉÃ=¡åSMs¼ÌE狳À :Ȧ¦5ªüØ×â¶ÕŒåt/ÊÐY‹Ímqª1G\øiyËždõF]-ì)(——Ômˆ“­f †¬‘岑™­éjkØOØ¥ dû¸ý’:ÒVföPäô}æ.Áµ9¨ÒÔÒS{¤t+UW½^uàËCî] ÎkàÚÖ£Æ(þ´ZàPgÀ÷[IÏWqÄêµÓ–xšÿzlíæ—g-CH÷-ò‘˰²ß¶4³ÏŠr™âynyšSlæo[\×$ç±Í‡MfÑ}(Z°Ú¦;ýéPújžô%óxjUÿÂÚþpÿõ6tÝ¢&—ƒ¥©FÞ¡ âä‡ïΦ7¹ýÙÒ"Üç®–ŽÖo'@¹ ñ^Ràï5µ¸PׂuÇôÇdÝgveô´Œ¿ùØ,…ò& AÝÙ¬‰Çoùi“ëSOeÉ‹ôð7žJgz±zΣ¾p5p{X‚ÀJ™ß°I7øzg®ŽwµFBÁ{œ9—òÚ$t÷«Ì7åg¤š@¡(F û®Î°TH,ð5aëÙÏΤØdB<½iœOË–¦II0RP߯!†£ö9úe22vÁÍö¦hã:þÉêóãDGUj•:Ÿ'†Q # G×W^¿ç<¿'TxuJÈ9ÿ'4ífIlWh~‡I6Õ §%?' U"py¢jáD ˜8 8g«s@»…iîWvxîãURPnÕxÃW öXíg €Öç_¾—aˆ¾†_ÈVp²u>y×y4öfx¶A ¦w3u$8 &8„IÄ€FÈ‚uæpÒÆ{ªsÎThŠ—IÌgqU:-ð4#¸2€ GF„Ù·‚RðeU&<¨>“åTååß;k†„|%r8‡\(xˆlªskÕUh_ {åWˆµ¶_»t>H B^XMÈv|Þ±^¿Æ–8{ç=e|ŽÕ‰³ð‰)X„¢Ø}ÔcWåFuÙ'ˆTösÿÖf5Oã?.5M°h tЍ÷ˆÏƒhÐcEåo‡ƒJ3®µmˆ3‚´PD\Ø{wø…yH:_Æ„úƒW;”[‡W¯÷ƒL³7_6bOu~µH:9§aÐWÕçQ¹8WÀ‡JX‡HXŒ£€'M§×lVµŒuÕXÈ•br“ÒV5_•: Gޏ“…’J¸[ GBÂEQËx:õThešOÒˆŽÀ(\—D%ùTDT ÈcÐ#yA…U‰†fP´A3È ®æ†yÃtÓ£’4&7D‘…˜ÑDZÅŽ“0œuƒ®Ø”C cÜG:ßÇGÈ:V†7؆ƣdà’Š¿Erÿ•Å\Æg=x~µm5‰Ip;°7<Ég›X†¨‘˜G‡VÈ…ÇWZµV<4:¥£wÉ×–ÞäN~¸<ù¦ *PO]õ}f˜ˆÄ y!Ðw48Iaõ=Þ¦jêtˆrô„šë7gaÕoŒy«ùt€xnƒæjHr5•%wtwx•…†'Rç 1ç NöucV¼™ux°uÎù6Ðl£ 0œ%æc(€uÓÝy `äiž q>Ý9ܹžT`+`žˆìI;&pŸúàYžö©Ÿà)žò™Ûéº3)`:0%`4 9Pvÿ*3Ї“‡5 0®<+8@æ9JTðš/6 ª 4Тî3.  %p£-p¡(0£R°3°8°¢3Ð 4`¡5@Ÿ1€£€£xæ:3sC8°)P6P40Þ‰*€0BŠ£) :.@: æé’g-ZcJŸ7¨.€.à€3 !Š88°iº6`9@Ÿ3ú5 $€:°%`¨Aõ8 )ð[J’§Z “<Т&°¡KY0€v“‰Jž—:AŠ_5ÀRP.À6@0°7ÿ. ¥.@B5tZ5ðø9«0@p:BÊ œJ+°¡3Ú§(ð$jHj¥ÐJª-°¥%`­(¨¼€,V*©¤¥Hª,`¨T@. Š£6D002-@§ˆC§0°¡,Ц80ž50¯Ì%©SФS7У(PSº¡½Ú«ßº"zK ±YzƒÞj­¶ú®//pª Šs {¥¨:WН‡U¯R®9 &0¤ñÙ¦0Š,p–z:t8S §)ê­îƒ£ª( 1°¡&€ -j®ÝI5`´HË­KÍÊ\q“¬·Š¢¥Ú+€8¥j2€ÿ$@ú³}tfË¥:ð­6°Ñ*î*Z¬Çú­9°°-®0À·J¬’Êí$3°ãi®÷)¬…{¸9z@Œ µ4pdK´3¬áú¶¥úmª )pJ®%0i;«}4²7è¡´*¶º¯ws¥ ú ã‰¸"Š´%Àª‡J¬†GO®<žk¡*`µyx@Ý*ÖZ(p"º·®“¬¹›&;©²:,ÀòéTÊŸ`bž*P»$à½vú¥+ЮnTxN¨¾/[»¦$ŸðÙ®ÜÉ ñ+Ü©¿òKÙ»½òY¾Õ[uf—6ÓIhsÀL6 ¼À`ÓÀÿÌ5ÁX3ÁœPz)rBÀZ '"ÀÁ`(t8Pw%,51àÂ%P$µ”`"¬;\!PçÓ  `@œÞàTP¡³q"5 =2Uñ-üÃTÐÃ:\àTà+/:= ÆRP   °ÁZðlð Ã%R °9Œ;üÃ;<ÂtœRòÄT+L@ÆdQÅk, °ÐÃ!° °@áÀôB"¹`Ä àÇ Ð °É°âÄ €Ç ÉeŒvܘÁ%Èÿk\"ü@P^<" pG À$̇¼ËÐ,=¼PàÇàÄ $`RðÊ%І$@° @W0Ƽ,Ëk—ËölÏ=ü ÐÎÂL 0Í%#-BÐ%à0"d<ÃÜÃ^¬Ë¼œ?lJaÈ1Ì º°É@;² ‰|üÒÅ%pðƒœ-VàÅì|í"P+ л̹!ͼž¬Á¹a îÇÀ1,ÏPÂð@4”ÑÓ@àÐÌ@Ç¥ºË°ØÑ%@ Òˆ¬Á ]n’Ü#_2Ö>ˆš¼ÈðÃùœÉ›ÜF-   Ý ð¬×ð ¥,Ô½ Ä‘Õ0ÌUà€¦3`M4ñAk_ç ÀÇXà&z|ÁRPÎR Önà !0Ÿ]ÀÅ }Ã6,6LRÐÚ/÷œ¸LÛ |Û¸ýÀº½ÛltÀÜP;Apache-ASP-2.63/site/install.html0000644000175000017500000004775413252377727014714 0ustar jobjob Apache::ASP::Install
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
    % INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    INSTALL
    The installation process for Apache::ASP is geared towards those with experience with Perl, Apache, and unix systems. For those without this experience, please understand that the learning curve can be significant. But what you have at the end will be a web site running on superior open source software.
    If installing onto a Windows operating system, please see the section titled Win32 Install.

    Need Help Quick Start
    Download and CPAN Install Build static Apache and mod_perl for Apache 1.3.x
    Regular Perl Module Install Win32 / Windows Install
    Modern Linux Distributions WinME / 98 / 95 flock() workaround

    Need Help

    Often, installing the mod_perl part of the Apache server
    can be the hardest part.  If this is the case for you, 
    check out the FAQ and SUPPORT sections for further help,
    as well as the "Modern Linux Distributions" notes in this section.
    
    Please also see the mod_perl site at http://perl.apache.org/ which one ought to give a good read before undertaking a mod_perl project.

    Download and CPAN Install

    You may download the latest Apache::ASP from your nearest CPAN,
    and also:
    
      http://search.cpan.org/dist/Apache-ASP/
      http://cpan.org/modules/by-module/Apache/
    
    As a Perl developer, you should make yourself familiar with the CPAN.pm module, and how it may be used to install Apache::ASP, and other related modules. The easiest way to install Apache::ASP for the first time from Perl is to fire up the CPAN shell like:
     shell prompt> perl -MCPAN -e shell
      ... configure CPAN ...
      ... then upgrade to latest CPAN ...
     cpan> install CPAN
      ...
     cpan> install Bundle::Apache::ASP
    
    Installing the Apache::ASP bundle will automatically install all the modules Apache::ASP is dependent on as well as Apache::ASP itself. If you have trouble installing the bundle, then try installing the necessary modules one at a time:
     cpan> install MLDBM
     cpan> install MLDBM::Sync
     cpan> install Digest::MD5  *** may not be needed for perl 5.8+ ***
     cpan> install Apache::ASP
    
    For extra/optional functionality in Apache::ASP 2.31 or greater, like support for FormFill, XSLT, or SSI, you can install this bundle via CPAN:
      cpan> install Bundle::Apache::ASP::Extra
    

    Regular Perl Module Install

    If not doing the CPAN install, download Apache::ASP and install it using 
    the make or nmake commands as shown below.  Otherwise, just 
    copy ASP.pm to $PERLLIB/site/Apache
    
      > perl Makefile.PL
      > make 
      > make test
      > make install
    
      * use nmake for win32
    
    Please note that you must first have the Apache Web Server & mod_perl installed before using this module in a web server environment. The offline mode for building static html at ./cgi/asp-perl may be used with just perl.

    Modern Linux Distributions

    If you have a modern Linux distribution like CentOS or Ubuntu,
    you will likely have the easiest path by using the repository tools to
    automatically install mod_perl and Apache before installing Apache::ASP via CPAN.
    
    For example for CentOS, this will install mod_perl into your apache httpd, the latter likely being installed already by default on your server:
      bash> sudo yum install mod_perl-devel.x86_64
    
    For Ubuntu this would be done like this:
      bash> sudo apt-get install libapache2-mod-perl2
    

    Quick Start

    Once you have successfully built the Apache Web Server with mod_perl,
    copy the ./site/eg/ directory from the Apache::ASP installation 
    to your Apache document tree and try it out!  You must put "AllowOverride All"
    in your httpd.conf <Directory> config section to let the .htaccess file in the 
    ./site/eg installation directory do its work.  If you want a starter
    config file for Apache::ASP, just look at the .htaccess file in the 
    ./site/eg/ directory.
    
    So, you might add this to your Apache httpd.conf file just to get the scripts in ./site/eg working, where $DOCUMENT_ROOT represents the DocumentRoot config for your apache server:
      <Directory $DOCUMENT_ROOT/asp/eg >
        Options FollowSymLinks
        AllowOverride All
      </Directory>
    
    To copy the entire site, including the examples, you might do a raw directory copy as in:
      shell> cp -rpd ./site $DOCUMENT_ROOT/asp
    
    So you could then reference the Apache::ASP docs at /asp/ at your site, and the examples at /asp/eg/ .
    This is not a good production configuration, because it is insecure with the FollowSymLinks, and tells Apache to look for .htaccess which is bad for performance but it should be handy for getting started with development.
    You will know that Apache::ASP is working normally if you can run the scripts in ./site/eg/ without any errors. Common problems can be found in the FAQ section.

    Build static Apache and mod_perl for Apache 1.3.x

    For a quick build of apache, there is a script in the distribution at
    ./make_httpd/build_httpds.sh that can compile a statically linked
    Apache with mod_ssl and mod_perl.  Just drop the sources into the 
    make_httpd directory, configure the environments as appropriate,
    and execute the script like this: 
    
     make_httpd> ./build_httpds.sh
    
    You might also find helpful a couple items:
      Stas's mod_perl guide install section
    
      Apache Toolbox
    
    People have been using Apache Toolbox to automate their complex builds of Apache 1.3.x with great success.

    Win32 / Windows Install

    If you are on a Win32 platform, like WinNT or Windows 2000, 
    you can download the win32 binaries linked to from:
    
      http://perl.apache.org/download/binaries.html#Win32
    
    and install the latest perl-win32-bin-*.exe file.
    Randy Kobes has graciously provided these, which include compiled versions perl, mod_perl, apache, mod_ssl, as well as all the modules required by Apache::ASP and Apache::ASP itself.
    After installing this distribution, in Apache2\conf\perl.conf (pulled in via Apache2\conf\httpd.conf) there's directives that have Apache::ASP handle files placed under the Apache2\asp\ directory. There should be a sample Apache::ASP script there, printenv.html, accessed as http://127.0.0.1/asp/printenv.html which, if working, will print out your environment variables.

    WinME / 98 / 95 flock() workaround

    For those on desktop Windows operation systems, Apache::ASP v2.25 and
    later needs a special work around for the lack of flock() support
    on these systems.  Please add this to your Apache httpd.conf to
    fix this problem after mod_perl is installed:
    
      <Perl>
       *CORE::GLOBAL::flock = sub { 1 };
      </Perl>
      PerlModule  Apache::ASP
    
    Please be sure to add this configuration before Apache::ASP is loaded via PerlModule, or a PerlRequire statement.
     
    Apache-ASP-2.63/site/robots.txt0000644000175000017500000000017711721310312014365 0ustar jobjob# stub file with no rules, work around for Googlebot which seems to have a hard time dealing with no robots.txt for chamas.com Apache-ASP-2.63/site/apache_asp.gif0000755000175000017500000001117711721310312015074 0ustar jobjobGIF89aæ ÷ÿÿÿÿ)))111999BBBJJJRRRkkksss{{{„„„ŒŒŒ”””œœœ¥¥¥­­­µµµ½½½ÆÆÆÎÎÎÖÖÖÞÞÞçççïïï÷÷÷ÿ÷÷ÎÆÆ­¥¥Æ½½œ””¥œœŒ„„„{{kccƵµ”„„911kZZ!÷ï÷ÞÖÞÆ½ÆŒ„ŒkckZRZcZcB9B919ïÞç­œ¥kZcJ9B÷çïÿï÷ÖÆÎ{ksÿÞïZJRRBJÿÎç9)1Z)B9)1!çÖÞÆµ½¥”œ„s{ïÎÞçÆÖŒk{B19kJZsBZJ)9!)ÿµÖk!Bç­ÆR1c9J)ÿÖçÞµÆÿÆÞÿ­Î½kŒµc„Z1Bÿ„µ÷{­ÿs­çZ”B)ÿZœ½BsÎB{s!B9!Þ9{„!J÷ÎÞïÆÖÖ­½ÿ½Öï­ÆÞœµÎŒ¥ïœ½µsŒÿ”½”RkŒJcÞsœR)9Ök”ÎcŒÿ{­J!1ÿk¥k)B­Bk„1RçRŒ¥9cÿR”µ1cZ1ÿBŒ¥)ZÆ1kç9{Œ!Jk9R)1ֽƔ{„祽R9Bÿ¥Æï”µÿŒµÆkŒ÷„­µZ{1!Þk”­RsÖcŒÿs¥œBc½JsÿcœµBk÷Z”ÿZ”c!9­9cçJ„ïJ„ÞB{ÿJŒÆ9kÖ9s÷B„œ)R½1cÞ9sï9{­)ZÎ1kÖ1k”!Jÿçï½¥­œ„Œï½ÎçµÆÎœ­ÿµÎŒZk„RcÆ{”ÿœ½½sŒ÷”µïŒ­9!)Æc„ïsœµRsÿkœïc”ÆJss)BJ)÷J„Œ)JçB{Î9kïB{ÿB„„!B¥)RÆ1cç9sc1µ)ZçÎÖ­µ¥Œ”ÿÎÞ÷ÆÖcJR½ŒœJ19B)1{JZ­c{ç{œZ)9){)BÆBkk!9!÷½Î­s„Ö„œk1Bk1J!œ{„ÿÆÖ„JZZ!1÷ÖÞέµ­Œ”„ck÷µÆcBJZ))­„ŒÀÀÀ!ùÿ,æ @ÿE;$àÀ‚*4È0aÃ…#Bœø°¢D‹/jÌÈ£Ç;‚I1ZªÑ~]X° Á0'$°D°ædA“ÑÄ\ˆ AƒK•°`ðÁƒ¶4ÙÄY ‡ 8h`ô(„\—njåí…E«B°×…Õ@>:Èì¡§7¤R…ÐîJ­AqLˆJÕj®c7O¦â6AB‡ÞÔh\ø°7gZQâAæaìdÊd-ò¡7•Y*ø#p!ÎCª^ÝÔâ@AˆhŒFû%š,KU Ü,!á™ô‹82¼@$x`' Xˆµôäš Lãj’† ­_ÿ(@`™,_¤cEpR„2¸B¹4p4´jaÓÒ:* ò/XcÖ!¿HßÀà /(¸ $("µ¡Dm³ÕWá]ôÉ3At 0Ì/Åýò†è)Ç€ 5­ Ä/§8ª$Ok („@Š7@ï¬r“ $Р3 RAPFC 6(Ÿ@|@ÇR7ÀÀ— P@W@Fß!{˜€˜0™F(;8X=ìÝ¥ÈÞ@f˜/pf†ƒH#M£<’ TÁ¢@§œãƒž{&x€êTñ N©dñã‚'yW§ TyB5‡Æ¡¤”eA””ÿªà嘵G9>4¸ç—¼PÀ æ¬ÁN¸È ÃÍxvN-JYKkù±Ä™²ÊjH-}Í^km¶òñˆh$»ldÛjËmµçžûK h6S çŽR‹<*yÀ½^.À€ZL´rh4¬¹ëî¾ùõH‚*¦¥‚vª³J* dSðu«åœ£+›×R­(™B]Cã±z’Ö£'¤¡Zi§´âªÝ—Ök¤1mÎÐ!€ëú2 ` owÅ‘_AÔyH*m0Àk&«`›  ¬‰@&NjÈÇÀ Ž@•<Ý.ˆûï!ë\p ¼Ö@¸t2îŽè€I*|ÿr 7`Ë„@Ïp·Ë‡j Œ7N>,‰¦ +6=w¶¥ŒªEq+0)’D~x²vÀ©Ç^*£d÷;xÑœ@£p"g}»¥Ú&¡.S€u¶·È¸z×([|c §X<à 0Q³M©ÔU áÌ] ¨€@‘†ãŒzRxR- |@E'ô‹À…Yá­Vþnø4·åˆµì#†‹Mgvغ–V ƒpãJ—C–Už©Y6ÖÚ84À*ЃçÚ RArq« € UWx†Z0ÌV _(âi‘I¸LAú°E3¢ ÿ¢ ¬À4ÒÅ70ÅP1Ê\$ ƒ6PâKÙÜ·¨Â ´¡ °6ô¥¨ `@ Æ’$ 7Á›»üGj˜ §@@œM4»B$!W”¨ôlÓÙ 7Ú’L¸0X(ãL0Dt† ©HKzÒqJTFpIµàRîˆÔÓÿ,Õ?¿m*a ¢_õ*Y A0£Yb …6˜ŠJ\@¡¸üÒÊ"—€?Ü¥£P–“a„³y®µ¡è–¤1\¯²'2©DTêJ2p?Cx±¤%™´ :¨@$ðœÀ§éÆ6ÕÒ\È 8°gV')éÂ]ítÀ°Q `G¯8 mo Ç›Œ¢ ÿÞl!ô´³Ð p€ƒ T!Ç3èÆy#ÃôIÅ=e¢Ï»Ô‚a 8Á5òªch#Zú˜…@j±M™4 pÀ3“ÀÃ.œä‘~8dþ‘o:”ùFæC]6>[]…+\1‹>f+ÿjv…bŸö´8šJjHÄšŸá Þ0—̬sÏ¥5'‚ª8í°2Xf¤ÕGЬ  7f2Û¹B'a…¡]‘ˆg¬.!²´Ý(ÈQKHÎÔÇÄS_¹Lã )(Û!þÐ\wŽu ­j]ûú&|‚͇b€‚)ý¶°å݉QÀ›¨n|CªWæ#ƒV°Ö‡uÀi]kXÿ‹¶á2Þ¿Îp‚7\¢ݳø½ÏòÀÀb©/DZf¾ùsÀ-ùMr8 cÿ ò¸ø€¸ñý“è njšÏœÖ4ß0ïd^ðšãÜçg.e†'ôÁLL…<.Ð×àްF:Òq\½@_±YŠþJ5€È€ Éü™Lò™È€bâ XÓÏ|Îq‚8$"Ç(¤d"t¯c €iQ*øP‡I¼èîF7ò±>À;ׇàƒß¿Ž]Ô!Œ½ùV|ñ4>œ[ð»àƒ©W‰-¼ ‚ÏGæx(0ü¢q?î¿ö÷_(¥ÖëŠæÕS49 NbßÊ1èÿl Dd¢Ã!× ÿêü´3lãu0 G:â n(Xk¹Èm£Ø&| Mbåwÿv"”‚¹ÞÙx4Iî3y«`÷PB<°þ±:žÞáï``‚[âu¡°5ÆcØ´6:6O™€;%Ä8ðbc “>ñóœ%"@ ÙUj³0ûcQ‚QØñHd€iÅ9‰³eã h0F8t6æ¤Ö°ç í¤ SÂpüp® ÐÀ ®°19^8ä„KÅÔç°¤_rc¼ñ~‚33`ËPÞà. „wÑ P/éà ¬À Ð`‘Ã&pÕÁ  V8*lи‘¸³Aiõ¢OC?Sa¥ €U"ÿГ?Í À?õ1 <`(bƀȡ° ÓÔ±,¶„fZ!Ù0`/`|¥ÃP!9\Ùq/ QPY7q8Ó¥s#<–(lÐf-² £BL-A(ÐéÐ ­ð ·ºˆ?îáIw.XˆTEö;t"î° }}p™˜y™Ë 3‘FgD=2ieàHøi’jñ¦tÁ Ï€N vL”sH U€™Ë` ÒP dFÉc2œâ]!’„ni‘õq 9ð=/àa%/¸>Gc!„PÀ1˜´Ñ *)úfô 8ÿ¡s‹ b¿ÃŒÎ8j‘TtF=¨5*çxZð ̰“ð€Ç ¾ !XÐ|j&ÄYœb÷} µà| [´C“<.$”È?Dg$h ðŒ4¯ Ú¡Ð` G7 @Jfg¦ãÀÀwB-00¾ æ1; d o8aÈZ ZÆöP @S»P ÀL6“°kØ!†žᣯãùÀÅ:–7/qOé#˜c÷[cŽ'1 €§à¡z {ð‰ P]R³ ާ¢|'90ÒÐGú£˜¶ž‚D³/'à/¥ÿq!v‰—yÅy°D7ô–øØ•Ò2f"p]ÉÐS&ú¢i°©ùã“û¢IŽv.¦À °®°m娂a 캮ìX©˜Õ ÍPOÃ`W £V¤üêiÐ ÐÀ @ìÊ‘w‘é@@i`­P3Ñ` w0¯õŠ̰ »®´PŸãò ‹P}á@±™àË‹t˜0²|¹Y ‡b 6›s^àóêB±¸¦póš/“ Ô°UûÚ²Ýx±´€c-B ¤à±®ÖCY žÆƒ¶ÄRÔsñ$FÒ¨$VÃâj®6ÈæGBѪ¶&ÔsÛ²µ-Y¶¥Æµ5—k½6s–—n„.öq!ñ³ybK·>÷ACkj?'G²ös}A±ˆk;j4¹„ p …i¸³ºë¸”t’kjJuº‚‹¸¤«k›¸ç;«ä |°·ìªãBÄmÇÒ®["o/TZ7o¿¦A&¹gÍKiõ¦˜eÚŒ7ånñ™nïR½2Yiô¦™lBA\”AÛÆ<àz=e –˜æZIê½ÚûCk¦ÕË<Ë+<©-É‹UÐòžÎë¼ñ;´T¦ó¾Ö ¿’6Àuõ»ò‰=•P '@`` \Á|ÁœÁ<Ð;Apache-ASP-2.63/site/xml.html0000644000175000017500000004200513252377730014020 0ustar jobjob Apache::ASP::Xml/xslt
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
      INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
    % XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    XML/XSLT
    Custom Tags with XMLSubsMatch References
    XSLT Tranformations  

    Custom Tags with XMLSubsMatch

    Before XML, there was the need to make HTML markup smarter.
    Apache::ASP gives you the ability to have a perl
    subroutine handle the execution of any predefined tag,
    taking the tag descriptors, and the text contained between,
    as arguments of the subroutine.  This custom tag
    technology can be used to extend a web developer's abilities
    to add dynamic pieces without having to visibly use 
    <% %> style code entries.
    
    So, lets say that you have a table that you want to insert for an employee with contact info and the like, you could set up a tag like:
     <my:new-employee name="Jane" last="Doe" phone="555-2222">
       Jane Doe has been here since 1998.
     </my:new-employee>
    
    To render it with a custom tag, you would tell the Apache::ASP parser to render the tag with a subroutine:
      PerlSetVar XMLSubsMatch my:new-employee
    
    Any colons, ':', in the XML custom tag will turn into '::', a perl package separator, so the my:employee tag would translate to the my::employee subroutine, or the employee subroutine in the my package. Any dash "-" will also be translated to an underscore "_", as dash is not valid in the names of perl subroutines.
    Then you would create the my::employee subroutine in the my perl package or whereever like so:
      package my;
      sub new_employee {
        my($attributes, $body) = @_;
        $main::Response->Include('new_employee.inc', $attributes, $body);
      }
      1;
    
      <!-- # new_employee.inc file somewhere else, maybe in Global directory -->
      <% my($attributes, $body) = @_; %>
      
      <% for('name', 'last', 'phone') { %>
        
      <% } %>
      
    <%=ucfirst $_ %>: <%= $attributes->{$_} %>
    <%= $body %>
    <!-- # end new_employee.inc file -->
    The $main::Response->Include() would then delegate the rendering of the new-employee to the new_employee.inc ASP script include.
    Though XML purists would not like this custom tag technology to be related to XML, the reality is that a careful site engineer could render full XML documents with this technology, applying all the correct styles that one might otherwise do with XSLT.
    Custom tags defined in this way can be used as XML tags are defined with both a body and without as it
      <my:new-employee>...</my:new-employee>
    
    and just
      <my:new-employee />
    
    These tags are very powerful in that they can also enclose normal ASP logic, like:
      <my:new-employee>
        <!-- normal ASP logic -->
        <% my $birthday = &HTTP::Date::time2str(time - 25 * 86400 * 365); %>
    
        <!-- ASP inserts -->
        This employee has been online for <%= int(rand()*600)+1 %>
        seconds, and was born near <%= $birthday %>.
      </my:new-employee>   
    
    For an example of this custom XML tagging in action, please check out the ./site/eg/xml_subs.asp script.

    XSLT Tranformations

    XML is good stuff, but what can you use it for? The principle is
    that by having data and style separated in XML and XSL files, you
    can reformat your data more easily in the future, and you 
    can render your data in multiple formats, just as easily 
    as for your web site, so you might render your site to
    a PDA, or a cell phone just as easily as to a browser, and all
    you have to do is set up the right XSL stylesheets to do the
    transformation (XSLT).
    
    With native XML/XSLT support, Apache::ASP scripts may be the source of XML data that the XSL file transforms, and the XSL file itself will be first executed as an ASP script also. The XSLT transformation is handled by XML::XSLT or XML::Sablotron and you can see an example of it in action at the ./site/eg/xslt.xml XML script.
    To specify a XSL stylesheet, use the setting:
      PerlSetVar XSLT template.xsl
    
    where template.xsl could be any file. By default this will XSLT transform all ASP scripts so configured, but you can separate xml scripts from the rest with the setting:
      PerlSetVar XSLTMatch xml$
    
    where all files with the ending xml would undergo a XSLT transformation.
    Note that XSLT depends on the installation of XML::XSLT, which in turn depends on XML::DOM, and XML::Parser. As of version 2.11, XML::Sablotron may also be used by setting:
      PerlSetVar XSLTParser XML::Sablotron
    
    and XML::LibXSLT may be used, as of 2.29, by setting
      PerlSetVar XSLTParser XML::LibXSLT
    
    If you would like to install XML::Sablotron or XML::LibXSLT, you will first have to install the libraries that these perl modules use, which you can get at:
      libxslt - The XSLT C Library for Gnome
    
      Sablotron - Ginger Alliance
    
    For more on XML::XSLT, the default XSLT engine that Apache::ASP will use, please see:
      XML::XSLT
    
    XML:XSLT was the first supported XSLT engine as has the benefit of being written in pure perl so that though while it is slower than the other solutions, it is easier to port.
    If you would like to cache XSLT tranformations, which is highly recommended, just set:
      PerlSetVar XSLTCache 1
    
    Please see the Cache settings in the CONFIG section for more about how to configure the XSLTCache.

    References

    For more information about XSLT, please see the standard at:
    
      http://www.w3.org/TR/xslt
    
    For their huge ground breaking XML efforts, these other XML OSS projects need mention:
      Cocoon - XML-based web publishing, in Java
    
      AxKit - XML web publishing with Apache & mod_perl
    
     
    Apache-ASP-2.63/site/rectangle_power_perl.gif0000755000175000017500000000161511721310312017206 0ustar jobjobGIF89aX³ÿÿÿ`i—3cŒ¡¬nsvj›f™^ŠAŒ²ÃÏÕBaV‰Ùÿ"0>EG,XÿpÉI«½8ëÍwh`(Ždižhª’Œ³0H,Ïtmßx®ÛCo3 ì@,ȤrÉD§@ G qH(¾ "! Hxà ÂPþ¦nµ Apache::ASP
    Apache::ASP
    <% Web Applications with Apache & mod_perl %>
    % INTRO
      INSTALL
      CONFIG
      SYNTAX
      EVENTS
      OBJECTS
      SSI
      SESSIONS
      XML/XSLT
      CGI
      PERLSCRIPT
      STYLE GUIDE
      FAQ
      TUNING
      CREDITS
      SUPPORT
      SITES USING
      TESTIMONIALS
      RESOURCES
      TODO
      CHANGES
      LICENSE

      EXAMPLES

    Powered by Apache::ASP
    Powered by ModPerl and Apache
    Powered by Perl
    INTRO
    Apache::ASP provides an Active Server Pages port to the Apache Web Server with Perl scripting only, and enables developing of dynamic web applications with session management and embedded Perl code. There are also many powerful extensions, including XML taglibs, XSLT rendering, and new events not originally part of the ASP API!
    Apache::ASP's features include:
    • Scripting SYNTAX is Natural and Powerful
    • Rich OBJECTS Developer API
    • Web Application EVENTS Model
    • Modular SSI Decomposition, Code Sharing
    • User SESSIONS, CIFS & NFS Cluster Ready
    • XML/XSLT Rendering & Custom Tag Technology
    • CGI Compatibility
    • PERLSCRIPT Compatibility
    • Great Open Source SUPPORT
    This module works under the Apache Web Server with the mod_perl module enabled. See http://www.apache.org and http://perl.apache.org for further information.
    This is a portable solution, similar to ActiveState's PerlScript for NT/IIS ASP. Work has been done and will continue to make ports to and from this implementation as smooth as possible.
    For Apache::ASP downloading and installation, please read the INSTALL section. For installation troubleshooting check the FAQ and the SUPPORT sections.
    For database access, ActiveX, scripting languages, and other miscellaneous issues please read the FAQ section.
     
    Apache-ASP-2.63/asp-perl0000755000175000017500000000736011721310312013022 0ustar jobjob#!/usr/bin/perl # for more accurate per request time accounting BEGIN { eval "use Time::HiRes"; $Apache::ASP::QuickStartTime = eval { &Time::HiRes::time(); } || time(); } # help section use File::Basename; use Getopt::Std; use Cwd; use Carp qw(confess); use Apache::ASP::CGI; =pod =head1 NAME asp-perl - Apache::ASP CGI and command line script processor =head1 SYNOPSIS asp-perl [-hsdb] [-f asp.conf] [-o directory] file1 @arguments file2 @arguments ... -h Help you are getting now! -f Specify an alternate configuration file other than ./asp.conf -s Setup $Session and $Application state for script. -d Set to debug code upon errors. -b Only return body of document, no headers. -o Output directory, writes to files there instead of STDOUT -p GlobalPackage config, what perl package are the scripts compiled in. =head1 DESCRIPTION This program will run Apache::ASP scripts from the command line. Each file that is specified will be run, and the $Request->QueryString() and $Request->Form() data will be initialized by the @arguments following the script file name. The @arguments will be written as space separated words, and will be initialized as an associate array where %arguments = @arguments. As an example: asp-perl file.asp key1 value1 key2 value2 would be similar to calling the file.asp in a web environment like /file.asp?key1=value1&key2=value2 The asp.conf script will be read from the current directory for parameters that would be set with PerlSetVar normally under mod_perl. For more information on how to configure the asp.conf file, please see < http://www.apache-asp.org/cgi.html > =head1 SEE ALSO perldoc Apache::ASP, and also http://www.apache-asp.org =head1 COPYRIGHT Copyright 1998-2004 Joshua Chamas, Chamas Enterprises Inc. This program is distributed under the GPL. Please see the LICENSE file in the Apache::ASP distribution for more information. =cut $SIG{__DIE__} = \&confess; getopts('hsdbo:p:f:'); if($opt_h || ! @ARGV) { open(SCRIPT, $0) || die("can't open $0 for reading: $!"); my $script = join('',