ASP4
view release on metacpan or search on metacpan
lib/ASP4/HTTPContext.pm view on Meta::CPAN
}# end end_request()
sub do_disable_session_state
{
my ($s) = @_;
# my ($uri) = split /\?/, $s->r->uri;
my ($uri) = split /\?/, $ENV{REQUEST_URI} || $s->r->uri;
my ($yes) = grep { $_->disable_session } grep {
if( my $pattern = $_->uri_match )
{
$uri =~ m/^$pattern$/
}
else
{
$uri eq $_->uri_equals;
}# end if()
} $s->config->web->disable_persistence;
return $yes;
}# end do_disable_session_state()
sub DESTROY
{
my $s = shift;
$s->session->save if $s->session && ! $s->session->is_read_only;
$s = { };
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::HTTPContext - Provides access to the intrinsic objects for an HTTP request.
=head1 SYNOPSIS
use ASP4::HTTPContext;
my $context = ASP4::HTTPContext->current;
# Intrinsics:
my $request = $context->request;
my $response = $context->response;
my $session = $context->session;
my $server = $context->server;
my $config = $context->config;
my $stash = $context->stash;
# Advanced:
my $cgi = $context->cgi;
my $r = $context->r;
=head1 DESCRIPTION
The HTTPContext itself is the root of all request-processing in an ASP4 web application.
There is only one ASP4::HTTPContext instance throughout the lifetime of a request.
=head1 PROPERTIES
=head2 current
Returns the C<ASP4::HTTPContext> object in use for the current HTTP request.
=head2 request
Returns the L<ASP4::Request> for the HTTP request.
=head2 response
Returns the L<ASP4::Response> for the HTTP request.
=head2 server
Returns the L<ASP4::Server> for the HTTP request.
=head2 session
Returns the L<ASP4::SessionStateManager> for the HTTP request.
=head2 stash
Returns the current stash hash in use for the HTTP request.
=head2 config
Returns the current C<ASP4::Config> for the HTTP request.
=head2 cgi
Provided B<Just In Case> - returns the L<CGI> object for the HTTP request.
=head2 r
Provided B<Just In Case> - returns the L<Apache2::RequestRec> for the HTTP request.
B<NOTE:> Under L<ASP4::API> (eg: in a unit test) C<$r> will be an instance of L<ASP4::Mock::RequestRec> instead.
=head1 BUGS
It's possible that some bugs have found their way into this release.
Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4> to submit bug reports.
=head1 HOMEPAGE
Please visit the ASP4 homepage at L<http://0x31337.org/code/> to see examples
of ASP4 in action.
=cut
( run in 0.433 second using v1.01-cache-2.11-cpan-d8267643d1d )