in reply to Re: Re: Extracting a hash reference from a string
in thread Extracting a hash reference from a string
I guess this means you will have to use a different error mechanism if your required modules can fail in a variety of ways. You could adopt some convention of package variables, like this:
and in your MyModule.pm file:eval { require MyModule } if (defined $MyModule::Error) { print "Couldn't load MyModule: ", $MyModule::Error->{message}, + "\n"; # ... }
package MyModule; our $Error; # ... if ($some_error) { $Error = {err = 42, message => 'Sorry, my fault!'}; die; # or maybe just 'return 0;' }
|
|---|