How to get the database name from wp-config.php using wp-cli call?

I am writing a perl script for migrating WordPress installations from a place to another. In this work I need to get wordpress database name from wp-config file using wp-cli calls. So please let me know how call wp-cli function from perl script for getting db name from wp-config.php.

Related posts

Leave a Reply

2 comments

  1. Assuming you already figured out how to call an external process from Perl, this is the wp-cli command you’ll need:

    wp eval 'echo DB_NAME;'