my
@modules
=
qw(registry registry_bb perlrun)
;
plan
tests
=> 6;
my
$cfg
= Apache::Test::config();
my
$file
=
'closure.pl'
;
my
$path
= catfile
$cfg
->{vars}->{serverroot},
'cgi-bin'
,
$file
;
my
$orig_mtime
= (
stat
(
$path
))[8];
{
my
$url
=
"/same_interp/perlrun/$file"
;
my
$same_interp
= Apache::TestRequest::same_interp_tie(
$url
);
my
$first
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
my
$second
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
) != 2),
$first
&&
$second
&& (
$second
-
$first
),
0,
"never the closure problem"
,
);
touch_mtime(
$path
);
my
$third
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
,
$third
) != 3),
$third
,
1,
"never the closure problem"
,
);
reset_mtime(
$path
);
}
{
my
$url
=
"/same_interp/registry/$file"
;
my
$same_interp
= Apache::TestRequest::same_interp_tie(
$url
);
my
$first
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
my
$second
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
) != 2),
$first
&&
$second
&& (
$second
-
$first
),
1,
"the closure problem should exist"
,
);
touch_mtime(
$path
);
my
$third
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
,
$third
) != 3),
$third
,
1,
"no closure on the first request"
,
);
reset_mtime(
$path
);
}
{
my
$url
=
"/same_interp/registry_bb/$file"
;
my
$same_interp
= Apache::TestRequest::same_interp_tie(
$url
);
my
$first
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
my
$second
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
) != 2),
$first
&&
$second
&& (
$second
-
$first
),
1,
"the closure problem should exist"
,
);
touch_mtime(
$path
);
my
$third
= same_interp_req_body(
$same_interp
, \
&GET
,
$url
);
same_interp_skip_not_found(
(
scalar
(
grep
defined
,
$first
,
$second
,
$third
) != 3),
$first
&&
$second
&&
$third
-
$second
,
1,
"no reload on modification, the closure problem persists"
,
);
reset_mtime(
$path
);
}
sub
touch_mtime {
my
$file
=
shift
;
my
$time
=
time
+ 5;
utime
$time
,
$time
,
$file
;
}
sub
reset_mtime {
my
$file
=
shift
;
utime
$orig_mtime
,
$orig_mtime
,
$file
;
}