Apache2::ASP::ApplicationStateManager - The $Application object
# 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;
All $Application objects are instances of one or another subclass of Apache2::ASP::ApplicationStateManager.
$Application
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.
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.
data_connections/application
The apache2-asp-config.xml configuration file should contain a section like the following:
apache2-asp-config.xml
<?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>
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.
Stores the object in the database. Returns true.
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.
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
John Drago mailto:jdrago_999@yahoo.com
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.
To install Apache2::ASP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::ASP
CPAN shell
perl -MCPAN -e shell install Apache2::ASP
For more information on module installation, please visit the detailed CPAN module installation guide.