How To Install libobject-container-perl on Ubuntu 18.04

In this tutorial we learn how to install libobject-container-perl on Ubuntu 18.04. libobject-container-perl is module that provides a simple object container

Introduction

In this tutorial we learn how to install libobject-container-perl on Ubuntu 18.04.

What is libobject-container-perl

libobject-container-perl is:

Object::Container is an object container with an OO interface. It is used to make singletons out of ordinary classes.

For example, if you want to have a single instance of WWW::Mechanize throughout a program, you can do Object::Container->register(‘WWW::Mechanize’) somewhere and then you can retrieve that instance of WWW::Mechanize from anywhere else with Object::Container->get(‘WWW::Mechanize’);

Class::Singleton is a similar module, which makes subclasses singletons. Unlike Class::Singleton, Object::Container can make any class a singleton.

Object::Registrar is another similar module, but it does not support lazy loading.

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

sudo apt-get -y install libobject-container-perl

Install libobject-container-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libobject-container-perl

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

sudo aptitude -y install libobject-container-perl

How To Uninstall libobject-container-perl on Ubuntu 18.04

To uninstall only the libobject-container-perl package we can use the following command:

sudo apt-get remove libobject-container-perl

Uninstall libobject-container-perl And Its Dependencies

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

sudo apt-get -y autoremove libobject-container-perl

Remove libobject-container-perl Configurations and Data

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

sudo apt-get -y purge libobject-container-perl

Remove libobject-container-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libobject-container-perl

References

Summary

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