Bot::Cobalt::Manual::Plugins::Config - Cobalt config file primer
This document is a very brief overview aimed at plugin authors in need of a quick reference to plugin configuration files loaded via Config directives.
Bot::Cobalt configuration files are written in YAML. http://yaml.org/spec/1.1/
Mostly, you will see hash structures like this:
$ cat etc/plugins/mine/myplugin.conf --- ## config for MyPlugin ## RequiredLevels: hash specifying access levels for commands: RequiredLevels: cmd_ensnackulate: 2 cmd_refrobulate: 1
...which would be converted, upon load, into a Bot::Cobalt::Conf::File::PerPlugin object.
(These structures would normally be accessed by plugins via the Core's "get_plugin_cfg" in Bot::Cobalt::Core::Role::EasyAccessors method or "plugin_cfg" in Bot::Cobalt::Core::Sugar -- see Bot::Cobalt::Manual::Plugins for details.)
See Bot::Cobalt::Manual::Plugins::Dist for details on embedding configuration files installable via cobalt2-plugin-installcf.
Indentation builds nested structures; 2 spaces is the standard for Bot::Cobalt configuration files:
Opts: SomeOpt: 1 OtherOpts: ThisElement: "Some string"
Many configuration options, especially in the core plugin set, are simple boolean true/false:
## Example of a boolean true or false ## if UseSSL is commented out, 0, or ~ (undef), it is "false" ## true if 1 or some other positive value like a string ("Yes") UseSSL: 1 ## ...just as valid for a simple boolean check: UseSSL: "Yes please!"
SomeString: A string
Strings can be quoted:
SomeString: "A string"
For example:
SomeNum: 176.100 ## Numeric 176.1 SomeNum: "176.100" ## String "176.100"
Within double-quotes, special characters can be escaped C-style.
A block literal might look something like this:
## newlines preserved: ThisDoc: | Some text here. And even more text here. Perhaps some more! ## newlines folded: ThisDoc: > <p>Some literal html</p> <p>More of it</p>
MyHash: Scalar_item: "a scalar" Another_Hash: Item_one: 1 Item_two: "String"
Item_two would be available via MyHash->{Another_Hash}->{Item_two}.
A list/array looks something like this:
MyList: - An item - Another item ## a deeply nested structure: MyUsers: - JoeUser - Bobby - Another list - SomeHash: One_Item: 1 Another_item: "Some string"
(In this example, Another_item would be available via MyUsers[3]->{Another_item})
http://yaml.org/spec/1.1/
YAML::XS
Jon Portnoy <avenj@cobaltirc.org>
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.