git: e83a453f6a71 - main - devel/p5-Time-Duration-Parse-AsHash: Add p5-Time-Duration-Parse-AsHash 0.10.6

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 05 Sep 2024 06:19:25 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e83a453f6a713df429323dcd0f0e8b0f7518da27

commit e83a453f6a713df429323dcd0f0e8b0f7518da27
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-09-05 05:13:51 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-05 06:11:17 +0000

    devel/p5-Time-Duration-Parse-AsHash: Add p5-Time-Duration-Parse-AsHash 0.10.6
    
    Time::Duration::Parse::AsHash is like Time::Duration::Parse except:
    - By default it returns a hashref of parsed duration elements instead of number
      of seconds
      There are some circumstances when you want this, e.g. when feeding into
      DateTime::Duration and you want to count for leap seconds.
      To return number of seconds like Time::Duration::Parse, pass a true value as
      the second argument.
    - By default seconds are not rounded
      For example: "0.1s" or 100ms will return result { seconds => 0.1 }, and "2.3s"
      will return { seconds => 2.3 }.
      Also, <01:02:03> being recognized as 1h2min3s, 01:02:03.4567 will also be
      recognized as 1h2min3.4567s.
    - It recognizes more duration units
      milliseconds (ms), which will be returned in the seconds key, for example
      "400ms" returns { seconds => 0.4 }.
      microseconds. This will also be returned in seconds key.
      nanoseconds (ns). This will also be returned in seconds key.
      decades. This will be returned in years key, for example "1.5 decades" will
      return { years => 15 }.
    - It has a lower startup overhead
      By avoiding modules like Carp and Exporter::Lite, even strict and warnings
      (starts up in ~3m vs ~9ms on my computer).
---
 devel/Makefile                                |  1 +
 devel/p5-Time-Duration-Parse-AsHash/Makefile  | 20 ++++++++++++++++++++
 devel/p5-Time-Duration-Parse-AsHash/distinfo  |  3 +++
 devel/p5-Time-Duration-Parse-AsHash/pkg-descr | 22 ++++++++++++++++++++++
 devel/p5-Time-Duration-Parse-AsHash/pkg-plist |  2 ++
 5 files changed, 48 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 828990f99870..898b634a9e59 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -3812,6 +3812,7 @@
     SUBDIR += p5-Time-Crontab
     SUBDIR += p5-Time-Duration
     SUBDIR += p5-Time-Duration-Parse
+    SUBDIR += p5-Time-Duration-Parse-AsHash
     SUBDIR += p5-Time-Elapsed
     SUBDIR += p5-Time-Format
     SUBDIR += p5-Time-HiRes
diff --git a/devel/p5-Time-Duration-Parse-AsHash/Makefile b/devel/p5-Time-Duration-Parse-AsHash/Makefile
new file mode 100644
index 000000000000..727b60174b52
--- /dev/null
+++ b/devel/p5-Time-Duration-Parse-AsHash/Makefile
@@ -0,0 +1,20 @@
+PORTNAME=	Time-Duration-Parse-AsHash
+PORTVERSION=	0.10.6
+CATEGORIES=	devel perl5
+MASTER_SITES=	CPAN
+PKGNAMEPREFIX=	p5-
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	Parse string that represents time duration
+WWW=		https://metacpan.org/dist/Time-Duration-Parse-AsHash
+
+LICENSE=	ART10 GPLv1+
+LICENSE_COMB=	dual
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		perl5
+USE_PERL5=	configure
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/devel/p5-Time-Duration-Parse-AsHash/distinfo b/devel/p5-Time-Duration-Parse-AsHash/distinfo
new file mode 100644
index 000000000000..303a86f6be9a
--- /dev/null
+++ b/devel/p5-Time-Duration-Parse-AsHash/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1724084468
+SHA256 (Time-Duration-Parse-AsHash-0.10.6.tar.gz) = b6776df009d00ef6bc74aa4e487523536b4578fec35dda9a88891b91d0d52831
+SIZE (Time-Duration-Parse-AsHash-0.10.6.tar.gz) = 15754
diff --git a/devel/p5-Time-Duration-Parse-AsHash/pkg-descr b/devel/p5-Time-Duration-Parse-AsHash/pkg-descr
new file mode 100644
index 000000000000..099ea0949a25
--- /dev/null
+++ b/devel/p5-Time-Duration-Parse-AsHash/pkg-descr
@@ -0,0 +1,22 @@
+Time::Duration::Parse::AsHash is like Time::Duration::Parse except:
+- By default it returns a hashref of parsed duration elements instead of number
+  of seconds
+  There are some circumstances when you want this, e.g. when feeding into
+  DateTime::Duration and you want to count for leap seconds.
+  To return number of seconds like Time::Duration::Parse, pass a true value as
+  the second argument.
+- By default seconds are not rounded
+  For example: "0.1s" or 100ms will return result { seconds => 0.1 }, and "2.3s"
+  will return { seconds => 2.3 }.
+  Also, <01:02:03> being recognized as 1h2min3s, 01:02:03.4567 will also be
+  recognized as 1h2min3.4567s.
+- It recognizes more duration units
+  milliseconds (ms), which will be returned in the seconds key, for example
+  "400ms" returns { seconds => 0.4 }.
+  microseconds. This will also be returned in seconds key.
+  nanoseconds (ns). This will also be returned in seconds key.
+  decades. This will be returned in years key, for example "1.5 decades" will
+  return { years => 15 }.
+- It has a lower startup overhead
+  By avoiding modules like Carp and Exporter::Lite, even strict and warnings
+  (starts up in ~3m vs ~9ms on my computer).
diff --git a/devel/p5-Time-Duration-Parse-AsHash/pkg-plist b/devel/p5-Time-Duration-Parse-AsHash/pkg-plist
new file mode 100644
index 000000000000..f9c49356c29a
--- /dev/null
+++ b/devel/p5-Time-Duration-Parse-AsHash/pkg-plist
@@ -0,0 +1,2 @@
+%%SITE_PERL%%/Time/Duration/Parse/AsHash.pm
+%%PERL5_MAN3%%/Time::Duration::Parse::AsHash.3.gz