http://qs1969.pair.com?node_id=637337


in reply to Re: require mystery
in thread require mystery

I followed your hunch to look deeper, as it seemed line 2 should have failed for me, even if there had been a prior use.

my $pathtool = "File::Path";
eval {require $pathtool}; # FAILS
if ($@) {print $@;} # "No File::Path in @INC"

eval "require $pathtool"; # OK
eval {require File::Path}; # OK
eval {$pathtool->import("mkpath")}; # OK

Clearly $pathtool wont work in the FIRST block eval where the bareword will, but will work in the SECOND block eval. A subtle trap for young players! But I am relieved. Thanks for your help.

Pstack