hellkat has asked for the wisdom of the Perl Monks concerning the following question:
I would like to print an error message in my program that takes command line arguments if the user gives a particular argument, but the system the script lives on does not contain the modules used to run that section.
My program works at not 'require'ing the module if the argument is not given, but when I do give the option and the modules are not installed on that system, it just doesn't print the error message that I want, it prints the standard perl "Can't locate XXX in @INC"
I have tried the following and all do not work:
require XXX or die "my error message";
require XXX || die "my error message";
die "my error message" unless require XXX;
if (! require XXX) { die "my error message" }
I was streatching on the last one, but I figured it was worth a shot. And I know the first 2 are functionally equivalent.
I've thumbed through my books and nada. Any help would be great.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: error message if module doesn't exist?
by dkubb (Deacon) on Jan 16, 2001 at 07:52 UTC | |
by merlyn (Sage) on Jan 16, 2001 at 08:03 UTC | |
by tye (Sage) on Jan 16, 2001 at 21:56 UTC | |
|
Re: error message if module doesn't exist?
by AgentM (Curate) on Jan 16, 2001 at 04:52 UTC |