aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2024-09-05 05:13:39 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2024-09-05 06:11:14 +0000
commitd8f371acc012ee0c679bde59c18b893c963bcb23 (patch)
tree514aaaed9030159b6074f3560f79a4430acd37ce
parent43c69bb16b1141e3b2e6b82a272690e99a7f8134 (diff)
devel/p5-Data-ModeMerge: Add p5-Data-ModeMerge 0.360
There are already several modules on CPAN to do recursive data structure merging, like Data::Merger and Hash::Merge. Data::ModeMerge differs in that it offers merging "modes" and "options". It provides greater flexibility on what the result of a merge between two data should/can be. This module may or may not be what you need. One application of this module is in handling configuration. Often there are multiple levels of configuration, e.g. in your typical Unix command-line program there are system-wide config file in /etc, per-user config file under ~/, and command-line options. It's convenient programatically to load each of those in a hash and then merge system-wide hash with the per-user hash, and then merge the result with the command-line hash to get the a single hash as the final configuration. Your program can from there on deal with this just one hash instead of three. In a typical merging process between two hashes (left-side and right-side), when there is a conflicting key, then the right-side key will override the left-side. This is usually the desired behaviour in our said program as the system-wide config is there to provide defaults, and the per-user config (and the command-line arguments) allow a user to override those defaults.
-rw-r--r--devel/Makefile1
-rw-r--r--devel/p5-Data-ModeMerge/Makefile26
-rw-r--r--devel/p5-Data-ModeMerge/distinfo3
-rw-r--r--devel/p5-Data-ModeMerge/pkg-descr20
-rw-r--r--devel/p5-Data-ModeMerge/pkg-plist18
5 files changed, 68 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index fbebdb523eac..27501dfa1a62 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -2241,6 +2241,7 @@
SUBDIR += p5-Data-MessagePack
SUBDIR += p5-Data-MessagePack-Stream
SUBDIR += p5-Data-Miscellany
+ SUBDIR += p5-Data-ModeMerge
SUBDIR += p5-Data-Model
SUBDIR += p5-Data-Munge
SUBDIR += p5-Data-Object
diff --git a/devel/p5-Data-ModeMerge/Makefile b/devel/p5-Data-ModeMerge/Makefile
new file mode 100644
index 000000000000..5a1d1dc7cd80
--- /dev/null
+++ b/devel/p5-Data-ModeMerge/Makefile
@@ -0,0 +1,26 @@
+PORTNAME= Data-ModeMerge
+PORTVERSION= 0.36.0
+CATEGORIES= devel perl5
+MASTER_SITES= CPAN
+PKGNAMEPREFIX= p5-
+DISTNAME= Data-ModeMerge-${PORTVERSION:R}${PORTVERSION:E}
+
+MAINTAINER= sunpoet@FreeBSD.org
+COMMENT= Merge two nested data structures, with merging modes and options
+WWW= https://metacpan.org/dist/Data-ModeMerge
+
+LICENSE= ART10 GPLv1+
+LICENSE_COMB= dual
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${RUN_DEPENDS}
+RUN_DEPENDS= p5-Data-Dmp>=0.241:devel/p5-Data-Dmp \
+ p5-Mo>=0:devel/p5-Mo
+TEST_DEPENDS= p5-Test-Exception>=0:devel/p5-Test-Exception
+
+USES= perl5
+USE_PERL5= configure
+
+NO_ARCH= yes
+
+.include <bsd.port.mk>
diff --git a/devel/p5-Data-ModeMerge/distinfo b/devel/p5-Data-ModeMerge/distinfo
new file mode 100644
index 000000000000..5590ddc687c0
--- /dev/null
+++ b/devel/p5-Data-ModeMerge/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1724084446
+SHA256 (Data-ModeMerge-0.360.tar.gz) = 1bac4f668a13be28b7b835f84b3543e5b73d963b6fb38b71c735d9079fbe7454
+SIZE (Data-ModeMerge-0.360.tar.gz) = 47971
diff --git a/devel/p5-Data-ModeMerge/pkg-descr b/devel/p5-Data-ModeMerge/pkg-descr
new file mode 100644
index 000000000000..726e65ea1c31
--- /dev/null
+++ b/devel/p5-Data-ModeMerge/pkg-descr
@@ -0,0 +1,20 @@
+There are already several modules on CPAN to do recursive data structure
+merging, like Data::Merger and Hash::Merge. Data::ModeMerge differs in that it
+offers merging "modes" and "options". It provides greater flexibility on what
+the result of a merge between two data should/can be. This module may or may not
+be what you need.
+
+One application of this module is in handling configuration. Often there are
+multiple levels of configuration, e.g. in your typical Unix command-line program
+there are system-wide config file in /etc, per-user config file under ~/, and
+command-line options. It's convenient programatically to load each of those in a
+hash and then merge system-wide hash with the per-user hash, and then merge the
+result with the command-line hash to get the a single hash as the final
+configuration. Your program can from there on deal with this just one hash
+instead of three.
+
+In a typical merging process between two hashes (left-side and right-side), when
+there is a conflicting key, then the right-side key will override the left-side.
+This is usually the desired behaviour in our said program as the system-wide
+config is there to provide defaults, and the per-user config (and the
+command-line arguments) allow a user to override those defaults.
diff --git a/devel/p5-Data-ModeMerge/pkg-plist b/devel/p5-Data-ModeMerge/pkg-plist
new file mode 100644
index 000000000000..62ec00f99fd8
--- /dev/null
+++ b/devel/p5-Data-ModeMerge/pkg-plist
@@ -0,0 +1,18 @@
+%%SITE_PERL%%/Data/ModeMerge.pm
+%%SITE_PERL%%/Data/ModeMerge/Config.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/ADD.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/Base.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/CONCAT.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/DELETE.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/KEEP.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/NORMAL.pm
+%%SITE_PERL%%/Data/ModeMerge/Mode/SUBTRACT.pm
+%%PERL5_MAN3%%/Data::ModeMerge.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Config.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::ADD.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::Base.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::CONCAT.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::DELETE.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::KEEP.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::NORMAL.3.gz
+%%PERL5_MAN3%%/Data::ModeMerge::Mode::SUBTRACT.3.gz