TOML - Parser for Tom's Obvious, Minimal Language.
use TOML qw(from_toml to_toml); # Parsing toml my $toml = slurp("~/.foo.toml"); my $data = from_toml($toml); # With error checking my ($data, $err) = from_toml($toml); unless ($data) { die "Error parsing toml: $err"; } # Creating toml my $toml = to_toml($data);
TOML implements a parser for Tom's Obvious, Minimal Language, as defined at https://github.com/mojombo/toml. TOML exports two subroutines, from_toml and to_toml,
TOML
from_toml
to_toml
from_toml transforms a string containing toml to a perl data structure or vice versa. This data structure complies with the tests provided at https://github.com/mojombo/toml/tree/master/tests.
If called in list context, from_toml produces a (hash, error_string) tuple, where error_string is undef on non-errors. If there is an error, then hash will be undefined and error_string will contains (scant) details about said error.
hash
error_string
undef
to_toml transforms a perl data structure into toml-formatted string.
Darren Chamberlain <darren@cpan.org>
* Tokuhiro Matsuno <tokuhirom@cpan.org> * Matthias Bethke <matthias@towiski.de>
To install TOML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TOML
CPAN shell
perl -MCPAN -e shell install TOML
For more information on module installation, please visit the detailed CPAN module installation guide.