How To Install perl-Devel-EnforceEncapsulation on CentOS 7

In this tutorial we learn how to install perl-Devel-EnforceEncapsulation on CentOS 7. perl-Devel-EnforceEncapsulation is Find access violations to blessed objects

Introduction

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

What is perl-Devel-EnforceEncapsulation

Encapsulation is the practice of creating subroutines to access the properties of a class instead of accessing those properties directly. The advantage of good encapsulation is that the author is permitted to change the internal implementation of a class without breaking its usage. Object-oriented programming in Perl is most commonly implemented via blessed hashes. This practice makes it easy for users of a class to violate encapsulation by simply accessing the hash values directly. Although less common, the same applies to classes implemented via blessed arrays, scalars, filehandles, etc. This module is a hack to block those direct accesses. If you try to access a hash value of an object from its own class, or a superclass or subclass, all goes well. If you try to access a hash value from any other package, an exception is thrown. The same applies to the scalar value of a blessed scalar, entry in a blessed array, etc. To be clear encapsulation. If you want bullet-proof encapsulation, use inside-out objects or the like. Instead, this module is intended to be a development or debugging aid in catching places where direct access is used against classes implemented as blessed hashes. To repeat circumvented. Please use this module for good (finding bugs), not evil (making life harder for downstream developers).

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

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

sudo yum -y install perl-Devel-EnforceEncapsulation

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

sudo dnf -y install perl-Devel-EnforceEncapsulation

How To Uninstall perl-Devel-EnforceEncapsulation on CentOS 7

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

sudo dnf remove perl-Devel-EnforceEncapsulation

References

Summary

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