NAME
Eidolon::Core::Config - generic configuration of the Eidolon application.
SYNOPSIS
Example application configuration (lib/Example/Config.pm
):
package Example::Config;
use base qw/Eidolon::Core::Config/;
our $VERSION = "0.01";
sub new
{
my ($class, $name, $type, $self);
($class, $name, $type) = @_;
$self = $class->SUPER::new($name, $type);
$self->{"app"}->{"title"} = "Example application";
$self->{"drivers"} =
[
{
"class" => "Eidolon::Driver::Router::Basic"
}
];
return $self;
}
DESCRIPTION
The Eidolon::Core::Config class holds common configuration for all Eidolon applications. Each application configuration should inherit this class and redefine generic parameters. This class should never be used directly.
Application configuration section
Main application settings are specified in {"app"}
item of configuration hash. This item contains a hashref of application settings:
title
Application title. Affects nothing, but could be useful in application design.
name
Application class name. Determined automatically, you should not change this manually, otherwise something strange and bad can happen.
version
Application version. Affects nothing, but could be useful sometimes. Value is inserted automatically, if your
Application.pm
hasour $VERSION
variable defined.root
Application root directory. Determined automatically by getting the
$FindBin::Bin
value (see FindBin for more information). You can redefine this manually, if you need. This value isn't used by the Eidolon core.lib
Application library path. Determined automatically by getting the
$FindBin::Bin
value (see FindBin for more information). You can redefine this manually, if you need. This value isn't used by the Eidolon core.type
Application type. Is determined automatically. Do not change it manually!
policy
Application security policy. Can have two possible values: public or private. The default is private. In public application anyone can view any page, if page isn't marked as private explicitly. In private application only authorized users can view pages, if page method isn't marked as public.
error
Application error handler. Is an array reference, first item of array is a class name and the second item is a subroutine name of the error handler. By default, all application errors are handled by the Eidolon::Error package. Obviously, you will want to set your own error handler, so you should change this value.
CGI configuration section
CGI settings are specified in {"cgi"}
item of configuration hash. This item contains a hashref of CGI settings:
max_post_size
Maximal POST request length, in bytes. The default value is 600000.
tmp_dir
Directory path for saving temporary files and session data. The default value is /tmp/.
charset
General application charset. The default value is UTF-8.
content_type
General application content type. The default value is text/html.
session_cookie
Application session cookie name. The default value is SESSIONID.
session_time
Session lifetime (in seconds). The default value is 3600 (1 hour).
Drivers configuration section
Drivers configuration is specified in {"drivers"}
item of a configuration hash. This item is the reference to array of hashrefs, each hashref represents one driver configuration. Hashref items are:
class
Driver class name.
params
Reference to array of driver initialization parameters. This parameters will be sent to a driver constructor during driver initialization.
METHODS
new($name, $type)
Class constructor. Creates generic configuration for application $name
of $type
type.
get_instance()
Returns configuration instance. Class must be instantiated first.
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Anton Belousov, <abel@cpan.org>
COPYRIGHT
Copyright (c) 2009, Atma 7, http://www.atma7.com