CVSROOT: cvslog.pl - fix subroutine redefine when module is present

glen glen at pld-linux.org
Wed May 7 18:40:47 CEST 2008


Author: glen                         Date: Wed May  7 16:40:47 2008 GMT
Module: CVSROOT                       Tag: HEAD
---- Log message:
- fix subroutine redefine when module is present

---- Files affected:
CVSROOT:
   cvslog.pl (1.78 -> 1.79) 

---- Diffs:

================================================================
Index: CVSROOT/cvslog.pl
diff -u CVSROOT/cvslog.pl:1.78 CVSROOT/cvslog.pl:1.79
--- CVSROOT/cvslog.pl:1.78	Wed May  7 18:21:55 2008
+++ CVSROOT/cvslog.pl	Wed May  7 18:40:42 2008
@@ -35,14 +35,16 @@
 		$withthreading_email $messageid_email $mail_contenttransen $old_cmdargs);
 
 # encode rfc822 email header
-eval {
-  require MIME::Words;
-  import MIME::Words;
-};
-if ($@) {
-  sub MIME::Words::encode_mimewords {
-	return $_[0];
-  }
+sub encode_header {
+	eval {
+		require MIME::Words;
+		import MIME::Words;
+	};
+	if ($@) {
+		goto sub { $_[0] }
+	} else {
+		goto &MIME::Words::encode_mimewords;
+	}
 }
 
 ### Configuration
@@ -387,7 +389,7 @@
 $subj = substr($subj, 0, $subj_maxlength-3) . '...' if (length($subj) > $subj_maxlength);
 my $keywords="DEV-$user, MOD-$module, TAG-".($tag?$tag:"HEAD").", ". $subj_file_list;
 
-$subj = MIME::Words::encode_mimewords($subj, $charset);
+$subj = encode_header($subj, Charset => $charset);
 
 print MAIL <<EOM;
 From: $from_email
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/cvslog.pl?r1=1.78&r2=1.79&f=u



More information about the pld-cvs-commit mailing list