The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Helix::Core::Config - Helix Framework generic application configuration.

SYNOPSIS

Example application configuration (lib/Example/Config.pm):

    package Example::Config;
    use base qw/Helix::Core::Config/;

    our $VERSION  = "0.1";

    sub new
    {
        my ($class, $name, $type, $self);

        ($class, $name, $type) = @_;

        $self = $class->SUPER::new($name, $type);
        $self->{"app"}->{"title"} = "Example application";

        $self->{"drivers"} = 
        [
            {
                "class" => "Helix::Driver::Template::HTML",
                "points" => [ "tpl" ],
                "params" => [ "./templates/" ]
            }
        ];

        return $self;
    }

DESCRIPTION

The Helix::Core::Config class holds common configuration for all Helix Framewok 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 has our $VERSION variable defined.

  • root_dir

    Application root directory. Determined automatically by executing getcwd(). You can redefine this manually, if you need. This value isn't used for internal needs.

  • 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 method has no Private code attribute. In private application only authorized users can view pages, if page method has no Public code attribute.

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.

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.

  • points

    Reference to array of mount points. If no points specified, driver will not be instantiated and you should do this manually later in controller code.

  • params

    Reference to array of driver initialization parameters. This parameters will be sent to 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

Helix, Helix::Application

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