One of the nice things about Perl is the huge amount of free codeout there. Available in the form of modules, this code can simplify manycommon tasks while simultaneously offering a powerful toolkit for theexperienced developer. In this article, learn about two of the most popularPerl modules: DBI, used for database connectivity, and Carp, used tosimplify error handling.
Both DBI and Carp are extremely useful modules. DBI is being worked on extensively and is very popular amongst Perl coders. Its popularity ensures that database drivers are written for even the most obscure platforms and then kept up to date. It's not too difficult to write your own database drivers, so if you have some really strange database you have to interface with, you can put in a little more work and still use DBI.
DBI also makes the process of porting code between databases trivial. If your code is general enough and doesn't use any database specific tricks, then all you may have to do is change the DBD string in the connect() function. Light, fast, well-designed and very well-supported, this is a gem of a module.
Carp is also pretty popular. Many developers still prefer to use die() and warn() directly, but once you're hooked onto Carp, it's difficult to let go. It's a very small module, and using it entails a negligible performance and size hit. It's also small enough to read and understand...which means that it can be easily modified or customized.
Both these modules come with good documentation, although the documentation which ships with DBI is far more complete. Be sure to not only read the DBI documentation, but also the documentation for the relevant DBD, since it will usually contain sample code and detailed information about each and every available function.
You can obtain more information on both these modules at any of the links below: