#!/usr/bin/perl 

# print a summary of the contests of a data file, collected with
#  Lab::Connection::Trace
# usage:
#   Summary [options] infile
# options:
#       -d --debug             turn on debugging
#       -v --verbose           verbose output
#       -h -? --help           show usage
#
#
use Lab::Generic::CLOptions;    # reclaim --debug switch
use Lab::Data::Analysis;
use Carp;
use Getopt::Long qw(:config bundling auto_version no_ignore_case);
use Data::Dumper;
use strict;

our $DEBUG   = $Lab::Generic::CLOptions::DEBUG;
our $VERSION = '3.541';
our $VERBOSE = 1;

main();

sub main {

    my $help;

    Getopt::Long::GetOptions(
        "verbose|v" => \$VERBOSE,
        "debug|d+"  => \$DEBUG,
        "h|?|help"  => \$help,
    );

    if ( defined($help) ) {
        usage();
        exit(0);
    }

    my $infile = shift(@ARGV);
    if ( !defined($infile) ) {
        croak("missing output file parameter");
    }

    my $a = Lab::Data::Analysis->new($infile);
    croak("error opening input file '$infile'") unless defined $a;

    $a->ReadFileHeader();

    print "File: $infile\n";
    $a->MakeIndex();
    $a->PrintIndex();
    $a->PrintDefaultAnalyzer();

}
