#Make warnings optional? -t is all -t=-1 is less package main; if( $t ){ print "Testing configuration $c... "; if(! -f $c ){ push @F, "$!: $c"; goto FAIL; } { package Flog; *init = sub { $initCall=1; }; } do $c || push @F, $@; unless( $Flog::initCall ){ push @F, "No call to Flog::init()"; } while( my($key, $val) = each %FILES) { if( ref($val) ne 'ARRAY' ){ push @F, "Invalid value for \%FILES key $key, not an array reference"; } unless( $val->[0] ){ push @F, "Invalid value for \%FILES key $key, no file specified"; } unless( $val->[0] =~ />/ ){ push @F, "Invalid value for \%FILES key $key, file not opened for write"; } else{ if( $val->[0] !~ />>/ || $val->[0] =~ /(?:\>\+)|(?:\+\>)/ ){ push @G, qq(\%FILES key $key, will be open "$val->[0]" for clobber); } #More warning if opening for clobber, and used with printFlog (grep) } } unless( defined &flog ){ push @F, "No sub flog()"; } if( $t > 0 ){ open(CONF, $c); while(){ next if /^(?:\s*#)|$/; if( /\W(open)|(close)\W/ ){ push @G, "Possible explicit $1 on line $., this is not recommended"; } } close(CONF); } FAIL: if( @F ){ print "Failed!!\n\n", map("$_\n", @F); } else{ print "Looks good\n"; } if( @G && $t>0 ){ print "\nWarning:\n", map("$_\n", @G); } exit 0; } if( $V ){ chomp(my $VERSION = ); print qq(flog v$VERSION installed... this file to: $PREFIX/bin sample configs, documentation to: $PREFIX/doc supporting routines to: $PREFIX/lib documentation to: $PREFIX/man Apparently... run as: $0 running with: $^X (may not be full path) ); exit 0; } 1;