How To Install libmock-quick-perl on Ubuntu 18.04

In this tutorial we learn how to install libmock-quick-perl on Ubuntu 18.04. libmock-quick-perl is Perl module for quick side-effect free mocking of objects and classes

Introduction

In this tutorial we learn how to install libmock-quick-perl on Ubuntu 18.04.

What is libmock-quick-perl

libmock-quick-perl is:

Mock::Quick is here to solve the current problems with Mocking libraries.

There are a couple Mocking libraries available on CPAN. The primary problems with these libraries include verbose syntax, and most importantly side-effects. Some Mocking libraries expect you to mock a specific class, and will unload it then redefine it. This is particularly a problem if you only want to override a class on a lexical level.

Mock::Quick provides a declarative mocking interface that results in a very concise, but clear syntax. There are separate facilities for mocking object instances, and classes. You can quickly create an instance of an object with custom attributes and methods. You can also quickly create an anonymous class, optionally inhereting from another, with whatever methods you desire.

Mock::Quick also provides a tool that provides an OO interface to overriding methods in existing classes. This tool also allows for the restoration of the original class methods. Best of all this is a localized tool, when your control object falls out of scope the original class is restored.

There are three methods to install libmock-quick-perl on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libmock-quick-perl Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libmock-quick-perl using apt-get by running the following command:

sudo apt-get -y install libmock-quick-perl

Install libmock-quick-perl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libmock-quick-perl using apt by running the following command:

sudo apt -y install libmock-quick-perl

Install libmock-quick-perl Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libmock-quick-perl using aptitude by running the following command:

sudo aptitude -y install libmock-quick-perl

How To Uninstall libmock-quick-perl on Ubuntu 18.04

To uninstall only the libmock-quick-perl package we can use the following command:

sudo apt-get remove libmock-quick-perl

Uninstall libmock-quick-perl And Its Dependencies

To uninstall libmock-quick-perl and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libmock-quick-perl

Remove libmock-quick-perl Configurations and Data

To remove libmock-quick-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libmock-quick-perl

Remove libmock-quick-perl configuration, data, and all of its dependencies

We can use the following command to remove libmock-quick-perl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libmock-quick-perl

References

Summary

In this tutorial we learn how to install libmock-quick-perl package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.