6 my $macrosall = $ENV{PERL_CORE} ? File::Spec->catfile(qw(.. ext Sys Syslog macros.all))
8 open(MACROS, $macrosall) or plan skip_all => "can't read '$macrosall': $!";
9 my @names = map {chomp;$_} <MACROS>;
11 plan tests => @names * 2 + 2;
13 my $callpack = my $testpack = 'Sys::Syslog';
16 eval "${callpack}::This()";
17 like( $@, "/^This is not a valid $testpack macro/", "trying a non-existing macro");
19 eval "${callpack}::NOSUCHNAME()";
20 like( $@, "/^NOSUCHNAME is not a valid $testpack macro/", "trying a non-existing macro");
24 for my $name (@names) {
26 $name =~ /^(\w+)$/ or skip "invalid name '$name'", 2;
28 my $v = eval "${callpack}::$name()";
30 if(defined $v and $v =~ /^\d+$/) {
31 is( $@, '', "calling the constant $name as a function" );
32 like( $v, '/^\d+$/', "checking that $name is a number ($v)" );
35 like( $@, "/^Your vendor has not defined $testpack macro $name/",
36 "calling the constant via its name" );
37 skip "irrelevant test in this case", 1