#!/icg/bin/perl
# ABSTRACT: run dns-o!

# This goofy linebreak prevents PAUSE from indexing this package.  The
        # package statement is here to help Pod::Weaver. -- rjbs, 2017-08-02
package
  dnsoterica;

use strict;
use warnings;
use lib 'lib'; # XXX: temporary for now -- rjbs, 2009-01-30

use DNS::Oterica::App;
use File::Find::Rule;
use Getopt::Long::Descriptive;
use YAML::XS ();

my ($opts, $usage) = describe_options(
  "usage: %c %o <root>",
  [ 'ns-family=s', 'DNS::Oterica node family for NS records',
    { required => 1, } ],
  [ 'hostmaster=s', 'hostmaster email',
    { required => 1, } ],
);

my $root = shift @ARGV;
$usage->die if @ARGV;

my $app = DNS::Oterica::App->new(
  root          => $root,
  hub_args      => $opts,
);

$app->populate_networks;
$app->populate_domains;
$app->populate_hosts;

my @nodes = sort { $a->fqdn cmp $b->fqdn } $app->hub->nodes;

print sort map {; $_->as_data_lines } $app->hub->networks;
print "\n";
print $_->as_data_lines for @nodes;
print "\n";
print $_->as_data_lines, "\n" for $app->hub->node_families;

__END__

=pod

=encoding UTF-8

=head1 NAME

dnsoterica - run dns-o!

=head1 VERSION

version 0.312

=head1 PERL VERSION

This library should run on perls released even a long time ago.  It should work
on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the
minimum required version will not be increased.  The version may be increased
for any reason, and there is no promise that patches will be accepted to lower
the minimum required perl.

=head1 AUTHOR

Ricardo SIGNES <rjbs@semiotic.systems>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Ricardo SIGNES.

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
