#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use utf8::all;
use autodie qw(:all);
use Exobrain;
use WebService::Idonethis;
use POSIX qw(strftime);
# PODNAME: idone-send
# ABSTRACT: Send personal log events to iDoneThis
use constant DEBUG => 0;
my $exobrain = Exobrain->new;
my $config = $exobrain->config->{Idonethis};
my $user = $config->{user} or die "Can't find Idonethis/user";
my $pass = $config->{pass} or die "Can't find Idonethis/pass";
my $idone = WebService::Idonethis->new(
user => $config->{user},
pass => $config->{pass},
);
$exobrain->watch_loop(
class => 'Intent::PersonalLog',
then => \&log_this,
);
sub log_this {
my $event = shift;
my $text = $event->summary;
$idone->set_done(
text => $event->summary,
date => strftime("%Y-%m-%d", localtime( $event->timestamp )),
);
# Also confirm that we've logged this.
$exobrain->notify("Logged: $text",
priority => -1,
);
}
__END__
=pod
=head1 NAME
idone-send - Send personal log events to iDoneThis
=head1 VERSION
version 0.06
=head1 AUTHOR
Paul Fenwick <pjf@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Paul Fenwick.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut