App::Session can represents a sequence of multiple events perhaps executed in separate processes.
# ... official way to get a Session object ...
$session = App->context();
$context = $session->session(); # get the session
# any of the following named parameters may be specified
$session = $context->session(
# ... alternative way (used internally) ...
A Session class models the sequence of events associated with a use of the system. These events may occur in different processes.
For instance, in a web environment, when a new user arrives at a web site, he is allocated a new Session, even though he may not even be authenticated. In subsequent requests, his actions are tied together by a Session ID that is transmitted from the browser to the server on each request. During the Session, he may log in, log out, and log in again. Finally, Sessions in the web environment generally time out if not accessed for a certain period of time.
Conceptually, the Session may span processes, so they generally have a way to persist themselves so that they may be reinstantiated wherever they are needed. This would certainly be true in CGI or Cmd Contexts where each CGI request or command execution relies on and contributes to the running state accumulated in the Session. Other execution Contexts (Curses, Gtk) only require trivial implementations of a Session because it stays in memory for the duration of the process. Nonetheless, even these Contexts use a Session object so that the programming model across multiple platforms is the same.