• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

author/H03-May-2022-13089

lib/TOML/H03-May-2022-801583

t/H03-May-2022-1,246967

xt/H03-May-2022-49,11249,103

Build.PLH A D08-Nov-2017301 134

ChangesH A D08-Nov-20171.4 KiB6436

LICENSEH A D08-Nov-201718 KiB379292

MANIFESTH A D08-Nov-20171.2 KiB5454

META.jsonH A D08-Nov-20172.5 KiB101100

META.ymlH A D08-Nov-20171.4 KiB5857

README.mdH A D08-Nov-20172.8 KiB11577

cpanfileH A D08-Nov-2017474 2420

minil.tomlH A D08-Nov-2017148 65

wercker.ymlH A D08-Nov-201720 11

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