ASP4::Request - Interface to the incoming request
if( my $cookie = $Request->Cookies('cust-email') ) { # Greet our returning user: } if( my $file = $Request->FileUpload('avatar_pic') ) { # Handle the uploaded file: $file->SaveAs( "/var/media/$Session->{user_id}/avatar/" . $file->FileName ); } if( $Request->ServerVariables("HTTPS") ) { # We're under SSL: }
The intrinsic $Request object provides a few easy-to-use methods to simplify the processing of incoming requests - specifically file uploads and cookies.
$Request
Returns a cookie by name, or all cookies if no name is provided.
A wrapper around the global %ENV variable.
%ENV
This means that:
$Request->ServerVariables('HTTP_HOST')
is the same as:
$ENV{HTTP_HOST}
Returns a ASP4::FileUpload object that corresponds to the fieldname specified.
So...if your form has this:
<input type="file" name="my_uploaded_file" />
Then you would get to it like this:
my $upload = $Request->FileUpload('my_uploaded-file');
Returns the value of an incoming http request header by the given name.
It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4 to submit bug reports.
Please visit the ASP4 homepage at http://0x31337.org/code/ to see examples of ASP4 in action.
To install ASP4, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ASP4
CPAN shell
perl -MCPAN -e shell install ASP4
For more information on module installation, please visit the detailed CPAN module installation guide.