ePages 6.11.0 - DE_EPAGES/Core/API/HashDiff.pm

Package DE_EPAGES::Core::API::HashDiff

This module provides a base class to compare hash structures. To use this module, you must create a sub class and implement the methods insert(), delete() and update().

Functions

compare
delete
insert
new

compare

Compares the hash structures $hOld and $hNew. Calls insert() for each key that exists in $hNew, but not in $hOld. Calls delete() for each key that exists in $hOld, but not in $hNew. Calls update() for each key that exists in both $hNew and $hOld.

Syntax
$Diff->compare( $hOld, $hNew )
Input
$hOld (ref.hash)
old hash structure
$hNew (ref.hash)
new hash structure

delete

Called by compare for each key that exists in $hOld, but not in $hNew.

Syntax
$Diff->delete( $Key, $OldValue )
Input
$Key (string)
hash key
$OldValue (scalar)
hash value

insert

Called by compare for each key that exists in $hNew, but not in $hOld.

Syntax
$Diff->insert( $Key, $NewValue )
Input
$Key (string)
hash key
$NewValue (scalar)
hash value

new

Compares the hash structures $hOld and $hNew. Calls insert() for each key that exists in $hNew, but not in $hOld. Calls delete() for each key that exists in $hOld, but not in $hNew. Calls update() for each key that exists in both $hNew and $hOld.

Syntax
my $Diff = DE_EPAGES::Core::API::HashDiff->new( %options )
Input
%options (hash)
(optional) parameters for the Diff object
Return
$Diff (object)
HashDiff object