How To Install libmonkey-patch-perl on Ubuntu 18.04

In this tutorial we learn how to install libmonkey-patch-perl on Ubuntu 18.04. libmonkey-patch-perl is scoped monkey-patching Perl module

Introduction

In this tutorial we learn how to install libmonkey-patch-perl on Ubuntu 18.04.

What is libmonkey-patch-perl

libmonkey-patch-perl is:

Monkey patching is a way to extend or modify the runtime code of a program or library without altering the original source code.

Monkey::Patch provides lexical scope monkey-patching so that you can wrap any other package’s subroutine with your own code and still have access to the original subroutine.

There are three methods to install libmonkey-patch-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 libmonkey-patch-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 libmonkey-patch-perl using apt-get by running the following command:

sudo apt-get -y install libmonkey-patch-perl

Install libmonkey-patch-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libmonkey-patch-perl

Install libmonkey-patch-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 libmonkey-patch-perl using aptitude by running the following command:

sudo aptitude -y install libmonkey-patch-perl

How To Uninstall libmonkey-patch-perl on Ubuntu 18.04

To uninstall only the libmonkey-patch-perl package we can use the following command:

sudo apt-get remove libmonkey-patch-perl

Uninstall libmonkey-patch-perl And Its Dependencies

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

sudo apt-get -y autoremove libmonkey-patch-perl

Remove libmonkey-patch-perl Configurations and Data

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

sudo apt-get -y purge libmonkey-patch-perl

Remove libmonkey-patch-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libmonkey-patch-perl

References

Summary

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