How To Install perl-DBD-Mock on CentOS 7

In this tutorial we learn how to install perl-DBD-Mock on CentOS 7. perl-DBD-Mock is Mock database driver for testing

Introduction

In this tutorial we learn how to install perl-DBD-Mock on CentOS 7.

What is perl-DBD-Mock

Testing with databases can be tricky. If you are developing a system married to a single database then you can make some assumptions about your environment and ask the user to provide relevant connection information. But if you need to test a framework that uses DBI, particularly a framework that uses different types of persistence schemes, then it may be more useful to simply verify what the framework is trying to do – ensure the right SQL is generated and that the correct parameters are bound. DBD (presumably held outside your code) and just use it instead of DBD

We can use yum or dnf to install perl-DBD-Mock on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install perl-DBD-Mock.

Install perl-DBD-Mock on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install perl-DBD-Mock using yum by running the following command:

sudo yum -y install perl-DBD-Mock

Install perl-DBD-Mock on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install perl-DBD-Mock using dnf by running the following command:

sudo dnf -y install perl-DBD-Mock

How To Uninstall perl-DBD-Mock on CentOS 7

To uninstall only the perl-DBD-Mock package we can use the following command:

sudo dnf remove perl-DBD-Mock

References

Summary

In this tutorial we learn how to install perl-DBD-Mock on CentOS 7 using yum and dnf.