NAME
Net::Gemini::URI - Gemini protocol URI support
SYNOPSIS
use Net::Gemini::URI;
my ( $u, $err ) = Net::Gemini::URI->new('gemini://example.org');
print $u->canonical, "\n"; # gemini://example.org/
$u->host('example.com');
print "$u\n"; # gemini://example.com/
DESCRIPTION
This module provides Gemini protocol URI support, based on RFC 3986 and the specification.
Note that Gemini request URI are restricted to 1024 bytes and must use the UTF-8 encoding. These restrictions are not enforced by this module, but are in Net::Gemini. Also no particular handling of percent encoding is done by this module, nor of path normalization. This may need to change.
METHODS
- new URI
-
new accepts a URI, and returns a list consisting of one of the following two forms:
object, undef undef, "error message"
Using the object in string context will emit the canonical URI.
- hostport
-
Returns the host and port.
- canonical
-
Returns the URI in canonical form, as per section 6.2.3 of RFC 3986 assuming that I read that documentation aright.
- host [ new-host ] =item port [ new-port ] =item path [ new-path ] =item query [ new-query ] =item fragment [ new-fragment ]
-
Returns the given portion of the URI after optionally setting a new value. These methods do not do anything by way of validation of the input, unlike new does, so could be used to construct very invalid URI.
FUNCTION
- parse_gemini_uri URI
-
The parse_gemini_uri function accepts a URI and returns one of the two following lists:
undef, "error message"; # error [ $host, $port, $path, $query, $fragment ], undef; # success
It is used internally by the new method. It is not exported by default.
BUGS
None known. But it is a rather incomplete module; that may be considered a bug?
SEE ALSO
gemini://gemini.circumlunar.space/docs/specification.gmi (v0.16.1)
RFC 3986
COPYRIGHT AND LICENSE
Copyright 2022 Jeremy Mates
This program is distributed under the (Revised) BSD License: https://opensource.org/licenses/BSD-3-Clause