1 package Maypole::Config;
2 use base qw(Class::Accessor::Fast);
8 our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/;
11 __PACKAGE__->mk_accessors(
12 qw( view view_options uri_base template_root template_extension model
13 loader display_tables ok_tables rows_per_page dsn user pass opts
14 application_name additional)
17 # Should only be modified by model.
18 __PACKAGE__->mk_ro_accessors(qw( classes tables));
24 Maypole::Config - Maypole Configuration Class
28 This class stores all configuration data for your Maypole application.
34 =head3 application_name
36 This should be a string containing your application's name.
38 Optional. Is used in the factory templates.
42 This is the number of rows your application should display per page.
48 Contains a list of all tables, if supported by model.
50 =head3 template_extension
52 Optional template file extension.
56 This is where your application can find its templates.
60 This is the URI base that should be prepended to your application when Maypole
65 The name of the view class for your Maypole Application. Defaults to
70 A hash of configuration options for the view class. Consult the documentation
71 for your chosen view class for information on available configuration options.
77 This config variable contains a list of your view classes. This is set
79 model class, and should not be changed in the view or the config.
83 This is a list of the tables that are public to your Maypole
84 application. Defaults to all the tables in the database.
88 The DSN to your database. Follows standard DBD syntax.
92 This is the loader object (n.b. an instance, not a class name). It's set
93 up by the CDBI model to an instance of "Class::DBI::Loader" if it's not
94 initialized before calling setup().
98 The name of the model class for your Maypole Application. Defaults to
99 "Maypole::Model::CDBI".
103 This is a hash of the public tables. It is populated automatically by
104 Maypole from the list in display_tables and should not be changed.
108 Password for database user.
112 Other options to the DBI connect call.
116 Username to log into the database with.
118 =head2 Adding additional configuration data
120 You can use the 'additional' attribute for stashing additional info, especially from additional_data method,
121 i.e. $r->config->additional({foo=>bar});
125 If your modules need to store additional configuration data for their
126 own use or to make available to templates, add a line like this to your
129 Maypole::Config->mk_accessors(qw(variable or variables));
131 Care is needed to avoid conflicting variable names.
139 Sebastian Riedel, C<sri@oook.de>
141 =head1 AUTHOR EMERITUS
143 Simon Cozens, C<simon@cpan.org>
147 You may distribute this code under the same terms as Perl itself.