NAME
Skilletor::TOML - The reference's TOML writer – what a Codex agent role needs
VERSION
version 0.008000
SYNOPSIS
use Skilletor::JSON qw( js_ordered );
use Skilletor::TOML qw( stringify_toml toml_float );
my $text = stringify_toml(
js_ordered(
name => 'reviewer',
temperature => toml_float(0.5),
developer_instructions => "You review.\n",
sandbox => js_ordered( network_access => JSON::MaybeXS::true() ),
),
{ multiline => ['developer_instructions'] },
);
DESCRIPTION
The reference's toml.ts (spec §14.7): a minimal TOML writer for strings, integers, floats, booleans, string arrays and one level of tables – exactly what a Codex agent role needs. Its text is the reference's, byte for byte.
Strings are the whole game. A single-line value is a basic string with every \, " and control character escaped. A key listed in multiline is written as a multi-line literal string when its content allows (readable, no escapes), else as a multi-line basic string that escapes every \ and " – so no content can close the string early.
Values are told apart as the reference's typeof tells them (see "js_type" in Skilletor::JSON): a string is a string even when it holds digits, a number is an integer or an error, a float is a "toml_float". Booleans are JSON::MaybeXS booleans or Perl's own. A hash is a table; an ordered hash ("js_ordered" in Skilletor::JSON) keeps its key order, a plain hash is written with its keys sorted. A value TOML cannot hold is a Skilletor::Error::TOML with the reference's message.
stringify_toml
my $text = stringify_toml( $table, { multiline => [ @keys ] } );
The table as TOML text (characters, not bytes): top-level keys first, then one [table] section per table value, each line ending in a newline.
toml_key
toml_key('a b'); # '"a b"'
A key: bare when it is made of A-Za-z0-9_-, else a basic string.
toml_float
toml_float(1); # written as 1.0
Marks a number as a TOML float (the reference's TomlFloat); ->value is the number.
is_toml_float
True for what "toml_float" returns.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/skilletor/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)