How To Install liblexical-var-perl on Ubuntu 18.04

In this tutorial we learn how to install liblexical-var-perl on Ubuntu 18.04. liblexical-var-perl is Perl module for using static variables without namespace pollution

Introduction

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

What is liblexical-var-perl

liblexical-var-perl is:

Lexical::Var implements lexical scoping of subroutines. Although it can be used directly, it is mainly intended to be infrastructure for modules that manage namespaces.

This module influences the meaning of single-part subroutine names that appear directly in code, such as “&foo” and “foo(123)”. Normally, in the absence of any particular declaration, these would refer to the subroutine of that name located in the current package. A Lexical::Sub declaration can change this to refer to any particular subroutine, bypassing the package system entirely. A subroutine name that includes an explicit package part, such as “&main::foo”, always refers to the subroutine in the specified package, and is unaffected by this module. A symbolic reference through a string value, such as “&{‘foo’}”, also looks in the package system, and so is unaffected by this module.

The types of name that can be influenced are scalar ("$foo"), array ("@foo"), hash ("%foo"), subroutine ("&foo"), and glob ("*foo").

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

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

Install liblexical-var-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install liblexical-var-perl

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

sudo aptitude -y install liblexical-var-perl

How To Uninstall liblexical-var-perl on Ubuntu 18.04

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

sudo apt-get remove liblexical-var-perl

Uninstall liblexical-var-perl And Its Dependencies

To uninstall liblexical-var-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-var-perl

Remove liblexical-var-perl Configurations and Data

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

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

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

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

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

References

Summary

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