1
# we use this file to test how the files w/o package declaration,
2
# required from perlrun, work
8
# this BEGIN block is called on every request, since this file gets
9
# removed from %INC after it was loaded
11
# use an external package which will persist across requests
12
$MyData::blocks{BEGIN}{perlrun_nondecl}++;
15
use subs qw(warn_exp);
17
# all subs in this file get 'redefined' warning because they are
18
# reloaded in the main:: package, which is not under PerlRun's
22
t_server_log_warn_is_expected()
23
if defined *{"nondecl_no_proto"}{CODE};
25
# normal sub, no prototype
26
sub nondecl_no_proto { 1 }
29
t_server_log_warn_is_expected()
30
if defined *{"nondecl_proto"}{CODE};
32
# sub with a scalar proto
33
sub nondecl_proto ($) { $num = shift }
36
t_server_log_warn_is_expected()
37
if defined *{"nondecl_proto_empty"}{CODE};
39
# sub with an empty proto, but not a constant
40
sub nondecl_proto_empty () { $num + 1 }
42
# besides the the constant sub will generate two warnings for nondecl_const:
44
# - another for perlrun's virtual package
46
t_server_log_warn_is_expected(2);
49
sub nondecl_const () { 4 }
52
$MyData::blocks{END}{perlrun_nondecl}++;