aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2024-09-05 05:13:51 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2024-09-05 06:11:17 +0000
commite83a453f6a713df429323dcd0f0e8b0f7518da27 (patch)
tree1e4ea4393f8dfe0e3e654ded2ac9a9089ce21251
parenta38aa39e083bf389dfe9066db114abb32143638c (diff)
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).
-rw-r--r--devel/Makefile1
-rw-r--r--devel/p5-Time-Duration-Parse-AsHash/Makefile20
-rw-r--r--devel/p5-Time-Duration-Parse-AsHash/distinfo3
-rw-r--r--devel/p5-Time-Duration-Parse-AsHash/pkg-descr22
-rw-r--r--devel/p5-Time-Duration-Parse-AsHash/pkg-plist2
5 files changed, 48 insertions, 0 deletions
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