NAME
CPAN::Maker::ConfigReader - Read CPAN::Maker configuration from an INI file
SYNOPSIS
use CPAN::Maker::ConfigReader;
# uses ~/.gitconfig by default
my $reader = CPAN::Maker::ConfigReader->new;
# or specify a file explicitly
my $reader = CPAN::Maker::ConfigReader->new('/path/to/.cpan-makerrc');
# or set CPAN_MAKER_CONFIG in the environment
# CPAN_MAKER_CONFIG=~/.cpan-makerrc
my $reader = CPAN::Maker::ConfigReader->new;
print $reader->user_name;
print $reader->cpan_maker_basedir;
DESCRIPTION
CPAN::Maker::ConfigReader reads configuration for the CPAN::Maker build system from an INI-format file. By default it reads from the user's global ~/.gitconfig file, which means no additional configuration is required for most developers who already have git set up.
For users who prefer a dedicated configuration file or who do not use git, any properly formatted INI file can be used instead. See "CONFIGURATION FILE" for the expected format.
CONFIGURATION FILE
The configuration file uses standard INI format as read by Config::Tiny. The following sections and keys are recognized:
[user]
[user]
name = First Last
email = you@example.com
github = your-github-username
name-
Your full name. Used to populate the author field in generated module stubs and buildspec.yml.
email-
Your email address. Used in generated module stubs, buildspec.yml, and the bugtracker
mailtofield when--resources githubis specified. github-
Your GitHub username. Used to construct repository, homepage, and bugtracker URLs when
--resources githubis specified.
[cpan-maker]
[cpan-maker]
basedir = /home/you/git
resources = github
syntax-checking = on
perltidyrc = /home/you/.perltidyrc
perlcriticrc = /home/you/.perlcriticrc
llm-api-key-helper = cat ~/.ssh/anthropic-api-key
max-tokens = 4096
basedir-
The directory in which new projects are created. Equivalent to passing
--basediron the command line. resources-
Controls generation of the resources file. Currently only
githubis supported. Equivalent to passing--resources githubon the command line. syntax-checking-
Set to
onto enable Perl syntax checking during the build viaperl -wcin the%.pmand%.plpattern rules. See "EXTENDING THE BUILD SYSTEM" in CPAN::Maker::Bootstrapper for details. perltidyrc-
Path to a .perltidyrc configuration file. When set, enables
perltidychecking in the build system pattern rules. perlcriticrc-
Path to a .perlcriticrc configuration file. When set, enables
perlcriticchecking in the build system pattern rules. llm-api-key-helper-
A shell command whose output is used as the LLM API key. Executed when no key is passed directly and
LLM_API_KEYis not set in the environment. The command should print the key and nothing else. The file it reads should be chmod 600.Example: cat ~/.ssh/anthropic-api-key
METHODS
new
my $reader = CPAN::Maker::ConfigReader->new;
my $reader = CPAN::Maker::ConfigReader->new($file);
Creates a new ConfigReader instance. The configuration file is resolved in the following order:
Dies if the resolved file does not exist or cannot be read.
get_value
my $val = $reader->get_value($section, $key);
Low-level accessor for any section and key in the config file. Useful for reading project-specific keys beyond those ConfigReader knows about.
user_name
Returns name from the [user] section.
user_email
Returns email from the [user] section.
user_github
Returns github from the [user] section.
cpan_maker_basedir
Returns basedir from the [cpan-maker] section.
cpan_llm_api_key_helper
Bash snippet or the name of an executable script that provides the LLM API key.
max-tokens
The maxium number of tokens output tokens.
cpan_maker_perltidyrc
Returns perltidyrc from the [cpan-maker] section.
cpan_maker_perlcriticrc
Returns perlcriticrc from the [cpan-maker] section.
cpan_maker_resources
Returns resources from the [cpan-maker] section.
cpan_maker_syntax_checking
Returns syntax-checking from the [cpan-maker] section.
ENVIRONMENT
CPAN_MAKER_CONFIG-
Path to the configuration file. Used when no file is passed to
new. Allows the config file location to be set once in your shell profile:export CPAN_MAKER_CONFIG=~/.cpan-makerrc
SEE ALSO
CPAN::Maker::Bootstrapper - the scaffolding tool that uses this module
Config::Tiny - the INI file parser underlying this module
AUTHOR
Rob Lauer - <rlauer@treasurersbriefcase.com>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.