NAME

Liveman::RC - creates and reads the configuration file livemanrc.md

SYNOPSIS

use Liveman::RC;

Liveman::RC->new->update;

The livemanrc.md file is:

# OPTIONS

Test harness: `prove` or `yath` (`-p`/`--prove` and `-y`/`--yath`).

* [ ] harhess: yath

Extra command line options for the harness (`-O`/`--options`).

* [ ] harness-options

Adds version to `requires` by outputting `-D`/`--cpanfile` and `-d`/`--diff-cpanfile`.

* [ ] with-version

Generate tests without `String::Diff`/`Data::Dumper`/`Term::ANSIColor` helpers. Assertions use plain `Test::More` (`is`, `like`, `ok`) without diff diagnostics.

* [ ] without-diff

DESCRIPTION

The module is responsible for livemanrc.md - a file with default options for liveman.

The file contains a section #OPTIONS, in which each option is written as a list item with a checkbox:

  • [X] - the option is applied;

  • [ ] - option is not used;

  • [X] option: value - the option is applied with the value value (for non-boolean options).

Command line options (-w/-W, -v/-V) override values from the file.

SUBROUTINES

new (%param)

Constructor. Initializes known options (option) and their descriptions (remark):

my $rc = Liveman::RC->new;

$rc->{option}{'with-version'}      # -> 0
$rc->{option}{'without-diff'}      # -> 0
$rc->{option}{'harhess'}           # => yath
$rc->{option}{'harness-options'}   # -> ""

You can create with a different path to the file:

Liveman::RC->new(livemanrc => "sub/custom.md")->livemanrc  # => sub/custom.md

livemanrc ()

Returns the path to the configuration file (default livemanrc.md):

Liveman::RC->new->livemanrc  # -> "livemanrc.md"

load ()

Reads livemanrc.md (if it exists) and fills option with the values from the #OPTIONS section. If the file does not exist, it does not change anything.

use File::Slurper qw/read_text write_text/;

write_text 'livemanrc.md', << 'END';
# OPTIONS

* [X] with-version

* [ ] without-diff
END

my $rc = Liveman::RC->new->load;
$rc->{option}{'with-version'}   # -> 1
$rc->{option}{'without-diff'}   # -> 0

Options missing from the file retain their default values. An unknown option causes a warning.

update ()

Creates livemanrc.md if it does not exist, or adds missing options to the # OPTIONS section, without touching those already described.

Creation from scratch - the file contains all known options:

unlink 'livemanrc.md';
Liveman::RC->new->update;

my $rc_content = read_text 'livemanrc.md';

$rc_content =~ /\* \[ \] with-version/  # -> 1
$rc_content =~ /\* \[ \] without-diff/  # -> 1

Adding the missing option to an existing section:

write_text 'livemanrc.md', << "END";
# OPTIONS

My custom description.

* [X] with-version
END

Liveman::RC->new->load->update;

my $upd = read_text 'livemanrc.md';

$upd =~ /My custom description/ # -> 1
$upd =~ /\* \[X\] with-version/ # -> 1
$upd =~ /\* \[ \] without-diff/ # -> 1

The repeated call to update is idempotent:

my $before = read_text 'livemanrc.md';

Liveman::RC->new->load->update;

my $after = read_text 'livemanrc.md';

$before eq $after  # -> 1

AUTHOR

Yaroslav O. Kosmina mailto:dart@cpan.org

LICENSE

⚖ GPLv3

COPYRIGHT

The Liveman::RC module is copyright © 2026 Yaroslav O. Kosmina. Rusland. All rights reserved.