6 # NB. For PERL_CORE to be set, taint mode must not be enabled
7 my $macrosall = $ENV{PERL_CORE} ? File::Spec->catfile(qw(.. ext Sys Syslog macros.all))
9 open(MACROS, $macrosall) or plan skip_all => "can't read '$macrosall': $!";
10 my @names = map {chomp;$_} <MACROS>;
12 plan tests => @names * 2 + 2;
14 my $callpack = my $testpack = 'Sys::Syslog';
17 eval "${callpack}::This()";
18 like( $@, "/^This is not a valid $testpack macro/", "trying a non-existing macro");
20 eval "${callpack}::NOSUCHNAME()";
21 like( $@, "/^NOSUCHNAME is not a valid $testpack macro/", "trying a non-existing macro");
25 for my $name (@names) {
27 $name =~ /^(\w+)$/ or skip "invalid name '$name'", 2;
29 my $v = eval "${callpack}::$name()";
31 if(defined $v and $v =~ /^\d+$/) {
32 is( $@, '', "calling the constant $name as a function" );
33 like( $v, '/^\d+$/', "checking that $name is a number ($v)" );
36 like( $@, "/^Your vendor has not defined $testpack macro $name/",
37 "calling the constant via its name" );
38 skip "irrelevant test in this case", 1