Module::Checkstyle::Config - Handles configuration directives
use Module::Checkstyle::Config; my $config = Module::Checkstyle::Config->new(); my $value = $config->get_directive('max-per-file');
Constructs a new Module::Checkstyle::Config object. The optional argument $source can be either a reference to a GLOB as in new(\*DATA), a reference to a scalar containing the configuration new(\$config) or a scalar containing a path to a configuration file.
Module::Checkstyle::Config
$source
new(\*DATA)
new(\$config)
If the $source is ommited it will look for the configuration file located at ~/.module-checkstyle/config.
Returns a list of enabled sections.
Returns the severity level for a given directive specified by $directive in the section specified by $check. If $check is ommited it will try to figure out what section to read from by investigating the callers package and removing Module::Checkstyle::Check.
$directive
$check
Module::Checkstyle::Check
Returns a the directive specified by $directive in the section specified by $check. If $check is ommited it will try to figure out what section to read from by investigating the callers package and removing Module::Checkstyle::Check.
Module::Checkstyle uses the INI file-format for its configuration file. The following example illustrates a sample config file:
; this is a sample config global-error-level = warn [Whitespace] after-comma = true after-fat-comma = true [Package] max-per-file = 1
Here we have a global configuration diretive, global-error-level, and a few directives applicable to a specified check.
The directive global-error-level sets the severity of a style violation. If it's ommited it will default to 'warn'.
It is however possible to specify the severity on a per-config basis by prefixing the directives value with either 'warn' or 'error' as in matches-name = error qr/\w+/.
matches-name = error qr/\w+/
Some checks expect a boolean value when they read their config. Acceptable booleans are 1, y, yes and true.
Checks that matches names such as variable name or subroutine names expect a regular expression in the config.
To specify a regular expression the recommended way is to use the 'qr' operator as in matches-name = qr/\w+/. If you don't want to use another delimiter it is acceptable to specify the regular expression without 'qr' and using // as in matches-name = /\w+/.
matches-name = qr/\w+/
matches-name = /\w+/
Config::Tiny Module::Checkstyle
To install Module::Checkstyle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Checkstyle
CPAN shell
perl -MCPAN -e shell install Module::Checkstyle
For more information on module installation, please visit the detailed CPAN module installation guide.