#! /usr/bin/perl

# Best practice
use strict;
use warnings;

# Load POSIX
use POSIX qw(EXIT_SUCCESS EXIT_FAILURE);

# Load siren module
use lib::siren;

# Show usage
if (scalar(@ARGV) < 1) {
	print "Usage: $0 sirens_fxt.txt\n";
	exit EXIT_FAILURE;
}

# Test file
if (! -f $ARGV[0]) {
	print "$ARGV[0] needs to be a valid file\n";
	exit EXIT_FAILURE;
}

# Test file readability
if (! -r $ARGV[0]) {
	print "$ARGV[0] needs to be readable\n";
	exit EXIT_FAILURE;
}

# New siren object
my $siren = lib::siren->new();

# Parse data
$siren->parse($ARGV[0]);

# Show result
print $siren->show();

# Success
exit EXIT_SUCCESS;
