|a user-editable text file usually called config.yml|
|an SQLite database which shouldnt be edited by the user|
Every setting is accessed by a mutator named after it as follows:
# Get the identity of the current user my $name = $config->identity_name; # Set the identity of the current user my $changed = $config->identity_name("John Smith");
Padre needs to store different types of settings, storing them in different places depending on their impact, with Padre::Config allows access to access them with a unified API (a mutator).
o User settings
Those settings are general settings that relates to user preferences. They range from general user interface look & feel (whether to show the line numbers, etc.) to editor preferences (tab width, etc.) and other personal settings.
Those settings are stored in a YAML file in your configuration directory (which you can see in the About dialog)
o Host settings
Those preferences are related to the host on which Padre is run. The principal example of those settings is the locatio of the main window appearance, and other values which could be different between different operating systems and machines.
Those settings are stored in a SQLite file.
o Project settings
Those preferences are related to the project of the file you are currently editing and allow, in principle, projects to set policies on certain values.
Examples of those settings are whether to use tabs or spaces, etc.
While the vast majority of the methods for this class are mutator front ends, a number of methods exist which allow you to interact with the config system more directly.
The meta method finds the configuration metadata for a named setting.
The default method reports the default value for the setting in the context of the currently running instance of Padre (some settings may have different default on different operating systems, for example)
Returns a value that is legal for the setting type, or throws an exception if the named setting does not exist.
my $same = ! $config->changed( "identity_name", "John Smith" );
The changed method takes a named setting and a value for that setting, and determines if setting that value on the config would result in the configuration being changed.
my $changed = $config->set("identity_name", "John Smith");
The set method takes a named setting and a value and modifies the configuration object to have that value.
Changes made to the configuration in this manner will not be reflected in the running instance, for that you should use the apply method.
Returns true, or throws an exception on errors such as a non-existant setting name or an illegal value for that setting type.
my $changed = $config->apply("main_directory_panel", "right");
For example, if the directory panel is open and on the left side of the display, running the sample code above will change the location preference to the right side and immediately move the directory panel to the other side of the IDE.
Returns true if the configuration was changed, false if the value was the same as the existing configuration value and did not need to be modified, or throws an exception on errors such as a non-existant setting name or an illegal value for that setting type.
Add a setting() - call to the correct section of this file.
The setting() call initially creates the option and defines some metadata like the type of the option, its living place and the default value which should be used until the user configures a own value.
Copyright 2008-2013 The Padre development team as listed in Padre.pm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.
|perl v5.20.3||PADRE::CONFIG (3)||2013-11-09|