NAME

Data::URIID - Extractor for identifiers from URIs

VERSION

version v0.01

SYNOPSIS

use Data::URIID;

my $extractor = Data::URIID->new;

my $result = $extractor->lookup( $uri );

my $id = $result->id( $type );

METHODS

new

my $extractor = Data::URIID->new;
# or:
my $extractor = Data::URIID->new( option => value, ... );

Returns a new object that can be used for lookups. The following options are defined:

agent

User agent string to use if no ua is given.

This should be set to something of valid user agent string syntax that reflects your application and contains contact details.

default_online

Boolean indicating whether online operation is allowed by default.

Default false. See also "default_online".

language_tags

An arrayref with all acceptable language tags (most acceptable first).

Default [I18N::LangTags::implicate_supers(I18N::LangTags::Detect::detect())] See also "language_tags", I18N::LangTags, and I18N::LangTags::Detect Note: If you perform online lookups and passed a user agent via ua it must also reflect this setting.

online

Boolean indicating whether online operations are permitted.

Default false. See also "online".

ua

Useragent to use (LWP::UserAgent).

lookup

my $result = $extractor->lookup( $uri );
# or:
my $result = $extractor->lookup( $type, $uri );

Tries to look up the URI and returns the result. Takes an URI object or a plain string as argument.

$type is one of uri, ise, or qrcode. Defaults to uri. When ise an UUID or OID can be provided instead of an URI. When qrcode the text content from an QR code can be provided.

This method will return a Data::URIID::Result if successful or die otherwise.

online

my $online = $extractor->online( [ $new_value ] );

Gets or sets the online status of extractor. If this value is false no online operations are permitted. In addition to this value being true the online value for the services that should perform lookups need to be true.

See also "default_online".

default_online

my $online = $extractor->default_online( [ $new_value ] );

Gets or sets the default online value for Data::URIID::Service objects returned by "service". This value is only used if the service has not yet been accessed. Therefore it is often unsafe to alter this value. The corresponding "new" option should be used.

See also "online".

language_tags

my @language_tags = $extractor->language_tags( [ @new_value ] );

Gets or sets the list of acceptable language tags.

See also "new".

UTILITY METHODS

known

my $ise = $extractor->name_to_ise( $class );

Returns a list of known items of a class. Not all items may have the same level of support by this module. Class is one of service, type, or action.

This method will return an array of ISEs if successful or die otherwise.

name_to_ise

my $ise = $extractor->name_to_ise( $class => $name );

Tries to lookup an ISE for a given well known name. Class is one of service, type, or action.

This method will return an ISE if successful or die otherwise. This is the reverse of "ise_to_name".

ise_to_name

my $name = $extractor->ise_to_name( $class => $ise );

Tries to lookup a name for a given well known ISE. Class is one of service, type, or action.

This method will return a name if successful or die otherwise. This is the reverse of "name_to_ise".

is_ise

my $bool = $extractor->is_ise( $str );

Returns whether or not a string is a valid ISE.

service

my $service = $extractor->service( $service );

This method will return a Data::URIID::Service for the given name or ISE if successful or die otherwise.

AUTHOR

Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)