Adam
view release on metacpan or search on metacpan
lib/Moses.pm view on Meta::CPAN
}
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 } );
}
sub owner {
my ( $caller, $owner ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_owner' => sub { return $owner } );
}
sub poco_irc_args {
my ( $caller, %extra_args ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_poco_irc_args' => sub { return \%extra_args }
);
}
sub poco_irc_options {
my ( $caller, %options ) = @_;
my $class = Moose::Meta::Class->initialize($caller);
$class->add_method( 'default_poco_irc_options' => sub { return \%options }
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Moses - A framework for building IRC bots quickly and easily.
=head1 VERSION
version 1.003
=head1 SYNOPSIS
package SampleBot;
use Moses;
use namespace::autoclean;
server 'irc.perl.org';
nickname 'sample-bot';
channels '#bots';
has message => (
isa => 'Str',
is => 'rw',
default => 'Hello',
);
event irc_bot_addressed => sub {
my ( $self, $nickstr, $channel, $msg ) = @_[ OBJECT, ARG0, ARG1, ARG2 ];
my ($nick) = split /!/, $nickstr;
$self->privmsg( $channel => "$nick: ${ \$self->message }" );
};
# Run with POE (default)
__PACKAGE__->run unless caller;
# Or run with IO::Async (requires IO::Async::Loop::POE)
# __PACKAGE__->async unless caller;
=head1 DESCRIPTION
Moses is declarative sugar for building IRC bots based on the L<Adam> IRC bot
framework. Moses is designed to minimize the amount of work you have to do to
make an IRC bot functional, and to make the process as declarative as possible.
Bots can run in two modes: the default L<POE> event loop via C<run()>, or an
L<IO::Async> mode via C<async()> that enables integration with
L<IO::Async>-based components such as L<Net::Async::MCP> or
L<Net::Async::HTTP>. The async mode requires L<IO::Async::Loop::POE>.
=head2 nickname
nickname 'sample-bot';
Set the nickname for the bot. Defaults to the current package name.
=head2 server
server 'irc.perl.org';
Set the IRC server for the bot to connect to.
=head2 port
port 6667;
Set the port for the bot's server. Defaults to C<6667>.
=head2 channels
channels '#bots', '#perl';
Supply a list of channels for the bot to join upon connecting.
=head2 plugins
( run in 0.583 second using v1.01-cache-2.11-cpan-97f6503c9c8 )