How To Install libdancer2-plugin-database-perl on Ubuntu 18.04

In this tutorial we learn how to install libdancer2-plugin-database-perl on Ubuntu 18.04. libdancer2-plugin-database-perl is module for easy database connections for Dancer2 applications

Introduction

In this tutorial we learn how to install libdancer2-plugin-database-perl on Ubuntu 18.04.

What is libdancer2-plugin-database-perl

libdancer2-plugin-database-perl is:

Dancer2::Plugin::Database Provides an easy way to obtain a connected DBI database handle by simply calling the database keyword within your Dancer2 application

The module returns a Dancer::Plugin::Database::Core::Handle object, which is a subclass of DBI’s `DBI::db’ connection handle object, so it does everything you’d expect to do with DBI, but also adds a few convenience methods.

It takes care of ensuring that the database handle is still connected and valid. If the handle was last asked for more than connection_check_threshold' seconds ago, it will check that the connection is still alive, using either the $dbh->ping’ method if the DBD driver supports it, or performing a simple no-op query against the database if not. If the connection has gone away, a new connection will be obtained and returned. This avoids any problems for a long-running script where the connection to the database might go away.

Care is taken that handles are not shared across processes/threads, so this should be thread-safe with no issues with transactions etc.

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

sudo apt-get -y install libdancer2-plugin-database-perl

Install libdancer2-plugin-database-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libdancer2-plugin-database-perl

Install libdancer2-plugin-database-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 libdancer2-plugin-database-perl using aptitude by running the following command:

sudo aptitude -y install libdancer2-plugin-database-perl

How To Uninstall libdancer2-plugin-database-perl on Ubuntu 18.04

To uninstall only the libdancer2-plugin-database-perl package we can use the following command:

sudo apt-get remove libdancer2-plugin-database-perl

Uninstall libdancer2-plugin-database-perl And Its Dependencies

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

sudo apt-get -y autoremove libdancer2-plugin-database-perl

Remove libdancer2-plugin-database-perl Configurations and Data

To remove libdancer2-plugin-database-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libdancer2-plugin-database-perl

Remove libdancer2-plugin-database-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libdancer2-plugin-database-perl

References

Summary

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