Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the SVN-Notify CPAN distribution.

Report information
The Basics
Id: 35425
Status: resolved
Priority: 0/
Queue: SVN-Notify

People
Owner: Nobody in particular
Requestors: LARRYSH [...] cpan.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.72



Subject: Add filters for pre/post execute and prepare.
It would be handy if a filter can be called for before and after an execute and prepare call is made. Attached is a quick change that implements this change, with some documentation.
Subject: svnnotify.patch
Index: Notify.pm =================================================================== --- Notify.pm (revision 3669) +++ Notify.pm (working copy) @@ -999,11 +999,13 @@ sub prepare { my $self = shift; + $self->run_filters(pre_prepare => ""); $self->prepare_recipients; return $self unless @{ $self->{to} }; $self->prepare_contents; $self->prepare_files; $self->prepare_subject; + $self->run_filters(post_prepare => ""); } ############################################################################## @@ -1272,6 +1274,7 @@ sub execute { my $self = shift; + $self->run_filters(pre_execute => ""); $self->_dbpnt( "Sending message") if $self->{verbose}; return $self unless @{ $self->{to} }; @@ -1290,6 +1293,7 @@ close $out or warn "Child process exited: $?\n"; $self->_dbpnt( 'Message sent' ) if $self->{verbose}; + $self->run_filters(post_execute => ""); return $self; } Index: Notify/Filter.pm =================================================================== --- Notify/Filter.pm (revision 3669) +++ Notify/Filter.pm (working copy) @@ -107,6 +107,11 @@ slightly different format than documented here. Consult the documentation for the relevant methods in those classes for details. +There are four special filter subroutines that are called before and after +calling prepare and execute, named C<pre_prepare>, C<post_prepare>, +C<pre_execute>, and C<post_execute>. Their return value is ignored, and only +an empty string is passed in as the second argument. + The package name of the filter module can be anything you like; just pass it via the C<filter> parameter, e.g., C<< filter => [ 'My::Filter' ] >> (or C<--filter My::Filter> on the command-line). If, however, it's in the
Subject: Re: [rt.cpan.org #35425] Add filters for pre/post execute and prepare.
Date: Fri, 25 Apr 2008 16:22:48 -0700
To: bug-SVN-Notify [...] rt.cpan.org
From: "David E. Wheeler" <david [...] kineticode.com>
On Apr 25, 2008, at 09:04, Larry Shatzer, Jr. via RT wrote: Show quoted text
> It would be handy if a filter can be called for before and after an > execute and prepare call is made. Attached is a quick change that > implements this change, with some documentation.
Thanks. I've committed this and reorganized the table of filter types in SVN::Notify::Filter so that they are now listed in the order in which they execute. I'll release a new version by Monday. Best, David