use
Module::Find
qw(ignoresymlinks followsymlinks findsubmod findallmod)
;
my
$dirName
=
"ModuleFindTest"
;
my
$linkName
=
"./t/test/ModuleFindTestSymLink"
;
SKIP: {
my
$r
=
eval
{
symlink
(
$dirName
,
$linkName
) };
skip
"Symlinks not supported on this system"
, 14
if
$@;
skip
"Unable to create symlink"
, 14
if
$r
== 0;
ok(-l
$linkName
);
my
@l
;
@l
= findsubmod ModuleFindTestSymLink;
ok(
$#l
== 0);
ok(
$l
[0] eq
'ModuleFindTestSymLink::SubMod'
);
@l
= findallmod ModuleFindTestSymLink;
ok(
$#l
== 1);
ok(
$l
[0] eq
'ModuleFindTestSymLink::SubMod'
);
ok(
$l
[1] eq
'ModuleFindTestSymLink::SubMod::SubSubMod'
);
ignoresymlinks();
@l
= findsubmod ModuleFindTestSymLink;
ok(
$#l
== -1);
@l
= findallmod ModuleFindTestSymLink;
ok(
$#l
== -1);
followsymlinks();
@l
= findsubmod ModuleFindTestSymLink;
ok(
$#l
== 0);
ok(
$l
[0] eq
'ModuleFindTestSymLink::SubMod'
);
@l
= findallmod ModuleFindTestSymLink;
ok(
$#l
== 1);
ok(
$l
[0] eq
'ModuleFindTestSymLink::SubMod'
);
ok(
$l
[1] eq
'ModuleFindTestSymLink::SubMod::SubSubMod'
);
unlink
$linkName
;
ok(!-e
$linkName
);
}