How To Install libreadonly-xs-perl on Ubuntu 18.04

In this tutorial we learn how to install libreadonly-xs-perl on Ubuntu 18.04. libreadonly-xs-perl is faster Readonly implementation

Introduction

In this tutorial we learn how to install libreadonly-xs-perl on Ubuntu 18.04.

What is libreadonly-xs-perl

libreadonly-xs-perl is:

The Readonly module (q.v.) is an effective way to create non-modifiable variables. However, it’s relatively slow.

The reason it’s slow is that is implements the read-only-ness of variables via tied objects. This mechanism is inherently slow. Perl simply has to do a lot of work under the hood to make tied variables work.

This module corrects the speed problem, at least with respect to scalar variables. When Readonly::XS is installed, Readonly uses it to access the internals of scalar variables. Instead of creating a scalar variable object and tying it, Readonly simply flips the SvREADONLY bit in the scalar’s FLAGS structure.

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

sudo apt-get -y install libreadonly-xs-perl

Install libreadonly-xs-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libreadonly-xs-perl

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

sudo aptitude -y install libreadonly-xs-perl

How To Uninstall libreadonly-xs-perl on Ubuntu 18.04

To uninstall only the libreadonly-xs-perl package we can use the following command:

sudo apt-get remove libreadonly-xs-perl

Uninstall libreadonly-xs-perl And Its Dependencies

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

sudo apt-get -y autoremove libreadonly-xs-perl

Remove libreadonly-xs-perl Configurations and Data

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

sudo apt-get -y purge libreadonly-xs-perl

Remove libreadonly-xs-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libreadonly-xs-perl

References

Summary

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