GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
TOML::Parser(3) User Contributed Perl Documentation TOML::Parser(3)

TOML::Parser - simple toml parser

    use TOML::Parser;

    my $parser = TOML::Parser->new;
    my $data   = $parser->parse($toml);

TOML::Parser is a simple toml parser.

This data structure complies with the tests provided at <https://github.com/toml-lang/toml/tree/v0.4.0/tests>.

The v0.4.0 specification is supported.

my $parser = TOML::Parser->new(\%args)
Creates a new TOML::Parser instance.

    use TOML::Parser;

    # create new parser
    my $parser = TOML::Parser->new();
    

Arguments can be:

  • "inflate_datetime"

    If use it, You can replace inflate "datetime" process. The subroutine of default is "identity". "e.g.) sub { $_[0] }"

        use TOML::Parser;
        use DateTime;
        use DateTime::Format::ISO8601;
    
        # create new parser
        my $parser = TOML::Parser->new(
            inflate_datetime => sub {
                my $dt = shift;
                return DateTime::Format::ISO8601->parse_datetime($dt);
            },
        );
        
  • "inflate_boolean"

    If use it, You can replace inflate boolean process. The return value of default subroutine is "Types::Serialiser::true" or "Types::Serialiser::false".

        use TOML::Parser;
    
        # create new parser
        my $parser = TOML::Parser->new(
            inflate_boolean => sub {
                my $boolean = shift;
                return $boolean eq 'true' ? 1 : 0;
            },
        );
        
  • "strict_mode"

    TOML::Parser is using a more flexible rule for compatibility with old TOML of default. If make this option true value, You can parse a toml with strict rule.

        use TOML::Parser;
    
        # create new parser
        my $parser = TOML::Parser->new(
            strict_mode => 1
        );
        
my $data = $parser->parse_file($path)
my $data = $parser->parse_fh($fh)
my $data = $parser->parse($src)
Transforms a string containing toml to a perl data structure or vice versa.

TOML

Copyright (C) karupanerura.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

karupanerura <karupa@cpan.org>

Olivier Mengue <dolmen@cpan.org> yowcow <yowcow@cpan.org> Syohei YOSHIDA <syohex@gmail.com>
2017-11-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.