]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/URInntps.pm
add PublicInbox::URInntps package
[public-inbox.git] / lib / PublicInbox / URInntps.pm
diff --git a/lib/PublicInbox/URInntps.pm b/lib/PublicInbox/URInntps.pm
new file mode 100644 (file)
index 0000000..69fe716
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+
+# deal with the lack of URI::nntps in upstream URI.
+# nntps is IANA registered, snews is deprecated
+# cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983419
+package PublicInbox::URInntps;
+use strict;
+use parent qw(URI::snews);
+use URI;
+
+sub new {
+       my ($class, $url) = @_;
+       $url =~ m!\Anntps://!i ? bless(\$url, $class) : URI->new($url);
+}
+
+1;