App-TimeTracker-Command-TellSlack
view release on metacpan or search on metacpan
lib/App/TimeTracker/Command/TellSlack.pm view on Meta::CPAN
error_message( 'tell_slack.url not defined in config, cannot post to slack' );
return;
}
my $ua = LWP::UserAgent->new( timeout => 3 );
my $message
= $task->user
. ( $status eq 'start' ? ' is now' : ' stopped' )
. ' working on '
. $task->say_project_tags;
my $request = HTTP::Request->new(POST=>$cfg->{url});
my $payload = {
text=>$message
};
$payload->{username} = $cfg->{username} if $cfg->{username};
$request->content(decode_utf8(encode_json($payload)));
my $res = $ua->request($request);
unless ( $res->is_success ) {
error_message( 'Could not post to slack: %s',
( run in 1.208 second using v1.01-cache-2.11-cpan-de7293f3b23 )