in reply to Type::Library messages lost when used with named parameters in Type::Params
A workaround for the actual issue, but can you wrap the call in an eval() block, check the error eval catches (if it does catch anything), and print your custom message?
#!/usr/bin/perl use warnings; use strict; sub divide { return 1 / 0; } my $x; eval { $x = divide(); }; if ($@ =~ /Illegal division/){ print "Don't divide by zero, dummy!\n"; # die with called function's error if required die $@; } print "$x\n";
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Type::Library messages lost when used with named parameters in Type::Params
by 1nickt (Canon) on Jun 30, 2015 at 00:35 UTC |