Eidolon::Application - Eidolon application base class.


Example application package (lib/

    package ExampleApp;
    use base qw/Eidolon::Application/;

    our $VERSION = "0.01";


CGI application gateway (index.cgi):

    use lib "./lib";
    use ExampleApp;

    my $app = ExampleApp->new;


The Eidolon::Application class is the base high-level class of a usual Eidolon application. It creates various system objects, reads application configuration and handles user requests.

Should never be used directly, subclass it from your application's main package instead.

Request processing flow

These steps are performed while processing user request. This sequence can be redefined by the ancestor class, but in most cases you won't need to do this.

1. Create system registry

Registry is the system information structure. This step is done first, because other parts of the system depend on the registry. For more information see "Mount points" in Eidolon::Core::Registry and Eidolon::Core::Registry module documentation.

2. Load application configuration

In this step application loads and instantiates the application configuration class. It contains all basic system settings. Application configuration in example application would be stored in lib/ExampleApp/ For more information see Eidolon::Core::Config.

3. Accept requests (FastCGI application only)

FastCGI application works like a daemon - it resides in memory, accepting connections from the web server. Whence a new connection is established, the application goes to the next step.

4. Handle request

Actually, all the work is done in this step. First of all, the application creates the Eidolon::Core::CGI object, that is used to process all incoming data. Next, application loads system drivers using the Eidolon::Core::Loader object. The list of required drivers must be specified in the application configuration (note, that you must specify a router driver, otherwise the application will not handle requests properly). Afterwards, the application transfers execution to a router driver, which tries to find the request handler and then calls it.

If an error occurs on this step, the application calls an error handler, that is specified in application configuration (or uses the default one - Eidolon::Error).

After request (or error) handling, a CGI application shuts down, but FastCGI application goes next.

5. Go to step #3 (FastCGI application only!)

When a user request is handled, our daemon-like application is ready to serve another clients without termination, so we save a bit of system resources.



Class constructor. Creates an application object.


Application initialization. Creates system registry and loads application configuration. $type - application type (see "CONSTANTS" section below).


User request processing. This function parses and routes the request, then it transfers execution to request handler. If any exception occurs during processing, it tries to start application's error handler. If no such handler was found, application dies.



CGI application is the default type. It is suitable for low-loaded applications. When this type is used, the web server starts one interpreter instance per user request, so if you issue high CPU usage or high memory load - use the next application type.


FastCGI application type is suitable for high-loaded applications with a lot of concurrent connections. It's faster than CGI up to 2000%. This type suggests FCGI module to be installed, otherwise application won't work.


Eidolon, Eidolon::Debug, Eidolon::Core::Registry, Eidolon::Core::Config, Eidolon::Core::CGI, Eidolon::Core::Loader


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Anton Belousov, <>


Copyright (c) 2009, Atma 7,