Marcus Ramberg > Catalyst-Plugin-ConfigLoader-0.23 > Catalyst::Plugin::ConfigLoader::Manual

Download:
Catalyst-Plugin-ConfigLoader-0.23.tar.gz

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Source   Latest Release: Catalyst-Plugin-ConfigLoader-0.34

NAME ^

Catalyst::Plugin::ConfigLoader::Manual - Guide to using the ConfigLoader plugin

BASIC USAGE ^

    package MyApp;
    
    use Catalyst qw( ConfigLoader ... );

ENVIRONMENT VARIABLES ^

CONFIG FORMATS ^

Config::General

Extensions

Example Config

    name = TestApp
    <Component Controller::Foo>
        foo bar
    </Component>
    <Model Baz>
        qux xyzzy
    </Model>

INI

Extensions

Example Config

    name=TestApp
    
    [Controller::Foo]
    foo=bar
    
    [Model::Baz]
    qux=xyzzy

JSON

Extensions

Example Config

    {
        "name": "TestApp",
        "Controller::Foo": {
            "foo": "bar"
        },
        "Model::Baz": {
            "qux": "xyzzy"
        }
    }

Perl

Extensions

Example Config

    {
        name => 'TestApp',
        'Controller::Foo' => {
            foo => 'bar'
        },
        'Model::Baz' => {
            qux => 'xyzzy'
        }
    }

XML

Extensions

Example Config

    <config>
        <name>TestApp</name>
        <component name="Controller::Foo">
            <foo>bar</foo>
        </component>
        <model name="Baz">
            <qux>xyzzy</qux>
        </model>
    </config>

YAML

Extensions

Example Config

    ---
    name: TestApp
    Controller::Foo:
        foo: bar
    Model::Baz:
        qux: xyzzy

COOKBOOK ^

Configuring a Catalyst::Model::DBIC::Schema model from a YAML config

    Model::MyModel:
      schema_class: MyApp::MySchema
      connect_info:
        - dbi:SQLite:myapp.db
        - ''
        - ''
        - AutoCommit: 1 

Converting your existing config to Config::General format

As of Catalyst::Devel 1.07, a newly created application will use Config::General for configuration. If you wish to convert your existing config, run the following one-liner (replacing MyApp with your app's name):

    perl -Ilib -MMyApp -MConfig::General -e 'Config::General->new->save_file("myapp.conf", MyApp->config);'

Using UTF-8 strings in a Config::General file

If you have UTF-8 strings in your Config::General-based config file, you should add the following config information to MyApp.pm:

    __PACKAGE__->config( 'Plugin::ConfigLoader' => {
        driver => {
            'General' => { -UTF8 => 1 },
        }
    } );
syntax highlighting: