Cross Reference: 02maxopen.t
xref
: /
osnet-11
/
usr
/
src
/
cmd
/
perl
/
5.8.4
/
distrib
/
lib
/
FileCache
/
t
/
02maxopen.t
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
#!./perl
1
N/A
use
FileCache
maxopen
=>
2
;
1
N/A
use
Test
;
1
N/A
use
vars
qw
(@
files
)
;
1
N/A
BEGIN
{
1
N/A
@
files
=
qw
(
foo
bar
baz
quux
)
;
1
N/A
chdir
't'
if
-d
't'
;
1
N/A
1
N/A
#For tests within the perl distribution
1
N/A
@
INC
=
'../lib'
if
-d
'../lib'
;
1
N/A
END
;
1
N/A
plan
tests
=>
5
;
1
N/A
}
1
N/A
END
{
1
N/A
1
while
unlink
@
files
;
1
N/A
}
1
N/A
1
N/A
{
# Test 2: that we actually adhere to maxopen
1
N/A
for
my
$path
( @
files
)
{
1
N/A
cacheout
$path
;
1
N/A
print
$path
"
$path
1\n"
;
1
N/A
}
1
N/A
1
N/A
my
@
cat
;
1
N/A
for
my
$path
( @
files
)
{
1
N/A
ok
(
fileno
(
$path
)
||
$path
=~ /^
(?:
foo
|
bar
)
$/)
;
1
N/A
next
unless
fileno
(
$path
)
;
1
N/A
print
$path
"
$path
2\n"
;
1
N/A
close
(
$path
)
;
1
N/A
open
(
$path
,
$path
)
;
1
N/A
<
$path
>;
1
N/A
push
@
cat
, <
$path
>;
1
N/A
close
(
$path
)
;
1
N/A
}
1
N/A
ok
(
grep
(/^
(?:
baz
|
quux
)
2
$/, @
cat
)
==
2
)
;
1
N/A
}