NAME
Apache2::ASP::ApplicationStateManager - The $Application object
SYNOPSIS
# In a handler, ASP script or your GlobalASA:
$Application->{some_gobal_thing} = "A new value";
# ...then, in all requests to the server...
my $val = $Application->{some_global_thing};
# You can also store objects:
$Application->{some_object} = My::Thing->new( ... );
# You can access the current $Application through the context also:
my $app = Apache2::ASP::HTTPContext->current->application;
DESCRIPTION
All $Application
objects are instances of one or another subclass of Apache2::ASP::ApplicationStateManager
.
Apache2::ASP::ApplicationStateManager
is the base class for all ApplicationStateManagers.
The $Application
object is implemented as a simple, blessed hash with no special magick going on anywhere. $Application
is not a blessed hash and does not depend on special semantics, nor does it expect special treatment.
Storage
By default, when it is time to store the contents of the $Application
object for later retrieval, the venerable Storable module is used. The resulting binary blob is stored in the database referred to in the data_connections/application
part of the config.
Configuration
The apache2-asp-config.xml
configuration file should contain a section like the following:
<?xml version="1.0" ?>
<config>
...
<data_connections>
...
<application>
<manager>Apache2::ASP::ApplicationStateManager::SQLite</manager>
<dsn>DBI:mysql:dbname:hostname</dsn>
<username>sa</username>
<password>s3cr3t!</password>
</application>
...
</data_connections>
...
</config>
Database Storage
The table that the $Application
object is stored in has the following structure:
CREATE TABLE asp_applications (
application_id varchar(100) NOT NULL,
application_data blob,
PRIMARY KEY (application_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Different databases will have different ways of spelling that, but the structure is clear.
PUBLIC METHODS
save( )
Stores the object in the database. Returns true.
BUGS
It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.
HOMEPAGE
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
AUTHOR
John Drago mailto: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.