#!/usr/bin/env perl use strict; use warnings; use Capture::Tiny qw(capture); use constant { NEWSBOAT_PATH => 'newsboat', NOTIFYSEND_PATH => 'herbe' }; sub notify { my ($str) = @_; my $pid = fork(); if (not $pid) { exec(NOTIFYSEND_PATH, $str); } return; }; sub main { my $stdout; my $nb; $nb = NEWSBOAT_PATH; if (system( $nb, '-x', 'reload' ) != 0) { exit 1; } $stdout = qx($nb -x print-unread); $stdout =~ s/\s.+//; chomp $stdout; if ($stdout != 0) { notify(' ' . $stdout . ' new articles'); } return; } main(); __END__