G'day bartender1382,
I had a look in Spreadsheet::Read but can't find the "If a file cannot be found ..." message you reported. Perhaps it's not an error message but private feedback from the module's author. Regardless, I have no context for the die() or what it's reporting.
Having said that, I suspect what you want is eval. Compare the following two short pieces of code and their output.
Here's the type of scenario I think you're dealing with:
#!/usr/bin/env perl use strict; use warnings; package Module::That::Dies; sub die_here { die "RIP Module::That::Dies" } package main; Module::That::Dies::die_here(); print "main continues ...\n";
Output:
RIP Module::That::Dies at ./pm_11143055_trap_mod_errors.pl line 8.
Here's a modification of that code to do what I think you want:
#!/usr/bin/env perl use strict; use warnings; package Module::That::Dies; sub die_here { die "RIP Module::That::Dies" } package main; eval { Module::That::Dies::die_here(); 1; } or do { warn "Error from Module::That::Dies:\n$@\n"; }; print "main continues ...\n";
Output:
Error from Module::That::Dies: RIP Module::That::Dies at ./pm_11143055_trap_mod_errors.pl line 8. main continues ...
If that's not what you want, please provide more context for the problem to help us to help you.
— Ken
In reply to Re: Can I catch a die from someone else's module?
by kcott
in thread Can I catch a die from someone else's module?
by bartender1382
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |