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