NAME

Data::URIID::Result - Extractor for identifiers from URIs

VERSION

version v0.01

SYNOPSIS

use Data::URIID;

my $extractor = Data::URIID->new;
my $result = $extractor->lookup( $URI );

OO METHODS

extractor

my $extractor = $result->extractor;

Returns the Data::URIID object used to create this object.

id_type

my $id_type = $result->id_type;

This method will return the ISE of the id's type if successful or die otherwise.

id

my $id = $result->id;
# or:
my $id = $result->id( $type );

This method will return the id if successful or die otherwise.

ise

my $ise = $result->ise;

This method will return the ISE if successful or die otherwise.

attribute

my $ise = $result->attribute( $key, [%opts] );

Get a attribute of the result or the default or die. Attributes are subject to the settings passed to "new" in Data::URIID. The default can be supplied via the default option (see below).

The following attributes are defined:

action

The action the original URL was using.

altitude

The altitude of the item. The reference system is not specified.

description

A description of the subject.

displaycolour

A colour that is commonly used to display alongside the item.

displayname

A name that can be used to display the subject to the user.

icon

An icon for the item.

icon_text

A one character alternative to the icon. This character may be any unicode character. This also implies that a) the width of the character may vary, b) may use characters outside the range of any 8 bit encoding.

latitude

The latitude of the item. The reference system is not specified.

longitude

The longitude of the item. The reference system is not specified.

service

The Data::URIID::Service the original URL was using.

space_object

The object in space (astronomical body) this item is on.

thumbnail

A thumbnail image that can be used for the item.

The following options are defined:

as

Return the value as the given type. This is the package name of the type, string for plain perl strings, or ise for an ISE. If the given type is not supported for the given attribute the function dies.

default

Returns the given value if no value is found. This can also be set to undef to allow returning undef in case of no value found instead of die-ing.

language_tags

Overrides the default language tags from the $result->extractor object. May be an arrayref with a list of exact matches or a string that is parsed as a list (and supers being added).

url

my $url = $result->url;
# or:
my $url = $result->url( $service );
my $url = $result->url( service => $service ); # the same
# or:
my $url = $result->url( %options );

Returns a URL for the resource on a given service. If no service is given the value returned by $result->attribute('service') is used.

This method will return a URL (URI object) if successful or die otherwise.

The following options are defined:

action

Returns an URL for the given action. Defaults to $result->attribute('action').

service

Returns an URL for the given service. May be an service name, or Data::URIID::Service object. Defaults to $result->attribute('service').

language_tags

Overrides the default language tags from the $result->extractor object. May be an arrayref with a list of exact matches or a string that is parsed as a list (and supers being added).

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)