Perl Module Error
Contents |
Dependencies Annotate this POD CPAN RT Open 0 View/Report Bugs Module Version: 0.07 Source NAME SYNOPSIS DESCRIPTION FUNCTIONS EXCEPTION CLASSES CAVEATS BUGS SEE ALSO AUTHOR COPYRIGHT & LICENSE NAME Error::TryCatch - OO-ish Exception perl error variable Handling through source filtering SYNOPSIS use Error::TryCatch; try { dangerous_code(); even_more_dangerous_code(); throw new perl die Error::Generic -text => "well, no one can live in danger forever"; } catch Error::Unhandled with { # normal die()s
Perl Catch Error
are translated into Error::Unhandled exceptions print "caught an unhandled perl exception: $@\n"; } catch Error::NewExceptionClass with { # code that handles Error::NewExceptionClass } catch Error::YetAnotherExceptions { # note that 'with' is optional
Perl Error Handling
(this differs from Error.pm) } otherwise { # catch any other exception which might not have been caught my $exception_class = ref($@}; print "someone has thrown a $exception_class exception: $@\n"; } finally { clean_up(); # which will always be executed }; # don't forget the trailing ';' otherwise bad things *will* happen DESCRIPTION Error::TryCatch implements exception handling (try-catch) blocks functionality with an interface similiar perl exception handling to Error.pm (in fact, it's almost a drop-in replacement). The main difference is that it's a source filter module. As a source filter it can implement the same convenient interface without those nasty memory leaks and implicit anonymous subroutines (which can trick you, if you're not careful). Also after source parsing it converts the code into "native" perl code, so it's probably a little faster than Error.pm's approach. And, well. As far as I can tell, Error::TryCatch accomplishes its duty nicely. FUNCTIONS The interface is pretty straight-forward. I think that reading the synopsis is enough documentation. If you *really* need an explanation about how exception handling blocks work, you should take a look at Error.pm documentation. The only clause which I chose not to implement was the 'except' clause, since I consider it rather "exotic" and pretty much useless (at least for my purposes). And it would be a pain to implement. Unlike Error.pm, with Error::TryCatch you can return() from anywhere, but see CAVEATS below. EXCEPTION CLASSES Error::TryCatch was built with exception classes in mind and will even wrap anything it catches that is not a reference into a default
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Perl Throw
Stack Overflow the company Business Learn more about hiring developers or posting ads with perl croak us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is perl return a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why do I get this module error: “Can't locate Error.pm in @INC”? up vote http://search.cpan.org/~nilsonsfj/Error-TryCatch-0.07/lib/Error/TryCatch.pm 3 down vote favorite I tried running: perl -e "use Error;" from cmd in windows 7. (active perl 5.12 installed on system) and I am getting the error Can't locate Error.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib ) I manually searched and found Error.pm in C:/Perl64/lib/CPANPLUS. Does anyone have an idea what could be going on here? perl module share|improve this question edited Jul 22 '10 at 3:24 toolic 30.6k43468 http://stackoverflow.com/questions/3303641/why-do-i-get-this-module-error-cant-locate-error-pm-in-inc asked Jul 21 '10 at 20:41 chuck taylor 1,03721735 1 Sounds like your cpanplus was misconfigured, so it installed libraries in the wrong place. –Ether Jul 21 '10 at 21:21 4 Answerers on crack again today; the question clearly asks about Error and everyone talks about the irrelevant CPANPLUS::Error. chuck, you just have to install this missing module before you can use it. See stackoverflow.com/questions/65865/… –daxim Jul 22 '10 at 7:55 This worked for me. Thanks daxim. –chuck taylor Jul 22 '10 at 13:46 add a comment| 4 Answers 4 active oldest votes up vote 3 down vote You have to install the module Error that can be found on CPAN. But be aware of this warning: Using the "Error" module is no longer recommended due to the black-magical nature of its syntactic sugar, which often tends to break. Its maintainers have stopped actively writing code that uses it, and discourage people from doing so. See the "SEE ALSO" section below for better recommendations. share|improve this answer edited Jul 22 '10 at 9:01 daxim 33.9k44198 answered Jul 22 '10 at 8:06 Toto 47.2k163981 Why the downvotes ? –Toto Jul 22 '10 at 13:02 1 To do this, run sudo cpan Err
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn http://stackoverflow.com/questions/23293589/perl-module-install-error-cpan more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Perl Module install error CPAN up vote 4 down vote favorite perl error When i try to install Spreadsheet::WriteExcel perl module using cpan in ubuntu 12.04, i get this following error. > Can't exec "/usr/bin/make": No such file or directory at > /usr/share/perl/5.14/CPAN/Distribution.pm line 2078. > JMCNAMARA/OLE-Storage_Lite-0.19.tar.gz /usr/bin/make -- NOT OK > 'YAML' not installed, will not store persistent state Running make > test Can't test without successful make Running make install Make > had returned bad status, install seems impossible perl module error Running make for > J/JM/JMCNAMARA/Spreadsheet-WriteExcel-2.40.tar.gz Has already been > unwrapped into directory > /root/.cpan/build/Spreadsheet-WriteExcel-2.40-gJaT_A > > CPAN.pm: Going to build > J/JM/JMCNAMARA/Spreadsheet-WriteExcel-2.40.tar.gz > > Warning: Prerequisite 'OLE::Storage_Lite => 0.19' for > 'JMCNAMARA/Spreadsheet-WriteExcel-2.40.tar.gz' failed when processing > 'JMCNAMARA/OLE-Storage_Lite-0.19.tar. 'make => NO'. Continuing, but > chances to succeed are limited. Can't exec "/usr/bin/make": No such > file or directory at /usr/share/perl/5.14/CPAN/Distribution.pm line > 2078. JMCNAMARA/Spreadsheet-WriteExcel-2.40.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems > impossible Failed during this command: > JMCNAMARA/OLE-Storage_Lite-0.19.tar.gz : make NO > JMCNAMARA/Spreadsheet-WriteExcel-2.40.tar.gz : make NO I tried the following changes also. It didn't work. o conf make /usr/bin/make o conf commit Then i tried installing OLE-Storage_Lite, i got the same kind of error. perl cpan share|improve this question edited Apr 25 '14 at 12:49 Quentin 491k56641813 asked Apr 25 '14 at 12:46 Saravanan 12018 add a comment| 2 Answers 2 active oldest votes up vote 12 down vote accepted Look at the error message: Can't exec "/usr/bin/make": No such file or directory at /usr/share/perl/5.14/CPAN/Distribution.pm line 2078. make is missing. Therefore: install make. apt-get install build-essential Will get you most of what you need to compile software. I tr