-
-
20 Mar 2016 01:41:59 UTC
- Distribution: TOML
- Module version: 0.97
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (5)
- Testers (6208 / 0 / 16)
- Kwalitee
Bus factor: 1- 89.11% Coverage
- License: gpl_2
- Perl: v5.8.5
- Activity
24 month- Tools
- Download (12.2KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 6 contributors-
Darren Chamberlain
-
Sergey Romanov
-
tokuhirom
-
Olivier Mengué
-
karupanerura
-
Vickenty Fesunov
NAME
TOML - 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.TOML
exports two subroutines,from_toml
andto_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.If called in list context,
from_toml
produces a (hash
,error_string
) tuple, whereerror_string
isundef
on non-errors. If there is an error, thenhash
will be undefined anderror_string
will contains (scant) details about said error. - to_toml
-
to_toml
transforms a perl data structure into toml-formatted string.
SEE ALSO
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 <darren@cpan.org>
CONTRIBUTORS
Module Install Instructions
To install TOML, copy and paste the appropriate command in to your terminal.
cpanm TOML
perl -MCPAN -e shell install TOML
For more information on module installation, please visit the detailed CPAN module installation guide.