6
use File::Spec::Functions qw(catfile catdir);
8
use lib catdir Apache::Test::vars('serverroot'), 'cgi-bin';
9
my $require = catfile Apache::Test::vars('serverroot'),
10
qw(cgi-bin perlrun_nondecl.pl);
12
print "Content-type: text/plain\n\n";
14
### declared package module ###
16
# require a module w/ package declaration (it doesn't get reloaded
17
# because it declares the package). But we still have a problem with
18
# subs declaring prototypes. When perlrun_decl->import is called, the
19
# original function's prototype doesn't match the aliases prototype.
21
BEGIN { t_server_log_warn_is_expected()
22
if perlrun_decl->can("decl_proto");
26
die "perlrun_decl BEGIN block was run more than once"
27
if $MyData::blocks{perlrun_decl} > 1;
33
### non-declared package module ###
35
# how many times were were called from the same interpreter
36
$MyData::blocks{cycle}{perlrun_nondecl}++;
37
$MyData::blocks{BEGIN}{perlrun_nondecl} ||= 0;
38
$MyData::blocks{END} {perlrun_nondecl} ||= 0;
40
# require a lib w/o package declaration. Functions in that lib get
41
# automatically aliased to the functions in the current package.
44
die "perlrun_nondecl's BEGIN block wasn't run"
45
if $MyData::blocks{BEGIN}{perlrun_nondecl} !=
46
$MyData::blocks{cycle}{perlrun_nondecl};
48
# the END block for this cycle didn't run yet, but we can test the
49
# previous cycle's one
50
die "perlrun_nondecl's END block wasn't run"
51
if $MyData::blocks{END}{perlrun_nondecl} + 1 !=
52
$MyData::blocks{cycle}{perlrun_nondecl};
54
# they all get redefined warning inside perlrun_nondecl.pl, since that
55
# lib loads it into main::, vs. PerlRun undefs the current __PACKAGE__
57
print nondecl_no_proto();
58
print nondecl_proto(2);
59
print nondecl_proto_empty("whatever");
60
print nondecl_const();