Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
author/ | H | 03-May-2022 | - | 130 | 89 | |
lib/TOML/ | H | 03-May-2022 | - | 801 | 583 | |
t/ | H | 03-May-2022 | - | 1,246 | 967 | |
xt/ | H | 03-May-2022 | - | 49,112 | 49,103 | |
Build.PL | H A D | 08-Nov-2017 | 301 | 13 | 4 | |
Changes | H A D | 08-Nov-2017 | 1.4 KiB | 64 | 36 | |
LICENSE | H A D | 08-Nov-2017 | 18 KiB | 379 | 292 | |
MANIFEST | H A D | 08-Nov-2017 | 1.2 KiB | 54 | 54 | |
META.json | H A D | 08-Nov-2017 | 2.5 KiB | 101 | 100 | |
META.yml | H A D | 08-Nov-2017 | 1.4 KiB | 58 | 57 | |
README.md | H A D | 08-Nov-2017 | 2.8 KiB | 115 | 77 | |
cpanfile | H A D | 08-Nov-2017 | 474 | 24 | 20 | |
minil.toml | H A D | 08-Nov-2017 | 148 | 6 | 5 | |
wercker.yml | H A D | 08-Nov-2017 | 20 | 1 | 1 |
README.md
1[![Build Status](https://travis-ci.org/karupanerura/TOML-Parser.svg?branch=master)](https://travis-ci.org/karupanerura/TOML-Parser) [![Coverage Status](http://codecov.io/github/karupanerura/TOML-Parser/coverage.svg?branch=master)](https://codecov.io/github/karupanerura/TOML-Parser?branch=master) 2# NAME 3 4TOML::Parser - simple toml parser 5 6# SYNOPSIS 7 8```perl 9use TOML::Parser; 10 11my $parser = TOML::Parser->new; 12my $data = $parser->parse($toml); 13``` 14 15# DESCRIPTION 16 17TOML::Parser is a simple toml parser. 18 19This data structure complies with the tests 20provided at [https://github.com/toml-lang/toml/tree/v0.4.0/tests](https://github.com/toml-lang/toml/tree/v0.4.0/tests). 21 22The v0.4.0 specification is supported. 23 24# METHODS 25 26- my $parser = TOML::Parser->new(\\%args) 27 28 Creates a new TOML::Parser instance. 29 30 ```perl 31 use TOML::Parser; 32 33 # create new parser 34 my $parser = TOML::Parser->new(); 35 ``` 36 37 Arguments can be: 38 39 - `inflate_datetime` 40 41 If use it, You can replace inflate `datetime` process. 42 The subroutine of default is `identity`. `e.g.) sub { $_[0] }` 43 44 ```perl 45 use TOML::Parser; 46 use DateTime; 47 use DateTime::Format::ISO8601; 48 49 # create new parser 50 my $parser = TOML::Parser->new( 51 inflate_datetime => sub { 52 my $dt = shift; 53 return DateTime::Format::ISO8601->parse_datetime($dt); 54 }, 55 ); 56 ``` 57 58 - `inflate_boolean` 59 60 If use it, You can replace inflate boolean process. 61 The return value of default subroutine is `Types::Serialiser::true` or `Types::Serialiser::false`. 62 63 ```perl 64 use TOML::Parser; 65 66 # create new parser 67 my $parser = TOML::Parser->new( 68 inflate_boolean => sub { 69 my $boolean = shift; 70 return $boolean eq 'true' ? 1 : 0; 71 }, 72 ); 73 ``` 74 75 - `strict_mode` 76 77 TOML::Parser is using a more flexible rule for compatibility with old TOML of default. 78 If make this option true value, You can parse a toml with strict rule. 79 80 ```perl 81 use TOML::Parser; 82 83 # create new parser 84 my $parser = TOML::Parser->new( 85 strict_mode => 1 86 ); 87 ``` 88 89- my $data = $parser->parse\_file($path) 90- my $data = $parser->parse\_fh($fh) 91- my $data = $parser->parse($src) 92 93 Transforms a string containing toml to a perl data structure or vice versa. 94 95# SEE ALSO 96 97[TOML](https://metacpan.org/pod/TOML) 98 99# LICENSE 100 101Copyright (C) karupanerura. 102 103This library is free software; you can redistribute it and/or modify 104it under the same terms as Perl itself. 105 106# AUTHOR 107 108karupanerura <karupa@cpan.org> 109 110# CONTRIBUTOR 111 112Olivier Mengu� <dolmen@cpan.org> 113yowcow <yowcow@cpan.org> 114Syohei YOSHIDA <syohex@gmail.com> 115