NAME

User::Information::Base - generic module for extracting information from user accounts

VERSION

version v0.04

SYNOPSIS

use User::Information;

This module allows extracting information on user accounts.

This package inherits from Data::Identifier::Interface::Userdata, and Data::Identifier::Interface::Known.

Class paths can be used to discover paths for "get". See "known" in Data::Identifier::Interface::Known for details.

METHODS

attach

$base->attach(key => $obj, ...);
# or:
$base->attach(key => $obj, ..., weak => 1);

Attaches objects of the given type.

The following types objects are supported: db (a Data::TagDB), extractor (a Data::URIID), fii (a File::Information), and store (a File::FStore).

If an object is allready attached for the given key this method dies unless the object is actually the same.

If weak is set to a true value the object reference becomes weak.

Returns itself.

get

my $value = $base->get($path, %opts);
# or:
my @value = $base->get($path, %opts, list => 1);

Gets the value of a property. $path is a User::Information::Path.

If the value is known, supported, or any other error occurs this method dies.

The following, all optional, options are supported:

default

The default value used when there is no value for the given propery or the propery is not known. This can be set to undef (list being false) or [] (list being true) to switch this method from dieing to returning undef or a empty list.

list

Whether the method should return a list.

as

The type to use for the values. This can be a package name or raw.

no_defaults

This option is ignored for compatibility.

node

my User::Information::Base $node = $base->node(%opts);

Returns the node the subject this object represents is on. dies if no node is known or supported.

The following, all optional, options are supported:

default

The default value used when there is no value for the given propery or the propery is not known. This can be set to undef to switch this method from dieing to returning undef.

no_defaults

This option is ignored for compatibility.

displayname

my $displayname = $base->displayname;

Proxy, basically calls $base->get(['aggregate' => 'displayname'], %opts).

However a default is enforced unless no_defaults is set.

See also: "get".

file

my $filename = $base->file($path, %opts);
# or:
my $fh = $base->file($path, open => ..., %opts);

This is a helper to work with values that are filenames. The method allows finding a working file (or directory), appending path components, and opening.

$path is the same as in "get".

The following, all optional, options are supported:

extra

Extra path components (arrayref) to append to the filename. If only one path component is to be added this can also be a plain string (not a ref). This form however must not be used with multiple elements (e.g. embedded slashes).

directory

A boolean value that if true indicates that the final filename refers to a directory. This is important as plain files and directories are handled differently on some systems.

open

If set tries to open the file (or directory). The value is one of 'r', 'w', or 'a'. An optional 'b' may be added which changes the default for binmode to be true.

binmode

Whether or not "binmode" in perlfunc is called on the newly open file handle. Defaults to false.

AUTHOR

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

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)