NAME

Apache2::ASP::Request - Incoming request processor

SYNOPSIS

<%
  # Cookies:
  my $cookie = $Request->Cookies( "mycookie" );
  my $cookie2 = $Request->Cookies( "cookie2", "fieldname" );
  
  # Form/QueryString values:
  my $Form = $Request->Form; # returns a hashref of all form/querystring data:
  my $name = $Form->{user_name};
  my $name = $Request->Form( 'user_name' );
  
  # File uploads (a):
  my $ifh = $Request->FileUpload( "fieldname" );
  while( my $line = <$ifh> )
  {
    # Process $line from file:
  }# end while()
  
  # File uploads (b):
  my %info = $Request->FileUpload( "fieldname" );
  # %info has the following structure:
  %info = (
    'ContentType'         => 'image/gif',
    'FileHandle'          => <an IO::Handle object>,
    'BrowserFile'         => 'C:\Documents and Settings\franky\Desktop\myfile.gif'
  );
  
  # QueryString itself:
  my $qstring = $Request->QueryString();
  
  # ServerVariables:
  my $host = $Request->ServerVariables( 'HTTP_HOST' );
%>

DESCRIPTION

The global $Request object is an instance of Apache2::ASP::Request.

PUBLIC METHODS

Cookies( $name [, $key] )

Given the $name only, returns the whole value of the cookie.

Given the $name and $key, returns only that part of a multi-value cookie.

Form( [$key] )

Called without a $key, returns a hashref of all Form and QueryString data.

Called with a $key, returns only the value for that field.

FileUpload( $field [, $arg ] )

Called in scalar context, returns a filehandle to the uploaded file.

Called in list context, returns a hash containing the following fields:

  • ContentType

    A value like image/gif or text/html. The MIME-Type of the uploaded file.

  • FileHandle

    The stream/filehandle from which the contents of the uploaded file may be read.

  • BrowserFile

    The name of the file as it was on the client's side. For example, C:\Program Files\file.txt.

QueryString( )

Returns the contents of $ENV{HTTP_QUERYSTRING} or an empty string if it is not available.

ServerVariables( [$key] )

Called without a $key, returns a sorted list of all keys in %ENV.

Called with a $key, returns the value associated with that element in %ENV.

AUTHOR

John Drago jdrago_999@yahoo.com

COPYRIGHT AND LICENSE

Copyright 2007 John Drago, All rights reserved.

This software is free software. It may be used and distributed under the same terms as Perl itself.