CatalystX::Usul::Model::Config - Read and write configuration files
Describes v0.17.$Rev: 1 $
package YourApp; use Catalyst qw(ConfigComponents...); __PACKAGE__->config( 'Model::Config' => { parent_classes => q(CatalystX::Usul::Model::Config) }, );
Provides CRUD methods for read and write configuration files. For each schema a subclass is defined that inherits from this class
Defines the following list of attributes;
classes
A hash ref which defaults to an empty ref. Keyed by field name its values are CSS class names which are applied to the field's input element
create_msg_key
A simple string which defaults to NUL. The message that is added to the result div when a new configuration element is created
NUL
ctrldir
Defaults to $self->usul->config->ctrldir the location of the configuration files
$self->usul->config->ctrldir
default_ns
A non empty simple string which defaults to default. The default namespace
default
delete_msg_key
A simple string which defaults to NUL. The message that is added to the result div when a configuration element is deleted
domain_attributes
Overrides the base class default with { storage_class = q(Any) }>. Passed to the domain class each time an instance is created
{ storage_class =
domain_class
Overrides the base class default with CatalystX::Usul::Config. The classname of the domain model
CatalystX::Usul::Config
extension
Defaults to $self->usul->config->extension the default filename extension for configuration files
$self->usul->config->extension
fields
An array ref of strings which defaults to the empty list. If empty the domain models source attributes are used instead. It is the list of fields used on the form for the configuration element
keys_attr
A simple string which defaults to NUL. The attribute name that is used as the key for the configuration element
ns_key
A non empty simple string which defaults to namespace. A stash key whose stashed value is a list of controller namespaces
namespace
phase
Defaults to $self->usul->config->phase the type number for this installation
$self->usul->config->phase
prompts
A hash ref of prompts used to override the default one on a per field basis. Keyed by attribute name
table_class
A loadable class which defaults to Class::Usul::Response::Table. The class of the table object passed to HTML::FormWidgets when the configuration element contains a table
Class::Usul::Response::Table
table_data
A hash ref which defaults to an empty hash. The data for a table object
typelist
A hash ref which defaults to an empty hash. The list of type for each field
update_msg_key
A simple string which defaults to NUL. The message that is added to the result div when a configuration element is updated
Creates a new domain_class object and makes a copy of the request object
$self->config_form( $namespace, $config_element_name );
Creates the form to edit a configuration element
$config_element_name = $self->create( $namespace, $args );
Creates a new element. The $args hash requires these keys; file the name of the file to edit, name the name of the element to edit and fields is a hash containing the attributes of the new element
$args
file
name
$config_element_name = $self->create_or_update( $namespace, $args );
Creates a new element if one does not exist or updates the existing one if it does exist
$self->delete( $args );
Deletes an element
$config_object = $self->find( $namspace, $name );
Returns the requested configuration element if it exists
$selected_list_and_named_element = $self->list( $namespace, $name );
Retrieves the named element and a list of elements
$config = $self->load( @{ $files } );
Loads the required configuration files. Returns a hash ref
$self->load_per_request_config;
Loads the config data for the current request. The data is split across six files; one for OS dependant data, one for this phase (live, test, development etc.), default data and language dependant default data, data for the current controller and it's language dependant data. This information is cached
Data in the globals attribute is raised to the top level of the stash and the globals attribute deleted
globals
$count = $self->push_attribute( $namespace, $args );
Add new items to an attribute list. The $args hash requires these keys; file the name of the file to edit, name the name of the element to edit, list the attribute of the named element containing the list of existing items, req the request object and field the field on the request object containing the list of new items
list
req
field
@elements = $self->search( $args );
Searches the given file for elements matching the given criteria. Returns an array of element objects
$count = $self->splice_attribute( $namespace, $args );
Removes items from an attribute list
$config_element_name = $self->update( $namespace, $args );
Updates the named element
$bool = $self->update_list( $namespace, $args );
Will push/splice attributes to/from the selected list
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
<Support at RoxSoft.co.uk>
Copyright (c) 2014 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install CatalystX::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Usul
CPAN shell
perl -MCPAN -e shell install CatalystX::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.