Plasp::State::Application - Role for $Application objects


  package MyApp::Application;

  with 'Plasp::State::Application';


Like the $Session object, you may use the $Application object to store data across the entire life of the application. Every page in the ASP application always has access to this object. So if you wanted to keep track of how many visitors there where to the application during its lifetime, you might have a line like this:


The Lock and Unlock methods are used to prevent simultaneous access to the $Application object.



Not implemented. This is a no-op. This is unnecessary given the implementation


Not implemented. This is a no-op. This is unnecessary given the implementation


This NON-PORTABLE API extension returns a user $Session given a session id. This allows one to easily write a session manager if session ids are stored in $Application during Session_OnStart, with full access to these sessions for administrative purposes.

Be careful not to expose full session ids over the net, as they could be used by a hacker to impersonate another user. So when creating a session manager, for example, you could create some other id to reference the SessionID internally, which would allow you to control the sessions. This kind of application would best be served under a secure web server.


This NON-PORTABLE method returns the current number of active sessions in the application, and is enabled by the SessionCount configuration setting. This method is not implemented as part of the original ASP object model, but is implemented here because it is useful. In particular, when accessing databases with license requirements, one can monitor usage effectively through accessing this value.