#!perl

our $DATE = '2014-08-27'; # DATE
our $VERSION = '0.02'; # VERSION

use 5.010;
use strict;
use warnings;

use Perinci::CmdLine::Any -prefer_lite=>1;

our %SPEC;
$SPEC{list_iod_sections} = {
    v => 1.1,
    summary => 'List all sections of an IOD configuration file',
    args => {
        iod => {
            summary => 'IOD file',
            schema  => ['str*'],
            req     => 1,
            pos     => 0,
            cmdline_src => 'stdin_or_files',
        },
    },
};
sub list_iod_sections {
    my %args = @_;

    state $reader = do {
        require Config::IOD::Reader;
        Config::IOD::Reader->new;
    };

    my $hoh = $reader->read_string($args{iod});
    [200, "OK", [sort keys %$hoh]];
}

Perinci::CmdLine::Any->new(
    url => '/main/list_iod_sections',
)->run;

# ABSTRACT: List all sections of an IOD configuration file
# PODNAME: list-iod-sections

__END__

=pod

=encoding UTF-8

=head1 NAME

list-iod-sections - List all sections of an IOD configuration file

=head1 VERSION

This document describes version 0.02 of list-iod-sections (from Perl distribution App-IODUtils), released on 2014-08-27.

=head1 SYNOPSIS

Basic usage:

 % list-iod-sections /path/to/file.iod

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-IODUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-IODUtils>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-IODUtils>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by perlancar@cpan.org.

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

=cut
