use strict;
use warnings;
package Config::Any::TOML;

our $VERSION = '0.002'; # VERSION

# ABSTRACT: Load TOML config files

use base 'Config::Any::Base';

sub extensions {
    return qw( toml );

sub load {
    my $class = shift;
    my $file  = shift;

    open( my $fh, $file ) or die $!;
    my $content = do { local $/; <$fh> };
    close $fh;

    require TOML;

    my ( $data, $err ) = TOML::from_toml($content);
        unless ($data) {
        die "Error parsing toml: $err";

    return $data;

sub requires_any_of { 'TOML' }




=encoding utf-8

=head1 NAME

Config::Any::TOML - Load TOML config files

=head1 VERSION

version 0.002


Loads TOML files. See L<>

=head1 METHODS

=head2 extensions()

return an array of valid extensions (C<toml>).

=head2 load( $file )

Attempts to load C<$file> as an TOML file.

=head2 requires_any_of()

Specifies that this module requires one of the following TOML modules in order
to work.


=item *



=head1 SEE ALSO


=item * L<Config::Any>

=item * L<TOML>


=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan

=head1 SUPPORT

=head2 Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker
at L<>.
You will be notified automatically of any progress on your issue.

=head2 Source Code

This is open source software.  The code repository is available for
public review and contribution under the terms of the license.


  git clone git://

=head1 AUTHOR

Michael Jemmeson <>


This software is copyright (c) 2013 by Michael Jemmeson.

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