On 5/24/25 2:40 AM, Peter Pentchev wrote:
On Fri, May 23, 2025 at 05:44:01PM -0700, ToddAndMargo via perl6-users wrote:
Hi All,
https://github.com/tony-o/raku-toml
In the usage parsing example:
Parsing TOML
use TOML;
my $config = from-toml("config.toml".IO.slurp);
# use $config like any ol' hash
This makes perfect sense to me.
...then you realize that the from-toml() function accepts a string,
not a file, right? The string that was read from the "config.toml"
file by the .IO.slurp() method.
But in the Generating TOML example:
use TOML;
my $config = {
bands => ['green day',
'motorhead',
't swift',],
favorite => 'little big',
};
my $toml-config = to-toml($config);
I am confused. Seems to me he left something out.
If this creates a TOML file for you, what/where
is the file name and path? What am I missing?
...and to-toml() also produces a string. If you want to write it to
a file, you need to do that yourself later.
Hope that helps!
G'luck,
Peter
Hi Peter,
Now I understand. Spurt the string. Thank you!
-T