What is a friendly module that allows querying a MySQL database from Perl?
Searching CPAN yielded so many results I don't know where to start. I need a simpl开发者_StackOverflow中文版e and friendly module for some basic querying.
For raw SQL queries, you'll need DBI and DBD::mysql. But I highly recommend that you also install and use DBIx::Class - it'll make your life far easier.
Main database module at CPAN is DBI. All other modules (except very little group) use DBI. DBI has drivers for databases. For MySQL it is called DBD::mysql. With DBI you can write crossdatabase Perl code. Of course you will need to alter SQL code in case you are using DBMS-specific features.
P.S. And look at placeholders.
I use DBIx::Simple .. it's not an ORM or anything, but does simplify SQL in perl a bit with its into(), arrays() and hashes() methods.
精彩评论