package Log::Dispatch::Twitter;
use strict;
use warnings;

use Net::Twitter;
use Log::Dispatch::Output;

use base qw(Log::Dispatch::Output);
use vars qw($VERSION);

$VERSION = "0.01"; # and no further shall it ever go...

sub new {
  my $proto = shift;
  my $class = ref $proto || $proto;
  my %p     = @_;
  my $self  = bless {}, $class;

  $self->{'twitter'} = Net::Twitter->new(
                                  username => "username",
                                  password => "password"
                                 );

  $self->_basic_init(%p);
  return $self;
}


sub log_message {
  my $self = shift;
  my %p = @_;

  $self->{'twitter'}->update($p{message});
}

##########################################################################

# Small driver script

#use Log::Dispatch;
#use Log::Dispatch::Twitter;
#my $tl = Log::Dispatch::Twitter->new(
#                                      name => 'TwitterLog',
#                                      min_level => 'error'
#                                    );

#$tl->log( level => 'emerg', message => 'Bob made me do it 27');
