How To Install libhtml-prettyprinter-perl on Ubuntu 18.04

In this tutorial we learn how to install libhtml-prettyprinter-perl on Ubuntu 18.04. libhtml-prettyprinter-perl is module that generates nice HTML files from HTML syntax trees

Introduction

In this tutorial we learn how to install libhtml-prettyprinter-perl on Ubuntu 18.04.

What is libhtml-prettyprinter-perl

libhtml-prettyprinter-perl is:

HTML::PrettyPrinter produces nicely formatted HTML code from a HTML syntax tree. It is especially useful if the produced HTML file shall be read or edited manually afterwards. Various parameters let you adapt the output to different styles and requirements.

If you don’t care how the HTML source looks like as long as it is valid and readable by browsers, you should use the as_HTML() method of HTML::Element instead of the pretty printer. It is about five times faster.

The pretty printer will handle line wrapping, indention and structuring by the way the whitespace in the tree is represented in the output. Furthermore upper/lowercase markup and markup minimization, quoting of attribute values, the encoding of entities and the presence of optional end tags are configurable.

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

sudo apt-get -y install libhtml-prettyprinter-perl

Install libhtml-prettyprinter-perl Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libhtml-prettyprinter-perl

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

sudo aptitude -y install libhtml-prettyprinter-perl

How To Uninstall libhtml-prettyprinter-perl on Ubuntu 18.04

To uninstall only the libhtml-prettyprinter-perl package we can use the following command:

sudo apt-get remove libhtml-prettyprinter-perl

Uninstall libhtml-prettyprinter-perl And Its Dependencies

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

sudo apt-get -y autoremove libhtml-prettyprinter-perl

Remove libhtml-prettyprinter-perl Configurations and Data

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

sudo apt-get -y purge libhtml-prettyprinter-perl

Remove libhtml-prettyprinter-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libhtml-prettyprinter-perl

References

Summary

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