NAME

Data::Identifier::Util - format independent identifier object

VERSION

version v0.23

SYNOPSIS

use Data::Identifier::Util;

my Data::Identifier::Util $util = Data::Identifier::Util->new;

(since v0.23)

This package contains some utilty methods that are left out of Data::Identifier to keep that module slim.

This package inherits from Data::Identifier::Interface::Userdata (since v0.23), and Data::Identifier::Interface::Subobjects (since v0.23).

METHODS

new

my Data::Identifier::Util $util = Data::Identifier::Util->new;

(since v0.23)

Creates a new instance that can be used to call the different methods.

pack

my $packed = $util->pack($template => $identifier);
# e.g.:
my $packed = $util->pack(sid16 => $identifier);

(since v0.23)

This method can be used to pack identifiers into a (binary) format using a template. This is similar to "pack" in perlfunc.

$identifier is a Data::Identifier, or if not is converted to one using "new" in Data::Identifier with from.

The following templates are currently supported:

{sid|sni|hdi|udi}{8|16|32}

(since v0.23)

An small-identifier, sirtx-numerical-identifier, host-defined-identifier, or user-defined-identifier packed as 8, 16, or 32 bit value (in network byte order).

4+12

(since v0.23)

An small-identifier, sirtx-numerical-identifier, host-defined-identifier, or user-defined-identifier packed in the 4 bit prefix plus 12 bit identifier format. The prefix to be used is automatically selected. This module might make better decisions if Data::Identifier::Wellknown is loaded with the corresponding classes, and/or if a Data::TagMap is given via "so_attach" in Data::Identifier::Interface::Subobjects.

uuid128

(since v0.23)

An UUID as 128 bit (16 byte).

unpack

my Data::Identifier $identifier = $util->unpack($template => $packed);
# e.g.:
my Data::Identifier $identifier = $util->unpack(sid32 => $packed);
# or:
my Data::Identifier $identifier = $util->unpack('4+12' => $packed);

(since v0.23)

This method unpacks an identifier from a (binary) format using a template. This undoes what "pack" does. The same rules apply. See there for details.

Note: As of v0.23 this module expects $packed to have the correct length. Later versions of this module may add a mode in which trailing data in $packed might be allowed.

parse_sirtx

my Data::Identifier $identifier = $util->parse_sirtx($value);

(experimental since v0.23)

This methods tries to decode the given $value as a SIRTX identifier string. This method is limited in it's capabilities in that it does not support the full syntax, as well as it does not have any database or context as a data source.

See also "tag_by_specification" in Data::TagDB with style => 'sirtx'.

This might might support more values if Data::Identifier::Wellknown is loaded with the corresponding classes, and/or if a Data::TagMap is given via "so_attach" in Data::Identifier::Interface::Subobjects.

AUTHOR

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

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)