NAME

Data::Identifier::Interface::Userdata - format independent identifier object

VERSION

version v0.14

SYNOPSIS

use parent 'Data::Identifier::Interface::Userdata';

(since v0.14, experimental)

Interface for modules implementing userdata().

Note: This interface is experimental. Details may change or it may be removed completely.

METHODS

userdata

my $value = $obj->userdata(__PACKAGE__, $key);
$obj->userdata(__PACKAGE__, $key => $value);

Get or set user data to be used with this object. The data is stored using the given $key. The package of the caller is given to provide namespaces for the userdata, so two independent packages can use the same $key.

The meaning of $key, and $value is up to __PACKAGE__.

The default implementation uses "_userdata_provider" as a backend for storage.

_userdata_provider

my $userdata = $obj->_userdata_provider;

This method is used by the default implementation of "userdata". It provides the backend storage for userdata.

For every passed object it returns an instance of a hashref (initially empty) that is kept inside the object.

The default implementation expects the object to be a (blessed) hashref. It uses the key userdata to store the hashref. It is equivalent to:

return $obj->{userdata} //= {};

If "userdata" is overridden this method can stay unimplemented.

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)