in reply to Re: Re: module location
in thread module location

I think you want to replace:
eval "use $perl_module" or die "Can't find $perl_module: $!\n";
by:
eval "use $perl_module"; die "Can't find $perl_module: $@\n" if $@;

Eval just returns whatever was returned by use, which to my knowledge is undefined (please someone correct me if I'm wrong).

You need to check whether $@ is non-empty after the eval().

Liz

Replies are listed 'Best First'.
Re: Re: Re: Re: module location
by hmerrill (Friar) on Nov 07, 2003 at 16:23 UTC
    Liz, you get the gold star! It works - I've used eval before, but mostly just in DBI transaction code where I had an eval block({}) and then checked $@ after, but I guess I forgot that for *any* eval errors you need to check $@. Thank you very much!

    Hardy