View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
David Caldwell > Darcs-Notify-2.0.1 > Darcs::Notify::Base



Annotate this POD


Open  0
View/Report Bugs


Darcs::Notify::Base - Base class for notifiers


 package Darcs::Notify::MySubclass;
 use Darcs::Notify::Base;
 use base 'Darcs::Notify::Base';

 sub notify($$$$) {
     my ($self, $notify, $new, $unpull) = @_;
     print $self->{option1}, "\n";
     print $notify->repo_name, "\n";
     print "Added patches:\n";
     print "$_" for (@{$new});
     print "Unpulled patches:\n";
     print "$_" for (@{$unpull});

 use Darcs::Notify;
 Darcs::Notify->new(MySubclass => { option1 => 1,
                                    option2 => 2 })


This is the base class for making custom Darcs::Notify notifiers. Subclass this and make sure that your package name is in the Darcs::Notify hierarchy. Pass the last part of your package name to Darcs::Notify->new() to have it use your package. If your package is called Darcs::Notify::Something then you would pass something like Something => { my_option1 => 1, my_option2 => 2 }. Darcs::Notify->new() will load your subclass if it is not already loaded and call its new() function with the option hash that was passed to it.



This instantiates your object. Generally you won't need to override this class, but you may want to in order to check that the options are valid, for instance.

The Darcs::Notify::Base->new() will put all the options passed to it into the $self blessed hash, but there is no requirement that your class has to work this way.

$self->notify($notify, [@new_patches], [@unpulled_patches])

This does the actual notifying. The subroutine defined in this module is just a stub and only prints some debugging information. Normally your subclass overrides this to do whatever notifications you'd like. See Darcs::Notify::Email which is the only subclass that comes with Darcs::Notify at the moment.

The first parameter passed is the $self hash ref. If you don't override the new() function, any options you pass to new() will end up in the $self hash ref.

The second parameter is a reference to the Darcs::Notify object. You can use this to query the repo_name, for instance.

The third parameter is a reference to an array of Darcs::Inventory::Patches that are new in the repository.

The fourth parameter is a reference to an array of Darcs::Inventory::Patches that have been unpulled (obliterated) from the repository.


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

I also recommend looking at the source code for Darcs::Notify::Email as it is a subclass of Darcs::Notify::Base.


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: