in reply to checking module version

require() doesn't check the version of a module. use() does:
BEGIN { my $mod = 'File::Spec'; unless (eval "use $mod $version ()") { print "couldn't load $mod: $@"; } }

Replies are listed 'Best First'.
Re^2: checking module version
by ikegami (Patriarch) on Jun 13, 2007 at 13:54 UTC

    unless (eval "use $mod $version ()") {
    should be
    unless (eval "use $mod $version (); 1") {
    since use doesn't have a (documented) return value.