Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karupanerura/toml
Perl parser for Tom's Obvious, Minimal Language
https://github.com/karupanerura/toml
perl toml
Last synced: 3 months ago
JSON representation
Perl parser for Tom's Obvious, Minimal Language
- Host: GitHub
- URL: https://github.com/karupanerura/toml
- Owner: karupanerura
- License: gpl-2.0
- Fork: true (dlc/toml)
- Created: 2013-08-27T11:25:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-20T01:41:52.000Z (almost 9 years ago)
- Last Synced: 2024-09-25T23:33:07.016Z (3 months ago)
- Topics: perl, toml
- Language: Perl
- Homepage:
- Size: 43 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/karupanerura/toml.svg?branch=master)](https://travis-ci.org/karupanerura/toml)
# NAMETOML - Parser for Tom's Obvious, Minimal Language.
# SYNOPSIS
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);# DESCRIPTION
`TOML` implements a parser for Tom's Obvious, Minimal Language, as
defined at [https://github.com/mojombo/toml](https://github.com/mojombo/toml). `TOML` exports two
subroutines, `from_toml` and `to_toml`,# FAQ
- How change how to de-serialize?
You can change `$TOML::PARSER` for change how to de-serialize.
example:
use TOML;
use TOML::Parser;local $TOML::PARSER = TOML::Parser->new(
inflate_boolean => sub { $_[0] eq 'true' ? \1 : \0 },
);my $data = TOML::from_toml('foo = true');
# FUNCTIONS
- from\_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](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.- to\_toml
`to_toml` transforms a perl data structure into toml-formatted
string.# SEE ALSO
[TOML::Parser](https://metacpan.org/pod/TOML::Parser)
# LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; version 2.This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02111-1301 USA# AUTHOR
Darren Chamberlain <[email protected]>
# CONTRIBUTORS
- Tokuhiro Matsuno <[email protected]>
- Matthias Bethke <[email protected]>
- Sergey Romanov <[email protected]>
- karupanerura <[email protected]>