The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Darcs::Notify - Do something cool when a Darcs repository has patches added or removed

SYNOPSIS

 use Darcs::Notify;
 $n = Darcs::Notify->new(repo => "/path/to/my/repo",
                         Email => { # Autoloads Darcs::Notify::Email
                                    to => ["user1@example.com",
                                           "user2@example.com"],
                                    smtp_server => "smtp.example.com" });
 $n->notify;

 # If you have other plug-ins installed you can have many notifiers at once.
 Darcs::Notify->new(repo => "/path/to/my/repo",
                    Email => { # Autoloads Darcs::Notify::Email
                               to => ["user1@example.com",
                                      "user2@example.com"],
                               smtp_server => "smtp.example.com" },
                    IRC => { # Autoloads Darcs::Notify::IRC (if you have it)
                             server => irc.example.com,
                             channel => "#darcs_notify" })
     ->notify;

DESCRIPTION

Darcs::Notify compares the list of patches in a darcs repository against a saved backup copy (stored in the file _darcs/third-party/darcs-notify/old-inventory) and does "something cool and useful" when it detects added or removed patches. I'm being cagey about exactly what is done because Darcs::Notify lets you pass in arbitrary notification methods so that you can customize it to you liking. Darcs::Notify::Email is the quintessential notifier that sends email notifications to a list of email addresses.

Normal users will probably just want to use the command line script darcs-notify, which is a front end to Darcs::Notify and Darcs::Notify::Email.

FUNCTIONS

new(options, notifiers)

This creates a new Darcs::Notify object. All options and notifiers are passed in hash-style.

The options are:

repo => "/path/to/my/repo"

Path to the base of the target darcs repository. Don't point to the _darcs directory, that will be added for you.

repo_name => "my_repo"

By default &darcs_notify will guess the name of the repo from the path name. If you'd like to override its guess, pass in the repo_name parameter.

The notifiers are passed in the same way, but interpretted differently. Take the following notify parameter example:

    Email => { smtp_address => "smtp.example.com" }

This will cause Darcs::Notify to try to load Darcs::Notify::Email. If that succeeds it will call Darcs::Notify::Email->new(smtp_address => "smtp.example.com") and save the resulting object in its list of notifiers.

In this manner you can extend Darcs::Notify with arbitrary notification classes. See Darcs::Notify::Base for more info.

notify()

This does the actual notifying. It will compute the differences between the repo's current inventory and the last saved inventory and call the notify function of the notifiers that were registered in the new() function.

SEE ALSO

darcs-notify, Darcs::Notify::Base, Darcs::Notify::Email, Darcs::Inventory::Patch, Darcs::Inventory

COPYRIGHT

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Copyright (C) 2007-2009 David Caldwell

AUTHOR

David Caldwell <david@porkrind.org>