7 my (@globals, $testcount);
10 @globals = qw(lxdebug auth myconfig form lx_office_conf locale dispatcher instance_conf request);
11 $testcount = scalar(@Support::Files::testitems);
14 use Test::More tests => $testcount;
16 # Capture the TESTOUT from Test::More or Test::Builder for printing errors.
17 # This will handle verbosity for us automatically.
20 local $^W = 0; # Don't complain about non-existent filehandles
21 if (-e \*Test::More::TESTOUT) {
22 $fh = \*Test::More::TESTOUT;
23 } elsif (-e \*Test::Builder::TESTOUT) {
24 $fh = \*Test::Builder::TESTOUT;
30 my @testitems = @Support::Files::testitems;
32 # at last, here we actually run the test...
33 my $evilwordsregexp = join('|', @globals);
35 foreach my $file (@testitems) {
36 $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
37 next if (!$file); # skip null entries
39 if (open (FILE, $file)) { # open the file for reading
43 while (my $file_line = <FILE>) { # and go through the file line by line
44 if ($file_line =~ /([\$%@](?:main)?::(?!$evilwordsregexp)\w+\b)/i) { # found an evil word
53 ok(0,"$file: found UNREGISTERED GLOBAL $found_word --WARNING");
55 ok(1,"$file does only contain registered globals");
58 ok(0,"could not open $file for globals check --WARNING");