NAME

Data::Login::Role - Data object for login role.

SYNOPSIS

use Data::Login::Role;

my $obj = Data::Login::Role->new(%params);
my $action = $obj->action;
my $id = $obj->id;
my $role = $obj->role;

METHODS

new

my $obj = Data::Login::Role->new(%params);

Constructor.

  • active

    Active flag. It's boolean. Default value is 1.

  • id

    Id of record. Id could be number. It's optional. Default value is undef.

  • role

    Role name. Maximal length of value is 100 characters. It's required.

Returns instance of object.

active

my $active = $obj->active;

Get active flag.

Returns 0/1.

id

my $id = $obj->id;

Get login role record id.

Returns number.

role

my $role = $obj->role;

Get role name.

Returns string.

ERRORS

new():
        Parameter 'active' must be a bool (0/1).
                Value: %s
        Parameter 'id' must be a number.
                Value: %s
        Parameter 'role' has length greater than '100'.
                Value: %s
        Parameter 'role' is required.

EXAMPLE

use strict;
use warnings;

use Data::Login::Role;

my $obj = Data::Login::Role->new(
        'active' => 1,
        'id' => 2,
        'role' => 'admin',
);

# Print out.
print 'Active flag: '.$obj->active."\n";
print 'Id: '.$obj->id."\n";
print 'Role: '.$obj->role."\n";

# Output:
# Active flag: 1
# Id: 2
# Role: admin

DEPENDENCIES

Mo, Mo::utils.

REPOSITORY

https://github.com/michal-josef-spacek/Data-Login

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2023-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.02