<p>Is <a href="http://cpan.uwinnipeg.ca/dist/DBI" rel="noreferrer">CPAN DBI</a> the best database interface to use in Perl for general database use? Are there some better options?</p>

[{'answer_id': 42795, 'author': 'Cebjyre', 'author_id': 1612, 'author_profile': 'https://Stackoverflow.com/users/1612', 'pm_score': 1, 'selected': False, 'text': '<p>Have a look at <a href="http://search.cpan.org/~tmtm/Class-DBI/lib/Class/DBI.pm" rel="nofollow noreferrer">Class::DBI</a> as well.</p>\n'}, {'answer_id': 42796, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 1, 'selected': False, 'text': "<p>In my opinion, DBI is a really good choice. I've used DBD::mysql actively and found it to be a really good solution.</p>\n"}, {'answer_id': 42851, 'author': 'dagorym', 'author_id': 171, 'author_profile': 'https://Stackoverflow.com/users/171', 'pm_score': 1, 'selected': False, 'text': '<p>We use the DBI module in all of our projects as well.  Many times we build a custom package on top of it for the specific application but underneath that is the core DBI module.  And often it is just easier to use the DBI module functions directly.</p>\n'}, {'answer_id': 43052, 'author': 'Matthew Watson', 'author_id': 3839, 'author_profile': 'https://Stackoverflow.com/users/3839', 'pm_score': 4, 'selected': False, 'text': '<p>DBI is the "low level" interface between Perl and an DBMS. It\'s pretty much the only realistic choice for doing that. Comparable to JDBC in Java. You would be crazy (or have a very specific use case) to pick anything other than DBI for you low level interface between Perl and a database.</p>\n\n<p>On top of DBI, there are various object/relational mappers which make working with a database much easier and cleaner.</p>\n\n<p>Some of the common/more popular ones are</p>\n\n<ul>\n<li><a href="http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm" rel="nofollow noreferrer">DBIx::Class</a></li>\n<li><a href="http://search.cpan.org/dist/Class-DBI/lib/Class/DBI.pm" rel="nofollow noreferrer">Class::DBI</a></li>\n<li><a href="http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object.pm" rel="nofollow noreferrer">Rose::DB::Object</a></li>\n</ul>\n'}, {'answer_id': 43065, 'author': 'John Siracusa', 'author_id': 164, 'author_profile': 'https://Stackoverflow.com/users/164', 'pm_score': 6, 'selected': True, 'text': '<p>If you\'re just looking for low-level database access&mdash;you feed it any SQL string (optionally with place-holders and bind values) and it runs your query and gives you back the results&mdash;then yes, <a href="http://search.cpan.org/dist/DBI/" rel="nofollow noreferrer">DBI</a> is your best bet, by far.</p>\n\n<p>If you want a higher-level interface (i.e., one that requires little or no use of raw SQL in your code) then there are several ORMs (<a href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="nofollow noreferrer">object-relational mappers</a>) available for Perl.  Check out the <a href="http://www.perlfoundation.org/perl5/index.cgi?orm" rel="nofollow noreferrer">ORM</a> page at the Perl Foundation\'s Perl 5 wiki for more information and links.  (If you want help choosing among them or have specific questions, you could narrow the focus of this question or perhaps post another one.)</p>\n'}, {'answer_id': 48857, 'author': 'Nerfboy', 'author_id': 5095, 'author_profile': 'https://Stackoverflow.com/users/5095', 'pm_score': 1, 'selected': False, 'text': "<p>DBI is great, but the quality of the DBD modules can vary. I was bitten by a 'feature' in one of the versions of DBD:pg. It liked to load the full data of your result into memory, rather than interate over it with cursors.</p>\n\n<p>As per usual - Caveat programmor.</p>\n"}, {'answer_id': 59406, 'author': 'dpavlin', 'author_id': 1081, 'author_profile': 'https://Stackoverflow.com/users/1081', 'pm_score': 2, 'selected': False, 'text': "<p>If you want to work with objects (with introspection!), take a look at Fey::ORM which implements ORM based on Moose. It's also has very SQL like syntax so it fits my RDBMS-based brain a bit better than some of other ORM frameworks.</p>\n"}, {'answer_id': 70649, 'author': 'jonfm', 'author_id': 6924, 'author_profile': 'https://Stackoverflow.com/users/6924', 'pm_score': 1, 'selected': False, 'text': '<p>DBI rocks! but for a proper fully-featured ORM that is fast go for DBIx::Class all the time.</p>\n'}, {'answer_id': 72471, 'author': '8jean', 'author_id': 10011, 'author_profile': 'https://Stackoverflow.com/users/10011', 'pm_score': 3, 'selected': False, 'text': '<p>If you chose to use plain <code>DBI</code> for a task that doesn\'t need an ORM, I\nstrongly suggest you take a look at <a href="http://search.cpan.org/perldoc?DBIx::Simple" rel="noreferrer">DBIx::Simple</a>.</p>\n\n<p>It\'s not a replacement, but a very well designed API on top of <code>DBI</code>\nthat makes simple things simple and complex things possible, without\nlosing any of the flexibilty of <code>DBI</code>.</p>\n\n<p>Did you ever found you had to look up apparently simple things in the <code>DBI</code>\ndocumentation, like getting the results of a query as an arrayref (rows)\nof hashes (columns and their values)?\nWith <code>DBIx::Simple</code> this is straightforward:</p>\n\n<pre><code># DBI\nmy $rows = $dbh-&gt;selectall_arrayref($sql, { Slice =&gt; {} });\n                 # tell it we want "hashes" (yuck!) ^^^^\n\n# DBIx::Simple\nmy $rows = $db-&gt;query($sql)-&gt;hashes; # does the same as the above code underneath!\n</code></pre>\n\n<p>Take a look at the <a href="http://search.cpan.org/perldoc?DBIx::Simple::Examples" rel="noreferrer">examples</a> for more. Also, the integration with <a href="http://search.cpan.org/perldoc?SQL::Abstract" rel="noreferrer">SQL::Abstract</a> makes simple queries a breeze. It use it in all of my code where I would have used <code>DBI</code> before, and\nI\'m not looking back.</p>\n'}, {'answer_id': 72598, 'author': 'Darren Meyer', 'author_id': 7826, 'author_profile': 'https://Stackoverflow.com/users/7826', 'pm_score': 2, 'selected': False, 'text': '<p>It\'s worth pointing out that the vast majority of the "higher-level" interfaces (like SQL::Abstract) and (DBIx::Simple) use DBI itself when actually performing the queries.  DBI is pretty much the accepted standard method for database connection in Perl.</p>\n'}, {'answer_id': 47015676, 'author': 'K.Minoda', 'author_id': 8824214, 'author_profile': 'https://Stackoverflow.com/users/8824214', 'pm_score': 0, 'selected': False, 'text': '<p>Basically you should be used to using only DBI firstly.</p>\n'}]
['https://Stackoverflow.com/questions/42778', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/381/']