Apache-ASP

 view release on metacpan or  search on metacpan

ASP.pm  view on Meta::CPAN

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.

ASP.pm  view on Meta::CPAN

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])

ASP.pm  view on Meta::CPAN

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 

ASP.pm  view on Meta::CPAN

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

ASP.pm  view on Meta::CPAN

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

ASP.pm  view on Meta::CPAN

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

ASP.pm  view on Meta::CPAN

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().  

ASP.pm  view on Meta::CPAN

 !! 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.

ASP.pm  view on Meta::CPAN

   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"

ASP.pm  view on Meta::CPAN


 (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

ASP.pm  view on Meta::CPAN

  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

ASP.pm  view on Meta::CPAN

  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.

=item $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.

=item $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

ASP.pm  view on Meta::CPAN

  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

ASP.pm  view on Meta::CPAN


=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 

ASP.pm  view on Meta::CPAN


 +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)

ASP.pm  view on Meta::CPAN

 -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

ASP.pm  view on Meta::CPAN

	  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

MANIFEST  view on Meta::CPAN

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

Makefile.PL  view on Meta::CPAN

    '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',

README  view on Meta::CPAN

        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.

README  view on Meta::CPAN

        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:

README  view on Meta::CPAN


        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 );

README  view on Meta::CPAN

    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

README  view on Meta::CPAN

        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().

README  view on Meta::CPAN

     !! 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.

README  view on Meta::CPAN

           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

README  view on Meta::CPAN


         (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

README  view on Meta::CPAN

          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

README  view on Meta::CPAN

         -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()

README  view on Meta::CPAN

          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

README  view on Meta::CPAN

         -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 

README  view on Meta::CPAN


         +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)

README  view on Meta::CPAN

         -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

README  view on Meta::CPAN

                  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

lib/Apache/ASP/Request.pm  view on Meta::CPAN

	    $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+

lib/Apache/ASP/Request.pm  view on Meta::CPAN

		} 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; 

lib/Apache/ASP/Request.pm  view on Meta::CPAN

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] };

lib/Apache/ASP/Response.pm  view on Meta::CPAN


    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;

lib/Bundle/Apache/ASP/Extra.pm  view on Meta::CPAN

  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

site/cgi.html  view on Meta::CPAN

affect.
<font face="courier new" size=3><pre>
	print $query-&gt;header();
	print $query-&gt;start_form();
</pre></font>
	
	<p>
	<a name=File%20Upload></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>File Upload</b></font>
<font face="courier new" size=3><pre>
</pre></font>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-&gt;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.
<font face="courier new" size=3><pre>
	my $filehandle = $Request-&gt;Form(&#39;file_upload_field_name&#39;);
	print $filehandle; # will get you the file name
	my $data;
	while(read($filehandle, $data, 1024)) {
		# data from the uploaded file read into $data
	};
</pre></font>Please see the docs on CGI.pm (try perldoc CGI) for more information
on this topic, and <a href=eg/file_upload.asp>./site/eg/file_upload.asp</a> for an example of its use.
Also, for more details about CGI.pm itself, please see the web site:
<font face="courier new" size=3><pre>
    <a href=http://search.cpan.org/dist/CGI/>http://search.cpan.org/dist/CGI/</a>
</pre></font>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:
<font face="courier new" size=3><pre>
    <a href=http://backpan.cpan.org/modules/by-authors/id/L/LD/LDS/>http://backpan.cpan.org/modules/by-authors/id/L/LD/LDS/</a>
</pre></font>There is also $Request-&gt;FileUpload() API extension that you can use to get 
more data about a file upload, so that the following properties are
available for querying:
<font face="courier new" size=3><pre>
  my $file_upload = $Request-&gt;{FileUpload}{upload_field};
  $file_upload-&gt;{BrowserFile}
  $file_upload-&gt;{FileHandle}
  $file_upload-&gt;{ContentType}

  # only if FileUploadTemp is set
  $file_upload-&gt;{TempFile}	

  # whatever mime headers are sent with the file upload
  # just &quot;keys %$file_upload&quot; to find out
  $file_upload-&gt;{?Mime-Header?}
</pre></font>Please see the $Request section in <a href=objects.html><font size=-1 face=verdana><b>OBJECTS</b></font></a> for more information.</font>
	

</font>
</td>

<td bgcolor=white valign=top>
&nbsp;
</td>

site/changes.html  view on Meta::CPAN

   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-&gt;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.
</pre></font>
	
	<p>

site/changes.html  view on Meta::CPAN


 (d) Updated documention for the $Application-&gt;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-&gt;FileUpload(&#39;upload_file&#39;, &#39;BrowserFile&#39;) 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.
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%2025b84bf7e></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 2.51; $DATE="02/10/2003"</b></font>

site/changes.html  view on Meta::CPAN

  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 <a href=eg/file_upload.asp>./site/eg/file_upload.asp</a> 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&#39;s LimitRequestBody as a hard limit.

 --Under certain circumstances with file upload, it seems that IsClientConnected() 
  would return an aborted client value from $r-&gt;connection-&gt;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-&gt;IsClientConnected is called,
  then $r-&gt;connection-&gt;aborted returns the right value.
  
  This problem was probably introduced with IsClientConnected() code changes
  starting in the 2.25 release.
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%20211fd057b></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 2.27; $DATE="10/31/2001";</b></font>

site/changes.html  view on Meta::CPAN

  necessary.
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%202d4094038></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 2.15; $DATE="06/12/2001";</b></font>
<font face="courier new" size=3><pre>
 -Fix for running under perl 5.6.1 by removing parser optimization
  introduced in 2.11.

 -Now file upload forms, forms with ENCTYPE=&quot;multipart/form-data&quot;
  can have multiple check boxes and select items marked for 
  @params = $Request-&gt;Form(&#39;param_name&#39;) functionality.  This 
  will be demonstrated via the <a href=eg/file_upload.asp>./site/eg/file_upload.asp</a> example.
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%2023614edca></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 2.11; $DATE="05/29/2001";</b></font>
<font face="courier new" size=3><pre>
 +Parser optimization from Dariusz Pietrzak

 -work around for global destruction error message for perl 5.6
  during install

site/changes.html  view on Meta::CPAN

  in a new SESSIONS section.  Also documented new 
  FileUpload configs and $Request-&gt;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-&gt;{FileUpload}{$form_field}{TempFile}.
  The regular use of file uploads remains the same
  with the &lt;$filehandle&gt; to the upload at 
  $Request-&gt;{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&#39;t drag down the whole site, since most
  users will have cookies turned on.   

 -StatINC &amp; StatINCMatch will not undef Fnctl.pm flock 
  functions constants like O_RDWR, because the code references

site/changes.html  view on Meta::CPAN

	<a name=%24VERSION%20%3D%200b667e0c4></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 0.14; $DATE="07/29/1999";</b></font>
<font face="courier new" size=3><pre>
 -CGI &amp; 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 &amp; 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&#39;t seem to do 
  the right thing.

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

 +Better handling of &quot;use strict&quot; errors in ASP scripts.
  The error is detected, and the developer is pointed to the 

site/changes.html  view on Meta::CPAN


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

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

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

 -$Request-&gt;Form() now reads file uploads correctly with 
  the latest CGI.pm, where $Request-&gt;Form(&#39;file_field&#39;) returns
  the actual file name uploaded, which can be used as a file handle
  to read in the data.  Before, $Request-&gt;Form(&#39;file_field&#39;) 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-&gt;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-&gt;Form()

 +Cleaned up and optimized $Request code

 +Updated documentation for CGI input &amp; 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 &lt;!--include file=file args=@args--&gt;
  extension.  This style of include is compiled as an anonymous sub &amp; 
  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-&gt;Include(&#39;file&#39;, @args)

site/changes.html  view on Meta::CPAN

 -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-&gt;Form()
	@values = $Response-&gt;Form(&#39;multi&#39;);

 -Better CGI.pm compatibility with $r-&gt;header_out(&#39;Content-type&#39;),
  improved garbage collection under modperl, esp. w/ file uploads
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%200394bbc7f></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 0.06; $DATE="12/21/1998";</b></font>
<font face="courier new" size=3><pre>
 +Application_OnStart &amp; 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

site/changes.html  view on Meta::CPAN

	  shedding the -&gt;{Item} for Collection support (? better way ?)
	: No VBScript dates support, just HTTP RFC dates with HTTP::Date
	: Win32::OLE::in not supported, just use &quot;keys %{$Collection}&quot;	

 +./cgi/asp script for testing scripts from the command line
	: will be upgraded to CGI method of doing asp
	: is not &quot;correct&quot; 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.
</pre></font>
	
	<p>
	<a name=%24VERSION%20%3D%2003a5fe2db></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>$VERSION = 0.05; $DATE="10/19/1998";</b></font>
<font face="courier new" size=3><pre>
 +Added PERFORMANCE doc, which includes benchmarks  +hints.

 +Better installation warnings and errors for other modules required. 

site/config.html  view on Meta::CPAN

	
	<p>
	<a name=File%20Uploads></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>File Uploads</b></font>
</font>
	
	<p>
	<a name=FileUploadMa625d7c4d></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>FileUploadMax</b></font>
<font face="courier new" size=3><pre>
</pre></font>default 0, if set will limit file uploads to this
size in bytes.  This is currently implemented by 
setting $<a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a>::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.
<font face="courier new" size=3><pre>
  PerlSetVar 100000
</pre></font>
	
	<p>
	<a name=FileUploadTeb83a1ea3></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>FileUploadTemp</b></font>
<font face="courier new" size=3><pre>
</pre></font>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. 
<font face="courier new" size=3><pre>
</pre></font>The path to the temp file will be available at
$Request-&gt;{FileUpload}{$form_field}{TempFile}.
The regular use of file uploads remains the same
with the &lt;$filehandle&gt; to the upload at 
$Request-&gt;{Form}{$form_field}.  Please see the <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> section
for more information on file uploads, and the $Request
section in <a href=objects.html><font size=-1 face=verdana><b>OBJECTS</b></font></a>.
<font face="courier new" size=3><pre>
  PerlSetVar FileUploadTemp 0
</pre></font>
	

</font>
</td>

<td bgcolor=white valign=top>

site/eg/file_upload.asp  view on Meta::CPAN

#!/usr/bin/perl /usr/bin/asp-perl

<!--#include file="header.inc"-->

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.
<p>
Note that the current limit set on uploads for this demo is
<tt>	
<%
my $limit = $Server->Config('FileUploadMax') || $CGI::POST_MAX;
$limit = ($limit eq '-1') ? 'NONE' : $limit;
print "$limit";
%>
</tt>.
<% if($limit && ($limit < $Request->{TotalBytes})) { %>
  This limit was <b>exceeded</b> by a POST of <tt><%= $Request->{TotalBytes} %></tt> bytes!
<% } %>
<table border=0><tr><td valign=center>
<%
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 "</td><td valign=center>";
print $q->submit('Upload File');
%>
</td></tr></table>

<br>
<b>File Upload Type:</b>
<%= 
    $q->checkbox_group(-name=>'extensions',
		   -values=>['GIF','HTML','OTHER'],
		   -defaults=>['HTML']
		   )
  %>
</form>   

<% 
my $filehandle;
if($filehandle = $Request->{Form}{uploaded_file}) { 
    %>
      Upload Type Specified: <%= join(', ', $Request->Form('extensions')) %><br>
    <%
    local *FILE;
    my $upload = $Request->{FileUpload}{uploaded_file};
    print "<table>";
    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);
		%>
		<tr>
			<td><b><font size=-1><%=$key%></font></b></td>
			<td><font size=-1><%=$value%></font></td>
		</tr>

site/eg/global.asa  view on Meta::CPAN


       '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. ',

site/faq.html  view on Meta::CPAN

		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Apache%20errorf0bcd572>Apache errors on the PerlHandler or PerlModule directives ?</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#How%20are%20file3e89fb5c>How are file uploads handled?</a>
			</font>
			</td>
							
		</tr>
		
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Error%3A%20no%20reb1d13fcf>Error: no request object (Apache=SCALAR(0x???????):)</a>

site/faq.html  view on Meta::CPAN

	<font face=verdana><font class=title size=-1 color=#555555><b>What is the best way to debug an ASP application ?</b></font>
<font face="courier new" size=3><pre>
</pre></font>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-&gt;Debug() API extension, and the Debug
configuration directive.</font>
	
	<p>
	<a name=How%20are%20file3e89fb5c></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>How are file uploads handled?</b></font>
<font face="courier new" size=3><pre>
</pre></font>Please see the <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> section.  File uploads are implemented
through <a href=http://stein.cshl.org/WWW/software/CGI/cgi_docs.html><font size=-1 face=verdana><b>CGI.pm</b></font></a> 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&#39;t be a big deal if you 
are working with bulky file uploads.</font>
	
	<p>
	<a name=How%20do%20I%20acc6523fd95></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>How do I access the ASP Objects in general?</b></font>
<font face="courier new" size=3><pre>
</pre></font>All the ASP objects can be referenced through the main package with
the following notation:
<font face="courier new" size=3><pre>
 $main::Response-&gt;Write(&quot;html output&quot;);
</pre></font>This notation can be used from anywhere in perl, including routines

site/kudos.html  view on Meta::CPAN

 !! Gregory Youngblood, Thanos Chatziathanassiou, &amp; 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 &amp; 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,
    &amp; 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 &amp; 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.

site/objects.html  view on Meta::CPAN

	<p>
	<a name=%24Request-%3EBi2e1177cf></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Request->BinaryRead([$length])</b></font>
<font face="courier new" size=3><pre>
</pre></font>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.
<font face="courier new" size=3><pre>
</pre></font>Note that BinaryRead will not return any data for file uploads.
Please see the $Request-&gt;FileUpload() interface for access
to this data.  $Request-&gt;Form() data will also be available
as normal.</font>
	
	<p>
	<a name=%24Request-%3ECled50cd44></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Request->ClientCertificate()</b></font>
<font face="courier new" size=3><pre>
</pre></font>Not implemented.</font>
	

site/objects.html  view on Meta::CPAN

the cookies that you set will only last until you close your browser, 
so you may find your self opening &amp; closing your browser a lot when 
debugging cookies.
<font face="courier new" size=3><pre>
</pre></font>For more information on cookies in ASP, please read $Response-&gt;Cookies()</font>
	
	<p>
	<a name=%24Request-%3EFi6799fcec></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Request->FileUpload($form_field, $key)</b></font>
<font face="courier new" size=3><pre>
</pre></font>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-&gt;Form() collection.  This collection of collections
may be queried through the normal interface like so:
<font face="courier new" size=3><pre>
  $Request-&gt;FileUpload(&#39;upload_file&#39;, &#39;ContentType&#39;);
  $Request-&gt;FileUpload(&#39;upload_file&#39;, &#39;FileHandle&#39;);
  $Request-&gt;FileUpload(&#39;upload_file&#39;, &#39;BrowserFile&#39;);
  $Request-&gt;FileUpload(&#39;upload_file&#39;, &#39;Mime-Header&#39;);
  $Request-&gt;FileUpload(&#39;upload_file&#39;, &#39;TempFile&#39;);

  * note that TempFile must be use with the UploadTempFile 
    configuration setting.
</pre></font>The above represents the old slow collection interface, 
but like all collections in Apache::ASP, you can reference
the internal hash representation more easily.
<font face="courier new" size=3><pre>
  my $fileup = $Request-&gt;{FileUpload}{upload_file};
  $fileup-&gt;{ContentType};
  $fileup-&gt;{BrowserFile};
  $fileup-&gt;{FileHandle};
  $fileup-&gt;{Mime-Header};
  $fileup-&gt;{TempFile};
</pre></font>
	
	<p>
	<a name=%24Request-%3EFo76659178></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Request->Form($name)</b></font>

site/objects.html  view on Meta::CPAN

a hash of all the form data.  One can use this hash to 
create a nice alias to the form data like:
<font face="courier new" size=3><pre>
 # in global.asa
 use vars qw( $Form );
 sub Script_OnStart {
   $Form = $Request-&gt;Form;
 }
 # then in ASP scripts
 &lt;%= $Form-&gt;{var} %&gt;
</pre></font>File upload data will be loaded into $Request-&gt;Form(&#39;file_field&#39;), 
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:
<font face="courier new" size=3><pre>
 while(read($Request-&gt;Form(&#39;file_field_name&#39;), $data, 1024)) {};
</pre></font>For more information, please see the <a href=cgi.html><font size=-1 face=verdana><b>CGI</b></font></a> / File Upload section,
as file uploads are implemented via the <a href=http://stein.cshl.org/WWW/software/CGI/cgi_docs.html><font size=-1 face=verdana><b>CGI.pm</b></font></a> module.  An
example can be found in the installation 
samples <a href=eg/file_upload.asp>./site/eg/file_upload.asp</a></font>
	
	<p>
	<a name=%24Request-%3EPa455879ca></a>
	<font face=verdana><font class=title size=-1 color=#555555><b>$Request->Params($name)</b></font>
<font face="courier new" size=3><pre>
</pre></font>API extension. If RequestParams <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> is set, the $Request-&gt;Params 
object is created with combined contents of $Request-&gt;QueryString 
and $Request-&gt;Form.  This is for developer convenience simlar 
to <a href=http://stein.cshl.org/WWW/software/CGI/cgi_docs.html><font size=-1 face=verdana><b>CGI.pm</b></font></a>&#39;s param() method.  Just like for $Response-&gt;Form, 
one could create a nice alias like:

site/perlscript.html  view on Meta::CPAN

</pre></font>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 <a href=config.html><font size=-1 face=verdana><b>CONFIG</b></font></a> section for more info.
<font face="courier new" size=3><pre>
</pre></font>The following objects in Apache::ASP respond as Collections:
<font face="courier new" size=3><pre>
        $Application
	$Session
	$Request-&gt;FileUpload *
	$Request-&gt;FileUpload(&#39;upload_file&#39;) *
	$Request-&gt;Form
	$Request-&gt;QueryString
	$Request-&gt;Cookies
	$Response-&gt;Cookies
	$Response-&gt;Cookies(&#39;some_cookie&#39;)	

  * FileUpload API Extensions
</pre></font>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.



( run in 2.383 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )