Adam
view release on metacpan or search on metacpan
ex/rt-plugin.pl view on Meta::CPAN
has rt => (
isa => 'RT::Client::REST',
is => 'ro',
lazy_build => 1,
handles => { show_ticket => [ 'show', ( type => 'ticket' ) ] },
);
sub _build_rt {
my $rt = RT::Client::REST->new( server => $_[0]->server );
$rt->login( username => $_[0]->user, password => $_[0]->pass, );
return $rt;
}
sub ticket {
my ( $self, $id ) = @_;
try {
if ( my $t = $self->show_ticket( id => $id ) ) {
return "$$t{Status} #${id}: $$t{Subject}";
}
return "Ticket $id not found";
lib/Adam.pm view on Meta::CPAN
isa => 'Str',
accessor => 'get_username',
traits => ['Getopt'],
cmd_flag => 'username',
builder => 'default_username',
);
sub default_username { 'adam' }
has password => (
isa => 'Str',
accessor => 'get_password',
traits => ['Getopt'],
cmd_flag => 'password',
builder => 'default_password',
);
sub default_password { '' }
has flood => (
isa => 'Bool',
reader => 'can_flood',
traits => ['Getopt'],
cmd_flag => 'flood',
builder => 'default_flood',
);
lib/Adam.pm view on Meta::CPAN
sub _build__irc {
my $self = shift;
POE::Component::IRC::State->spawn(
Nick => $self->get_nickname,
Server => $self->get_server,
Port => $self->get_port,
Ircname => $self->get_nickname,
Options => $self->get_poco_irc_options,
Flood => $self->can_flood,
Username => $self->get_username,
Password => $self->get_password,
%{ $self->get_poco_irc_args },
);
}
sub privmsg {
my $self = shift;
POE::Kernel->post( $self->irc_session_id => privmsg => @_ );
}
lib/Adam.pm view on Meta::CPAN
=head2 owner
The hostmask of the owner of the bot. The owner can control the bot's plugins
through IRC using the L<POE::Component::IRC::Plugin::PlugMan> interface.
=head2 username
The username to use for IRC connection. Defaults to C<adam>.
=head2 password
The server password to use for IRC connection. Defaults to empty string.
=head2 flood
Disable flood protection. Defaults to C<0> (false).
=head2 plugins
A HashRef of plugins associated with the IRC bot. See L<Moses::Plugin> for more
details.
lib/Moses.pm view on Meta::CPAN
with_caller => [
qw(
nickname
server
port
channels
plugins
username
owner
flood
password
poco_irc_args
poco_irc_options
)
],
also => [qw(MooseX::POE)],
);
sub init_meta {
my ( $class, %args ) = @_;
lib/Moses.pm view on Meta::CPAN
}
sub username {
my ( $caller, $username ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_username' => sub { return $username } );
}
sub password {
my ( $caller, $password ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_password' => sub { return $password } );
}
sub flood {
my ( $caller, $flood ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_flood' => sub { return $flood } );
}
lib/Moses.pm view on Meta::CPAN
plugins MyPlugin => 'MyBot::Plugin::Foo';
Extra L<POE::Component::IRC::Plugin> objects or class names to load into the bot.
=head2 username
username 'mybot';
The username to use for IRC connection.
=head2 password
password 'secret';
The server password to use for IRC connection.
=head2 flood
flood 1;
Disable flood protection. Defaults to false.
=head2 owner
owner 'nick!user@host';
lib/oses.pm view on Meta::CPAN
oses - A shortcut in the fashion of oose.pm
=head1 VERSION
version 1.003
=head1 SYNOPSIS
perl -Ilib -Moses=T -MNet::Twitter -e'event irc_public=>sub {
Net::Twitter->new(username=>$ARGV[0],password=>$ARGV[1])->update($_[ARG2])
};T->run'
=head1 DESCRIPTION
A source filter shortcut module in the fashion of C<oose.pm> that automatically
adds a package declaration and C<use Moses;> to your code.
=head1 SUPPORT
=head2 Issues
t/02.override.t view on Meta::CPAN
sub _build__irc {
POE::Component::IRC::Qnet::State->spawn(
Nick => $_[0]->get_nickname,
Server => $_[0]->get_server,
Port => $_[0]->get_port,
Ircname => $_[0]->get_nickname,
Options => $_[0]->get_poco_irc_options,
Flood => $_[0]->can_flood,
Username => $_[0]->get_username,
Password => $_[0]->get_password,
%{ $_[0]->get_poco_irc_args },
);
}
}
my $bot = QnetBot->new();
is(
ref $bot->irc,
'POE::Component::IRC::Qnet::State',
( run in 2.168 seconds using v1.01-cache-2.11-cpan-f56aa216473 )