]> Raphaƫl G. Git Repositories - carabistouilles/blob - analyse.pl
Add tree freeing to avoid valgrind lightning storm
[carabistouilles] / analyse.pl
1 #! /usr/bin/perl
2
3 # Best practice
4 use strict;
5 use warnings;
6
7 # Load POSIX
8 use POSIX qw(EXIT_SUCCESS EXIT_FAILURE);
9
10 # Load siren module
11 use lib::siren;
12
13 # Show usage
14 if (scalar(@ARGV) < 1) {
15 print "Usage: $0 sirens_fxt.txt\n";
16 exit EXIT_FAILURE;
17 }
18
19 # Test file
20 if (! -f $ARGV[0]) {
21 print "$ARGV[0] needs to be a valid file\n";
22 exit EXIT_FAILURE;
23 }
24
25 # Test file readability
26 if (! -r $ARGV[0]) {
27 print "$ARGV[0] needs to be readable\n";
28 exit EXIT_FAILURE;
29 }
30
31 # New siren object
32 my $siren = lib::siren->new();
33
34 # Parse data
35 $siren->parse($ARGV[0]);
36
37 # Show result
38 print $siren->show();
39
40 # Success
41 exit EXIT_SUCCESS;