How To Install liblexical-failure-perl on Ubuntu 18.04

In this tutorial we learn how to install liblexical-failure-perl on Ubuntu 18.04. liblexical-failure-perl is Perl module for user-selectable lexically-scoped failure signaling

Introduction

In this tutorial we learn how to install liblexical-failure-perl on Ubuntu 18.04.

What is liblexical-failure-perl

liblexical-failure-perl is:

Lexical::Failure sets up two new keywords: fail and ON_FAILURE, with which you can quickly create modules whose failure signaling is lexcially scoped, under the control of client code.

Normally, modules specify some fixed mechanism for error handling and require client code to adapt to that policy. One module may signal errors by returning undef, or perhaps some special “error object”. Another may die or croak on failure. A third may set a flag variable. A fourth may require the client code to set up a callback, which is executed on failure.

If you are using all four modules, your own code now has to check for failure in four different ways, depending on where the failing component originated. If you would rather that all components throw exceptions, or all return undef, you will probably have to write wrappers around 3/4 of them, to convert from their “native” failure mechanism to your preferred one.

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

sudo apt-get -y install liblexical-failure-perl

Install liblexical-failure-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install liblexical-failure-perl

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

sudo aptitude -y install liblexical-failure-perl

How To Uninstall liblexical-failure-perl on Ubuntu 18.04

To uninstall only the liblexical-failure-perl package we can use the following command:

sudo apt-get remove liblexical-failure-perl

Uninstall liblexical-failure-perl And Its Dependencies

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

sudo apt-get -y autoremove liblexical-failure-perl

Remove liblexical-failure-perl Configurations and Data

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

sudo apt-get -y purge liblexical-failure-perl

Remove liblexical-failure-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge liblexical-failure-perl

References

Summary

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