How To Install perl-Carp on CentOS 7

In this tutorial we learn how to install perl-Carp on CentOS 7. perl-Carp is Alternative warn and die for modules

Introduction

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

What is perl-Carp

The Carp routines are useful in your own modules because they act like die() or warn(), but with a message which is more likely to be useful to a user of your module. In the case of cluck, confess, and longmess that context is a summary of every call in the call-stack. For a shorter message you can use carp or croak which report the error as being from where your module was called. There is no guarantee that that is where the error was, but it is a good educated guess.

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

Install perl-Carp 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-Carp using yum by running the following command:

sudo yum -y install perl-Carp

Install perl-Carp 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-Carp using dnf by running the following command:

sudo dnf -y install perl-Carp

How To Uninstall perl-Carp on CentOS 7

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

sudo dnf remove perl-Carp

References

Summary

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