1Catalyst::Plugin::ConfiUgsLeoradCeorn(t3r)ibuted Perl DoCcautmaelnytsatt:i:oPnlugin::ConfigLoader(3)
2
3
4

NAME

6       Catalyst::Plugin::ConfigLoader - Load config files of various types
7

SYNOPSIS

9           package MyApp;
10
11           # ConfigLoader should be first in your list so
12           # other plugins can get the config information
13           use Catalyst qw( ConfigLoader ... );
14
15           # by default myapp.* will be loaded
16           # you can specify a file if you'd like
17           __PACKAGE__->config( file => 'config.yaml' );
18

DESCRIPTION

20       This module will attempt to load find and load a configuration file of
21       various types. Currently it supports YAML, JSON, XML, INI and Perl for‐
22       mats.
23
24       To support the distinction between development and production environ‐
25       ments, this module will also attemp to load a local config (e.g.
26       myapp_local.yaml) which will override any duplicate settings.
27

METHODS

29       setup( )
30
31       This method is automatically called by Catalyst's setup routine. It
32       will attempt to use each plugin and, once a file has been successfully
33       loaded, set the "config()" section.
34
35       load_config
36
37       This method handles loading the configuration data into the Catalyst
38       context object. It does not return a value.
39
40       find_files
41
42       This method determines the potential file paths to be used for config
43       loading.  It returns an array of paths (up to the filename less the
44       extension) to pass to Config::Any for loading.
45
46       get_config_path
47
48       This method determines the path, filename prefix and file extension to
49       be used for config loading. It returns the path (up to the filename
50       less the extension) to check and the specific extension to use (if it
51       was specified).
52
53       The order of preference is specified as:
54
55       * $ENV{ MYAPP_CONFIG }
56       * "$c->config->{ file }"
57       * "$c->path_to( $application_prefix )"
58
59       If either of the first two user-specified options are directories, the
60       application prefix will be added on to the end of the path.
61
62       get_config_local_suffix
63
64       Determines the suffix of files used to override the main config. By
65       default this value is "local", but it can be specified in the following
66       order of preference:
67
68       * $ENV{ CATALYST_CONFIG_LOCAL_SUFFIX }
69       * $ENV{ MYAPP_CONFIG_LOCAL_SUFFIX }
70       * "$c->config->{ config_local_suffix }"
71
72       finalize_config
73
74       This method is called after the config file is loaded. It can be used
75       to implement tuning of config values that can only be done at runtime.
76       If you need to do this to properly configure any plugins, it's impor‐
77       tant to load ConfigLoader before them.  ConfigLoader provides a default
78       finalize_config method which walks through the loaded config hash and
79       replaces any strings beginning containing "__HOME__" with the full path
80       to app's home directory (i.e. "$c->path_to('')" ).  You can also use
81       "__path_to(foo/bar)__" which translates to "$c->path_to('foo', 'bar')"
82

AUTHOR

84       Brian Cassidy <bricas@cpan.org>
85

CONTRIBUTORS

87       The following people have generously donated their time to the develop‐
88       ment of this module:
89
90       * Joel Bernstein <rataxis@cpan.org> - Rewrite to use Config::Any
91       * David Kamholz <dkamholz@cpan.org> - Data::Visitor integration
92
93       Work to this module has been generously sponsored by:
94
95       * Portugal Telecom <http://www.sapo.pt/> - Work done by Joel Bernstein
96
98       Copyright 2007 by Brian Cassidy
99
100       This library is free software; you can redistribute it and/or modify it
101       under the same terms as Perl itself.
102

SEE ALSO

104       * Catalyst
105       * Catalyst::Plugin::ConfigLoader::Manual
106       * Config::Any
107
108
109
110perl v5.8.8                       2006-12-14 Catalyst::Plugin::ConfigLoader(3)
Impressum