App-RoboBot
view release on metacpan or search on metacpan
lib/App/RoboBot/Nick.pm view on Meta::CPAN
package App::RoboBot::Nick;
$App::RoboBot::Nick::VERSION = '4.004';
use v5.20;
use namespace::autoclean;
use Moose;
use MooseX::ClassAttribute;
use MooseX::SetOnce;
has 'id' => (
is => 'rw',
isa => 'Int',
traits => [qw( SetOnce )],
predicate => 'has_id',
);
has 'name' => (
is => 'rw',
isa => 'Str',
predicate => 'has_name',
);
has 'extradata' => (
is => 'rw',
isa => 'HashRef',
default => sub { {} },
);
has 'denied_functions' => (
is => 'ro',
isa => 'HashRef',
default => sub { {} },
writer => '_set_denied_functions',
);
has 'config' => (
is => 'ro',
isa => 'App::RoboBot::Config',
required => 1,
);
has 'network' => (
is => 'ro',
isa => 'App::RoboBot::Network',
predicate => 'has_network',
);
class_has 'log' => (
is => 'rw',
predicate => 'has_logger',
);
sub BUILD {
my ($self) = @_;
$self->log($self->config->bot->logger('core.nick')) unless $self->has_logger;
$self->log->debug('Nick object construction requested.');
unless ($self->has_id) {
die $self->log->fatal('Invalid nick object creation (missing both ID and name).') unless $self->has_name;
my $res = $self->config->db->do(q{
select id
( run in 0.514 second using v1.01-cache-2.11-cpan-39bf76dae61 )