blib/script/test_configuration.pl untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 34 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2  
3 # File ID: $Id$
4 # Last Change: $LastChangedDate$
5 # Revision: $Rev$
6  
7 use lib qw(./lib ../lib);
8 use Nagios::Config;
9 use Nagios::Object::Config;
10 use Benchmark ':hireswallclock';
11 use Getopt::Std;
12  
13 =head1 NAME
14  
15 test_configuration.pl - Load your configuration to verify Nagios::Object is compatible with it.
16 -c: path to your main configuration file
17 -l: "relaxed" mode - allow unrecognized attributes on objects, default is strict
18  
19 =head1 USAGE
20  
21 perl test_configuration.pl -c /etc/opt/nagios/nagios.cfg
22 perl test_configuration.pl -l -c /etc/opt/nagios/nagios.cfg
23  
24 =cut
25  
26 our $opt_c;
27 our $opt_l;
28 getopt('c:l');
29 die "Must specify location of Nagios configuration with -c option."
30 if ( !$opt_c );
31  
32 unless ($opt_l) {
33 Nagios::Object::Config->strict_mode(1);
34 }
35  
36 my $bench_start = Benchmark->new;
37 my $cf = Nagios::Config->new( Filename => $opt_c, force_relative_files => 1 );
38  
39 my $bench_end = Benchmark->new;
40  
41 printf "\nTime to parse: %s\n",
42 timestr( timediff( $bench_end, $bench_start ) );
43