[Bucardo-general] Patch, Added $self to input for custom code

Ben Allen bsa at lanl.gov
Tue Mar 24 04:41:55 UTC 2009


Forgot to include an example on how to use it from custom code:

my $send_mail = $result->{'sendmail'};
$send_mail->({ body => "$result->{warning}\n\n$dump", subject =>  
"Bucardo Exception" });

Regards,

Ben

On Mar 24, 2009, at 12:23 AM, Ben Allen wrote:

> Greg,
>
> Hows the attached patch for adding support for using the send_mail  
> sub in custom code. It makes an anonymous sub that calls $self- 
> >send_mail(@_). Then pass the reference of that new sub in $input.  
> If I just passed the ref \&send_mail, $self wasn't maintained, and  
> send_mail would fail.
>
> Regards,
>
> Ben
>
>
> <sendmail_customcode.patch>
> On Mar 23, 2009, at 3:55 PM, Greg Sabino Mullane wrote:
>
>> Ben Allen wrote:
>>> Attached is a patch that passes $self in the run_kid_custom_code
>>> function of Bucardo.pm in the $input hashref.
>>
>> I'm very wary of something like this, as it seems a huge footgun  
>> waiting to
>> happen. I'd be much happier having it pass something a little  
>> safer, such as
>> perhaps a coderef to the send_mail subroutine?
>>
>> -- 
>> Greg Sabino Mullane greg at endpoint.com
>> End Point Corporation
>> PGP Key: 0x14964AC8
>
>
> _______________________________________________
> Bucardo-general mailing list
> Bucardo-general at bucardo.org
> https://mail.endcrypt.com/mailman/listinfo/bucardo-general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090324/05d51a5e/attachment.html 


More information about the Bucardo-general mailing list