Razor2::Client::Config(3) User Contributed Perl Documentation Razor2::Client::Config(3)

Razor2::Client::Config - Configuration management for Vipul's Razor

# Typically used via Razor2::Client::Agent, not directly
use Razor2::Client::Agent;
my $agent = Razor2::Client::Agent->new('razor-check');
$agent->read_options() or die $agent->errstr;
$agent->do_conf()      or die $agent->errstr;
# Access configuration values
my $debuglevel = $agent->{conf}{debuglevel};

Razor2::Client::Config handles all configuration file and identity management for the Razor2 client. It reads and writes the razor-agent.conf configuration file, resolves the razorhome directory, and manages user identity files used for authentication with Razor servers.

This module is a parent class of Razor2::Client::Agent and is not typically instantiated directly.

Reads the Razor configuration. Resolves which config file to use (command-line override, user home, or system default), merges defaults with file values and command-line options, and stores the result in "$self->{conf}".

$params is an optional hash reference of additional overrides.

Returns the configuration hash reference on success.

Determines the path to the razor-agent.conf file. Checks the user's razorhome first (~/.razor/razor-agent.conf), then the system default (/etc/razor/razor-agent.conf). Sets "$self->{razorconf}" and "$self->{computed_razorconf}".
Writes configuration to the razor-agent.conf file. If $hash is not provided, reads the current file and merges with defaults.
Resolves the razorhome directory. Search order: command-line "-home" option, "razorhome" from config file, "$HOME/.razor/", config file directory. Sets "$self->{razorhome}".

On VMS, uses "_razor" instead of ".razor".

Creates the razorhome directory at $rhome with mode 0755.
Resolves the identity file path from command-line options, configuration, or the default (<razorhome>/identity). Follows symlinks.
Reads and returns the identity file as a hash reference with "user" and "pass" keys. Warns if the file is world-readable.
Writes an identity hash ("user", "pass") to disk with mode 0600. Creates a symlink from identity to the user-specific file unless "-i" was specified. Falls back to file copy on systems without symlink support.

Returns the identity file path on success.

General-purpose config file reader. In hash mode (default), parses "key = value" lines into a hash reference, skipping comments. In array mode ($nothash true), returns an array reference of lines.

$defaults provides initial values that file contents override.

Writes data to a file. Accepts a hash reference (written as "key = value"), array reference (one item per line), or scalar reference (raw content). Supports append mode, a header string, and advisory file locking via flock(2).
Returns a hash reference of default agent configuration values.
Returns a hash reference of default per-server configuration values.

/etc/razor/razor-agent.conf
System-wide configuration file.
~/.razor/razor-agent.conf
Per-user configuration file (takes precedence over system config).
~/.razor/identity
Symlink to the active identity file.
~/.razor/identity-<user>
Identity file containing credentials for a registered user.

razor-agent.conf(5), Razor2::Client::Agent, Razor2::Client::Core

Vipul Ved Prakash, <mail@vipul.net>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2026-04-06 perl v5.42.2