]> git.decadent.org.uk Git - maypole.git/blob - lib/Maypole/Config.pm
some fixes for Maypole::Config, Maypole::Model::Base and
[maypole.git] / lib / Maypole / Config.pm
1 package Maypole::Config;
2 use base qw(Class::Accessor::Fast);
3 use attributes ();
4
5 use strict;
6 use warnings;
7
8 # Public accessors.
9 __PACKAGE__->mk_accessors(
10     qw( view uri_base template_root model loader display_tables ok_tables
11       rows_per_page dsn user pass opts application_name)
12 );
13
14 # Should only be modified by model.
15 __PACKAGE__->mk_ro_accessors(qw( classes tables));
16
17 1;
18
19 =head1 NAME
20
21 Maypole::Config - Maypole Configuration Class
22
23 =head1 DESCRIPTION
24
25 This class stores all configuration data for your Maypole application.
26
27 =head1 METHODS
28
29 =head2 View related
30
31 =head3 application_name
32
33 This should be a string containing your application's name.
34
35 =head3 rows_per_page
36
37 This is the number of rows your application should display per page.
38
39 =head3 tables
40
41 Contains a list of all tables, if supported by model.
42
43 =head3 template_root
44
45 This is where your application can find its templates.
46
47 =head3 uri_base
48
49 This is the URI base that should be prepended to your application when
50 Maypole
51 makes URLs.
52
53 =head3 view
54
55 The name of the view class for your Maypole Application. Defaults to
56 "Maypole::View::TT".
57
58 =head2 Model-Related
59
60 =head3 classes
61
62 This config variable contains a list of your view classes. This is set
63 up by the
64 model class, and should not be changed in the view or the config.
65
66 =head3 display_tables
67
68 This is a list of the tables that are public to your Maypole 
69 application. Defaults to all the tables in the database.
70
71 =head3 dsn
72
73 The DSN to your database. Follows standard DBD syntax.
74
75 =head3 loader
76
77 This is the loader object (n.b. an instance, not a class name). It's set
78 up by the CDBI model to an instance of "Class::DBI::Loader" if it's not
79 initialized before calling setup().
80
81 =head3 model
82
83 The name of the model class for your Maypole Application. Defaults to
84 "Maypole::Model::CDBI".
85
86 =head3 ok_tables
87
88 This is a hash of the public tables. It is populated automatically by 
89 Maypole from the list in display_tables and should not be changed.
90
91 =head3 pass
92
93 Password for database user.
94
95 =head3 opts
96
97 Other options to the DBI connect call.
98
99 =head3 user
100
101 Username to log into the database with.
102
103 =head2 Adding additional configuration data
104
105 If your modules need to store additional configuration data for their 
106 own use or to make available to templates, add a line like this to your 
107 module:
108
109    Maypole::Config->mk_accessors(qw(variable or variables));
110
111 Care is needed to avoid conflicting variable names.
112
113 =head1 SEE ALSO
114
115 L<Maypole>
116
117 =head1 AUTHOR
118
119 Sebastian Riedel, C<sri@oook.de>
120
121 =head1 AUTHOR EMERITUS
122
123 Simon Cozens, C<simon@cpan.org>
124
125 =head1 LICENSE
126
127 You may distribute this code under the same terms as Perl itself.
128
129 =cut
130