Fink::Notify(3) Fink documentation Fink::Notify(3)NAMEFink::Notify - functions for notifying the user out-of-band
DESCRIPTIONFink::Notify is a pluggable system for notifying users of events that
happen during package installation/removal.
SYNOPSIS
### a program that generates notifications
use Fink::Notify;
my $notifier = Fink::Notify->new('Growl');
$notifier->notify(
event => 'finkPackageInstallationPassed',
description => 'Installation of package [foo] passed!',
);
### a module implementing a notifier type
# all notifier modules must reside under the Fink::Notify namespace
package Fink::Notify::NotifierClass;
# all notifier modules must be subclasses of Fink::Notifier
use Fink::Notifier;
@ISA = qw(Fink::Notifier);
sub new {
my class = shift;
return bless {}, $class;
}
sub about {
my @about = ("NotifierClass", "1.1", "Short Description", "URL");
return wantarray? @about : \@about;
}
sub do_notify {
my $self = shift;
my %args = @_;
print "Alert: $args{event}: $event{title}\n";
print "\t$args{description}\n" if defined $args{description};
return 1;
}
METHODS
new([PluginType]) - get a new notifier object
Get a new notifier object, optionally specifying the notification
plugin to use. If one is not specified, it will use the default
plugin specified in the user's fink.conf. The returned object is
that of the specific notifier itself, not the class of the new()
here.
Notifier modules must provide a new() method that returns a blessed
ref for their object.
events() - the list of supported events
The default events are:
· finkPackageBuildPassed - build phase has completed
· finkPackageBuildFailed - build phase has failed
· finkPackageInstallationPassed - install phase has completed
· finkPackageInstallationFailed - install phase has failed
· finkPackageRemovalPassed - deactivation phase has completed
· finkPackageRemovalFailed - deactivation phase has failed
· finkDonePassed - fink is done running and is exiting
· finkDoneFailed - fink is done running and is exiting non-zero
Notifier modules may supply an alternate list of supported events
by providing their own events() method.
Event names should follow the form [origin][EventType][Status],
where:
· origin
The program that generated the notification.
· EventType
The program's event, action, or mode leading to the
notification.
· Status
Either "Passed" or "Failed", indicating the result of the
event, action, or mode.
notify(%args) - notify the user of an event (public interface)
$notifier->notify(
event => 'finkPackageInstallationFailed',
title => 'Holy cow! Something bad happened!',
description => 'Something really bad has occurred, while installing foo.',
);
Supported Arguments:
· event
The event name to notify on: values as declared in
$notifier->events().
· description
The plain-text description of what has occurred.
· title (optional)
The title of the event.
This method is the public interface for requesting a notification.
about() - about the output plugin
This method returns the name and version of the output plugin
currently loaded. The return either as a list (notifier-type,
version, short description, URL) or a ref to that list, depending
on caller context.
Notifier modules must provide an about() method that returns data
for their module.
do_notify(%args) - perform a notification (notifier-specific)
Notifier modules must provide a do_notify() method that implements
their notification scheme. The %args parameters are the same as for
notify().
list_plugins() - list the available notification plugins
This method will list the available notification plugins for
Fink::Notify to use.
Fink 0.36.3.1 2013-12-30 Fink::Notify(3)