How To Install libdbix-safe-perl on Ubuntu 18.04

In this tutorial we learn how to install libdbix-safe-perl on Ubuntu 18.04. libdbix-safe-perl is safe wrapper to DBI interface

Introduction

In this tutorial we learn how to install libdbix-safe-perl on Ubuntu 18.04.

What is libdbix-safe-perl

libdbix-safe-perl is:

The purpose of the DBIx::Safe module is to give controlled, limited access to an application, rather than simply passing it a raw database handle through DBI. DBIx::Safe acts as a wrapper to the database, by only allowing through the commands you tell it to. It filters all things related to the database handle - methods and attributes.

The typical usage is for your application to create a database handle via a normal DBI call to new(), then pass that to DBIx::Safe->new(), which will return you a DBIx::Safe object. After specifying exactly what is and what is not allowed, you can pass the object to the untrusted application. The object will act very similar to a DBI database handle, and in most cases can be used interchangeably.

By default, nothing is allowed to run at all. There are many things you can control. You can specify which SQL commands are allowed, by indicating the first word in the SQL statement (e.g. ‘SELECT’). You can specify which database methods are allowed to run (e.g. ‘ping’). You can specify a regular expression that allows matching SQL statements to run (e.g. ‘qr{SET TIMEZONE}’). You can specify a regular expression that is NOT allowed to run (e.g. qr(UPDATE xxx}). Finally, you can indicate which database attributes are allowed to be read and changed (e.g. ‘PrintError’). For all of the above, there are matching methods to remove them as well.

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

sudo apt-get -y install libdbix-safe-perl

Install libdbix-safe-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libdbix-safe-perl

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

sudo aptitude -y install libdbix-safe-perl

How To Uninstall libdbix-safe-perl on Ubuntu 18.04

To uninstall only the libdbix-safe-perl package we can use the following command:

sudo apt-get remove libdbix-safe-perl

Uninstall libdbix-safe-perl And Its Dependencies

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

sudo apt-get -y autoremove libdbix-safe-perl

Remove libdbix-safe-perl Configurations and Data

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

sudo apt-get -y purge libdbix-safe-perl

Remove libdbix-safe-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libdbix-safe-perl

References

Summary

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