#!/usr/bin/perl -Iblib/lib/ -Ilib/
#
# This simple script will invoke our parser on any filename which
# is named on the command-line, and dump the results to the console.
#
# It can be used for a quick sanity-check of the records.
#
# Steve
# --
#

use strict;
use warnings;

use TinyDNS::Reader;


#
# The number of files we processed.
#
my $count = 0;


#
# Process each named file.
#
while ( my $file = shift )
{

    $count += 1;

    if ( !-e $file )
    {
        print STDERR "File not found - $file\n";
        next;
    }


    #
    #  Parse
    #
    my $helper = TinyDNS::Reader->new( file => $file );
    my $records = $helper->parse();

    #
    #  Dump.
    #
    foreach my $record (@$records)
    {
        print $record . "\n";
    }
}

#
#  If we didn't get any files show that.
#
if ( $count < 1 )
{
    print "Usage: $0 file1 file2 .. fileN\n";
}
