View on
David Caldwell > Darcs-Notify-2.0.1 > Darcs::Notify



Annotate this POD


Open  0
View/Report Bugs
Module Version: 2.0.1   Source  


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


 use Darcs::Notify;
 $n = Darcs::Notify->new(repo => "/path/to/my/repo",
                         Email => { # Autoloads Darcs::Notify::Email
                                    to => ["",
                                    smtp_server => "" });

 # 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 => ["",
                               smtp_server => "" },
                    IRC => { # Autoloads Darcs::Notify::IRC (if you have it)
                             server =>,
                             channel => "#darcs_notify" })


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.


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 => "" }

This will cause Darcs::Notify to try to load Darcs::Notify::Email. If that succeeds it will call Darcs::Notify::Email->new(smtp_address => "") 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.


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.


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


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


David Caldwell <>

syntax highlighting: