view release on metacpan or search on metacpan
2010-03-01 v1.017
- Updated asphelper script to only accept options on the command-line, like "normal" scripts.
2010-02-28 v1.016
- A vestigial "use encoding 'utf8'" was removed from ASP4::Server.
- It was causing Apache to segfault on ubuntu 9.10.
2010-02-19 v1.015
- Hostnames like http://myapplication/ were not setting session cookies properly.
- $Config->data_connections->session->cookie_domain should set to "*" in these cases.
- $Response->SetCookie accepts the "*" value for domain also.
- The result is that no "domain=xyz" attribute is given to these cookies.
2010-02-18 v1.014
- $Response->ContentType now functions correctly.
- Upgrade mandatory!
2010-02-18 v1.013
- ASP4::HandlerResolver was not properly remembering timestamps on handler files.
This resulted in unnecessary reloads of handlers that had not been changed.
2010-02-18 v1.012
- MANIFEST was missing a few files that caused tests to fail.
2010-02-17 v1.011
! Upgrade Recommended !
- $Response->SetCookie and $Response->ContentType were not functioning properly.
- Added new method $Response->SetHeader.
2010-02-10 v1.010
! UPGRADE *SERIOUSLY* RECOMMENDED !
- In an environment with multiple VirtualHosts running ASP4 web applications,
ASP4::HandlerResolver's %HandlerCache and %FileTimes hashes were shared between
all VirtualHosts. This means that if you had 2 web apps (Foo and Bar) then
"/index.asp" on "Foo" might get handled by "Bar::_index_asp" or vice versa.
2010-02-08 v1.009
README.markdown view on Meta::CPAN
This is useful for long-running or asynchronous processes that don't require the
client to wait for a response.
## $Request
An instance of [ASP4::Request](http://search.cpan.org/perldoc?ASP4::Request), the `$Request` object contains specialized methods
for dealing with whatever the browser sent us.
Examples:
### $Request->Cookies( $name )
my $cookie = $Request->Cookies("some-cookie-name");
### $Request->FileUpload( $field_name )
if( my $file = $Request->FileUpload('avatar_pic') ) {
# Handle the uploaded file:
$file->SaveAs( "/var/media/$Session->{user_id}/avatar/" . $file->FileName );
}
See also the [ASP4::FileUpload](http://search.cpan.org/perldoc?ASP4::FileUpload) documentation.
README.markdown view on Meta::CPAN
The following example prints the string `Hello, World!` to the browser:
$Response->Write("Hello, World!");
Or, within an ASP script, `<%= "Hello, World" %>`
### $Response->Redirect( $url )
$Response->Redirect( "/new/url/?foo=bar" );
### $Response->SetCookie( %args )
Setting cookies works as follows:
$Response->SetCookie(
name => "cookie-name",
value => "the-value",
# The rest of these arguments are optional:
# Expires: (If you don't specify the "expires" argument, the cookie will
# be deleted when the browser is closed.
expires => "3D", # 3 days
lib/ASP4.pm view on Meta::CPAN
This is useful for long-running or asynchronous processes that don't require the
client to wait for a response.
=head2 $Request
An instance of L<ASP4::Request>, the C<$Request> object contains specialized methods
for dealing with whatever the browser sent us.
Examples:
=head3 $Request->Cookies( $name )
my $cookie = $Request->Cookies("some-cookie-name");
=head3 $Request->FileUpload( $field_name )
if( my $file = $Request->FileUpload('avatar_pic') ) {
# Handle the uploaded file:
$file->SaveAs( "/var/media/$Session->{user_id}/avatar/" . $file->FileName );
}
See also the L<ASP4::FileUpload> documentation.
lib/ASP4.pm view on Meta::CPAN
The following example prints the string C<Hello, World!> to the browser:
$Response->Write("Hello, World!");
Or, within an ASP script, C<< <%= "Hello, World" %> >>
=head3 $Response->Redirect( $url )
$Response->Redirect( "/new/url/?foo=bar" );
=head3 $Response->SetCookie( %args )
Setting cookies works as follows:
$Response->SetCookie(
name => "cookie-name",
value => "the-value",
# The rest of these arguments are optional:
# Expires: (If you don't specify the "expires" argument, the cookie will
# be deleted when the browser is closed.
expires => "3D", # 3 days
expires => "3H", # or 3 hours
expires => "3M", # or 3 minutes
lib/ASP4/Request.pm view on Meta::CPAN
sub context { ASP4::HTTPContext->current }
# Not documented - for a reason (want to deprecate):
sub Form { shift->{form} }
# Not documented - for a reason (want to deprecate):
sub QueryString { shift->context->cgi->query_string() }
sub Cookies
{
my ($s, $name) = @_;
$name ? $s->context->cgi->cookie( $name ) : $s->context->cgi->cookie;
}# end Cookies()
sub ServerVariables { $ENV{ $_[1] } }
sub FileUpload
{
my ($s, $field) = @_;
my $ifh = $s->context->cgi->upload($field)
or return;
my %info = ( );
lib/ASP4/Request.pm view on Meta::CPAN
1;# return true:
=pod
=head1 NAME
ASP4::Request - Interface to the incoming request
=head1 SYNOPSIS
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:
}
=head1 DESCRIPTION
The intrinsic C<$Request> object provides a few easy-to-use methods to simplify
the processing of incoming requests - specifically file uploads and cookies.
=head1 METHODS
=head2 Cookies( [$name] )
Returns a cookie by name, or all cookies if no name is provided.
=head2 ServerVariables( [$name] )
A wrapper around the global C<%ENV> variable.
This means that:
$Request->ServerVariables('HTTP_HOST')
lib/ASP4/Response.pm view on Meta::CPAN
}# end IsClientConnected()
sub Write
{
my $s = shift;
$s->context->rprint( shift(@_) )
}# end Write()
sub SetCookie
{
my ($s, %args) = @_;
$args{domain} ||= eval { $s->context->config->data_connections->session->cookie_domain } || $ENV{HTTP_HOST};
$args{path} ||= '/';
my @parts = ( );
push @parts, $s->context->server->URLEncode($args{name}) . '=' . $s->context->server->URLEncode($args{value});
unless( $args{domain} eq '*' )
{
push @parts, 'domain=' . $s->context->server->URLEncode($args{domain});
lib/ASP4/Response.pm view on Meta::CPAN
# Days:
$expires = time() + ( $num * 60 * 60 * 24 );
}# end if()
push @parts, 'expires=' . time2str( $expires );
}
else
{
push @parts, 'expires=' . time2str( $args{expires} );
}# end if()
}# end if()
$s->AddHeader( 'Set-Cookie' => join('; ', @parts) . ';' );
}# end SetCookie()
sub AddHeader
{
my ($s, $name, $value) = @_;
$s->context->headers_out->push_header( $name => $value );
}# end AddHeader()
lib/ASP4/Response.pm view on Meta::CPAN
# Expires in the future:
$Response->Expires( '30M' ); # 30 minutes from now
$Response->Expires( '30H' ); # 30 hours from now
$Response->Expires( '30D' ); # 30 days from now
# Expires in the past:
$Response->Expires( '-30M' ); # 30 minutes ago
$Response->Expires( '-30H' ); # 30 hours ago
$Response->Expires( '-30D' ); # 30 days ago
$Response->SetCookie(
# Required parameters:
name => "customer-email",
value => $Form->{email},
# The rest are optional:
expires => '30D', # 30 days
path => '/',
domain => '.mysite.com',
);
lib/ASP4/Response.pm view on Meta::CPAN
...will not work as intended.
=head2 AddHeader( $name => $value )
Appends C<$value> to the header C<$name>.
=head2 SetHeader( $name => $value )
Sets (and replaces) the header C<$name> to the value of C<$value>.
=head2 SetCookie( %args )
Adds a new cookie to the response.
C<%args> B<must> contain the following:
=over 4
=item * name
A string - the name of the cookie.
lib/ASP4/SessionStateManager.pm view on Meta::CPAN
my $config = context()->config->data_connections->session;
my $domain = "";
unless( $config->cookie_domain eq '*' )
{
$domain = "domain=" . ( $config->cookie_domain || $ENV{HTTP_HOST} ) . ";";
}# end unless()
my $name = $config->cookie_name;
my @cookie = (
'Set-Cookie' => "$name=$s->{SessionID}; path=/; $domain"
);
context()->headers_out->push_header( @cookie );
@cookie;
}# end write_session_cookie()
sub verify_session_id
{
my ($s, $id, $timeout ) = @_;
lib/ASP4/UserAgent.pm view on Meta::CPAN
$ENV{SCRIPT_FILENAME} =~ s{/$}{};
$ENV{SCRIPT_FILENAME} .= "/index.asp";
}# end if()
$ENV{SCRIPT_NAME} = $uri_no_args;
}# end unless()
# User-Agent:
$req->header( 'User-Agent' => 'test-useragent v2.0' );
$ENV{HTTP_USER_AGENT} = 'test-useragent v2.0';
# Cookies:
$req->header( 'Cookie' => $ENV{HTTP_COOKIE} = $s->http_cookie );
if( $ENV{REQUEST_METHOD} =~ m/^post$/i )
{
# Set up the basic params:
return ASP4::SimpleCGI->new(
querystring => $ENV{QUERY_STRING},
body => $req->content,
content_type => $req->headers->{'content-type'},
content_length => $req->headers->{'content-length'},
);
t/htdocs/everything/step01.asp view on Meta::CPAN
<%@ Page UseMasterPage="/everything/master.asp" %>
<asp:Content PlaceHolderID="heading">This is the heading!</asp:Content>
<asp:Content PlaceHolderID="content">
This is the content!
<%
$Response->SetCookie(
name => "mycookie111",
value => "woot!",
expires => "30M",
);
$Response->SetCookie(
name => "mycookie222",
value => "woot!",
expires => "30M",
);
%>
</asp:Content>