|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
stronger than eval?by andyford (Curate) |
| on Sep 21, 2006 at 14:40 UTC ( [id://574221]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.andyford has asked for the wisdom of the Perl Monks concerning the following question:
I want to get some info from an error that I get when I try to load a module, so I tried this:
But, it didn't stop the error from killing the program. Update Added readmore tags.
It's this kind of error:
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1 /usr/lib/dld.sl: Exec format error Can't load '/usr/local/perl-5.8.7/lib/5.8.7/PA-RISC2.0/auto/DB_File/DB_File.sl' for module DB_File: Exec format error at /usr/local/perl-5.8.7/lib/5.8.7/PA-RISC2.0/XSLoader.pm line 68. at /usr/local/perl-5.8.7/lib/5.8.7/PA-RISC2.0/DB_File.pm line 251 Compilation failed in require at /usr/local/perl-5.8.7/lib/site_perl/5.8.7/Cache/File/Heap.pm line 29. BEGIN failed--compilation aborted at /usr/local/perl-5.8.7/lib/site_perl/5.8.7/Cache/File/Heap.pm line 29. Compilation failed in require at /usr/local/perl-5.8.7/lib/site_perl/5.8.7/Cache/File.pm line 26. BEGIN failed--compilation aborted at /usr/local/perl-5.8.7/lib/site_perl/5.8.7/Cache/File.pm line 26. Compilation failed in require at ./tryCache line 6. BEGIN failed--compilation aborted at ./tryCache line 6. Now, my question is not how to fix the error, but is there something like eval, some trick, some procedure that will let me capture the error from the use statement and go on to take remedial action based on the error? Do I have to launch a separate process and capture the STDERR?
Now here's the background:
Now I'm OK with this, but I'd like to make it resilient to changes in perl or module location/version, so I'm thinking, capture the error output, get the location of the shared library and then put the variable in my BEGIN block.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||