How To Install perl-JSON-MaybeXS on CentOS 7

In this tutorial we learn how to install perl-JSON-MaybeXS on CentOS 7. perl-JSON-MaybeXS is Use Cpanel::JSON::XS with a fallback to JSON::XS and JSON::PP

Introduction

In this tutorial we learn how to install perl-JSON-MaybeXS on CentOS 7.

What is perl-JSON-MaybeXS

This module first checks to see if either Cpanel JSON Otherwise it tries to load Cpanel JSON throws an error. It then exports the “encode_json” and “decode_json” functions from the loaded module, along with a “JSON” constant that returns the class name for calling “new” on. If you’re writing fresh code rather than replacing JSON.pm usage, you might want to pass options as constructor args rather than calling mutators, so we provide our own “new” method that supports that.

We can use yum or dnf to install perl-JSON-MaybeXS on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install perl-JSON-MaybeXS.

Install perl-JSON-MaybeXS on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install perl-JSON-MaybeXS using yum by running the following command:

sudo yum -y install perl-JSON-MaybeXS

Install perl-JSON-MaybeXS on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install perl-JSON-MaybeXS using dnf by running the following command:

sudo dnf -y install perl-JSON-MaybeXS

How To Uninstall perl-JSON-MaybeXS on CentOS 7

To uninstall only the perl-JSON-MaybeXS package we can use the following command:

sudo dnf remove perl-JSON-MaybeXS

References

Summary

In this tutorial we learn how to install perl-JSON-MaybeXS on CentOS 7 using yum and dnf.