如何禁用svnnotify的Perl警告?

Vnu*_*nuk 1 perl

我正在使用svnnotify.它工作(发送电子邮件和所有)但它总是输出一些错误消息,如

Use of uninitialized value in substr at /usr/lib/perl5/site_perl/5.8.8/SVN/Notify.pm line 1313.
substr outside of string at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1313.
Use of uninitialized value in index at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1313.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1314.

我试过运行它> /dev/null但没有运气.我试过运行它> bla,文件bla出现空白,输出显示在屏幕上.由于svnnotify没有安静的开关,我该怎么办呢?

bri*_*foy 8

当没有提交的日志消息时,看起来会发生这种情况.某些用户可能需要使用LART会话来解决此问题.除此之外,正确的做法是修复SVN :: Notify模块并将补丁提交到SVN :: Notify RT队列,但为时已晚,我已经提交了故障单.

这是补丁:

diff --git a/lib/SVN/Notify.pm b/lib/SVN/Notify.pm
index 3f3672b..5387dd2 100644
--- a/lib/SVN/Notify.pm
+++ b/lib/SVN/Notify.pm
@@ -1308,7 +1308,7 @@ sub prepare_subject {
     }

     # Add the first sentence/line from the log message.
-    unless ($self->{no\_first\_line}) {
+    if (!$self->{no\_first\_line} and defined $self->{message}[0] and length $self->{message}[0] )
         # Truncate to first period after a minimum of 10 characters.
         my $i = index substr($self->{message}[0], 10), '. ';
         $self->{subject} .= $i > 0

我认为这会照顾警告,但我怀疑它只是一个创可贴,因为周围的设计$self->{no\_first\_line}似乎很狡猾.

  • 对于可能没有听说过LART的其他人的费用:http://catb.org/jargon/html/L/LART.html (2认同)