File Coverage

blib/lib/Maypole/Config.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Maypole::Config;
2 1     1   1031 use base qw(Class::Accessor::Fast);
  1         1  
  1         624  
3             use attributes ();
4              
5             use strict;
6             use warnings;
7              
8             our $VERSION = 2.121;
9              
10             # Public accessors.
11             __PACKAGE__->mk_accessors(
12             qw(
13             view view_options template_root template_extension build_form_elements
14             uri_base rows_per_page application_name
15             model loader display_tables ok_tables
16             dsn user pass opts
17             additional
18             request_options
19             )
20             );
21              
22             # Should only be modified by model.
23             __PACKAGE__->mk_ro_accessors(qw( classes tables));
24              
25             1;
26              
27             =head1 NAME
28              
29             Maypole::Config - Maypole Configuration Class
30              
31             =head1 DESCRIPTION
32              
33             This class stores all configuration data for your Maypole application.
34              
35             =head1 METHODS
36              
37             =head2 View related
38              
39             =head3 application_name
40              
41             This should be a string containing your application's name.
42              
43             Optional. Is used in the factory templates.
44              
45             =head3 rows_per_page
46              
47             This is the number of rows your application should display per page.
48              
49             Optional.
50              
51             =head3 tables
52              
53             Contains a list of all tables, if supported by model.
54              
55             =head3 template_extension
56              
57             Optional template file extension.
58              
59             =head3 template_root
60              
61             This is where your application can find its templates.
62              
63             =head3 uri_base
64              
65             This is the URI base that should be prepended to your application when Maypole
66             makes URLs.
67              
68             =head3 view
69              
70             The name of the view class for your Maypole Application. Defaults to
71             "Maypole::View::TT".
72              
73             =head3 build_form_elements
74              
75             Globally specify whether to build form elements; populating the cgi metadata with
76             autogenerated HTML::Element widgets for the class/object.
77              
78             Can be over-ridden per action using the method of the same name for the request.
79              
80             If not set, then Maypole will assume it is true.
81              
82             =head3 view_options
83              
84             A hash of configuration options for the view class. Consult the documentation
85             for your chosen view class for information on available configuration options.
86              
87             =head2 Model-Related
88              
89             =head3 classes
90              
91             This config variable contains a list of your view classes. This is set
92             up by the
93             model class, and should not be changed in the view or the config.
94              
95             =head3 display_tables
96              
97             This is a list of the tables that are public to your Maypole
98             application. Defaults to all the tables in the database.
99              
100             =head3 dsn
101              
102             The DSN to your database. Follows standard DBD syntax.
103              
104             =head3 loader
105              
106             This is the loader object (n.b. an instance, not a class name). It's set
107             up by the CDBI model to an instance of "Class::DBI::Loader" if it's not
108             initialized before calling setup().
109              
110             =head3 model
111              
112             The name of the model class for your Maypole Application. Defaults to
113             "Maypole::Model::CDBI".
114              
115             =head3 ok_tables
116              
117             This is a hash of the public tables. It is populated automatically by
118             Maypole from the list in display_tables and should not be changed.
119              
120             =head3 pass
121              
122             Password for database user.
123              
124             =head3 opts
125              
126             Other options to the DBI connect call.
127              
128             =head3 user
129              
130             Username to log into the database with.
131              
132             =head3 build_form_elements
133              
134             Flag specifying whether to build metadata for form elements in factory templates
135              
136             =head3 request_options
137              
138             Hashref of options passed when creating cgi or apache request
139              
140             =head2 Adding additional configuration data
141              
142             You can use the 'additional' attribute for stashing additional info, especially from additional_data method,
143             i.e. $r->config->additional({foo=>bar});
144              
145             Or..
146              
147             If your modules need to store additional configuration data for their
148             own use or to make available to templates, add a line like this to your
149             module:
150              
151             Maypole::Config->mk_accessors(qw(variable or variables));
152              
153             Care is needed to avoid conflicting variable names.
154              
155             =head1 SEE ALSO
156              
157             L
158              
159             =head1 AUTHOR
160              
161             Sebastian Riedel, C
162              
163             =head1 AUTHOR EMERITUS
164              
165             Simon Cozens, C
166              
167             =head1 LICENSE
168              
169             You may distribute this code under the same terms as Perl itself.
170              
171             =cut
172