Announcement: the App-Notifier CPAN Distributions

I would like to announce two new CPAN distributions of mine: App-Notifier-Service and App-Notifier-Client. These are derived from a few simplistic scripts I've written in shell and Perl, to allow me to notify when a task has finished (e.g: make ; finish-client) or a certain time has elapsed (e.g: sleep 240 ; finish-client), and I decided to create something more serious as CPAN modules.

App-Notifier-Service implements an HTTP service (using Dancer), which listens for requests, and once one arrives, implements a callback, which notifies the user on the localhost that the event occured. App-Notifier-Client complements it by implementing a client that connects to the service and sends the event.

Currently documentation may be lacking, and there are almost no automated tests in the distributions, but it appears to work nicely. To get started, read the documentation and you may wish to peruse some of these files from my home directory. First of all, the .app_notifier.yml file:

commands:
    default:
        - /home/shlomif/bin/desktop-finish-cue
    cookie:
        - /home/shlomif/bin/desktop-finish-cue
        - "--song"
        - "/home/music/Music/dosd-mp3s/Cookie.mp3"
client:
    targets:
        default:
            url: "http://localhost:6300/"
        lap:
            url: "http://lap.shlomifish.org:6300/"

The desktop-finish-cue file:

#!/bin/bash

song="/home/music/Music/dosd-mp3s/Theme - Eurovision.mp2"

param="$1"
shift
if test "$param" = "--song"; then
    arg="$1"
    shift
    song="$arg"
fi

xmessage "Your task has been finished! Go check it out." &
mplayer "$song"

And the finish-server script:

#!/bin/bash
cd "$HOME"/progs/perl/alert/http-based/hg/App-Notifier-Service &&
    perl ./bin/app.pl --port=6300

Otherwise, if you're in the Tel Aviv or vicinity, you are invited to the next Tel Aviv Perl Mongers meeting on Wednesday, 25 July 2012. Otherwise, I wish to note that I have written my first Java golf program as part of Anarchy golf's "Alphabet Texture" challenge (Anarchy golf accepts challenges in many languages). At 167 bytes, it is over 3 times longer than the shortest Perl entry which is only 50 bytes (my Perl solution is 52 bytes). But it was fun to write. For your information, code golf is a challenge in which, participating programmers are challenged to write the shortest program that achieves a certain objective. I find it fun and addictive.

Leave a comment

About Shlomi Fish

user-pic An Israeli software developer, essayist, and writer, and an enthusiast of open/free software and cultural works. I've been working with Perl since 1996.