Bot-WootOff

 view release on metacpan or  search on metacpan

WootOff.pm  view on Meta::CPAN

###########################################
###########################################
package Bot::WootOff;
###########################################
###########################################
use strict;
use warnings;
use HTTP::Request::Common qw(GET);
use POE qw(Component::Client::HTTP);
use Log::Log4perl qw(:easy);

our $VERSION = "0.09";

###########################################
sub new {
###########################################
  my($class, %options) = @_;

  my $self = {
    irc_server       => "irc.freenode.net",
    irc_channel      => "#wootoff" . sprintf("%04d", int(rand(1000))),
    irc_nick         => "wootbot",
    http_alias       => "wootoff-ua",
    http_timeout     => 60,
    http_max_retries => 30,
    poll_interval    => 30,
    Alias            => "wootoff-bot",
    spawn            => 1,
    last_msg         => undef,
    %options,
  };

  bless $self, $class;

  $self->{http_agent} = $self->agent() unless defined $self->{http_agent};
  $self->{http_url}   = $self->woot_url() unless defined $self->{http_url};

  # Start it up automatically.
  $self->spawn() if $self->{spawn};

  return $self;
}

###########################################
sub woot_url {
###########################################
    my($self) = @_;

    return "http://www.woot.com";
}

###########################################
sub agent {
###########################################
    my($self) = @_;

    return(__PACKAGE__ . "/" . $VERSION),
}

###########################################
sub spawn {
###########################################
  my($self) = @_;

  $self->{bot} = Bot::WootOff::Glue->new(
    server   => $self->{irc_server},
    channels => [ $self->{irc_channel} ],
    nick     => $self->{irc_nick},



( run in 0.963 second using v1.01-cache-2.11-cpan-39bf76dae61 )