[Po4a-commits] "po-debconf podebconf-report-po,1.62,1.63"

Denis Barbier barbier-guest at alioth.debian.org
Wed Jan 26 21:54:21 UTC 2011


Update of /cvsroot/po4a/po-debconf
In directory alioth:/tmp/cvs-serv24976

Modified Files:
	podebconf-report-po 
Log Message:
podebconf-report-po: Fix imports of libmail-sendmail-perl and
libmail-box-perl to be consistent with --mutt/--postpone options.
Thanks Guillem Jover.  Closes: #607419


Index: podebconf-report-po
===================================================================
RCS file: /cvsroot/po4a/po-debconf/podebconf-report-po,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- podebconf-report-po	5 Apr 2009 17:30:06 -0000	1.62
+++ podebconf-report-po	26 Jan 2011 21:54:19 -0000	1.63
@@ -157,9 +157,19 @@
 &Help_PrintVersion if $VERSION_ARG;
 &Help_PrintHelp    if $HELP_ARG;
 
-eval q{use Mail::Sendmail;};
-die "$PROGRAM: This program requires the libmail-sendmail-perl package.\n".
-    "$PROGRAM: Aborting!\n" if $@;
+if ((defined $MBOX and length $MBOX) || $MUTT) {
+	eval q{use Mail::Box::Manager;};
+	if ($@) {
+		die "The --postpone and --mutt options require the perl ".
+		    "Mail::Box::Manager package.  No mail written or sent.";
+	}
+} else {
+	eval q{use Mail::Sendmail;};
+	if ($@) {
+		die "$PROGRAM: This program requires the perl Mail::Sendmail package.\n".
+    		"$PROGRAM: Aborting!\n" if $@;
+	}
+}
 
 # Check invalid set of options
 if ($LANGUAGETEAM_ARG && defined $CALL && not $CALL_WITH_TRANSLATORS) {
@@ -1140,29 +1150,21 @@
 
 sub Postpone {
 	my $mail = shift;
-	if (eval { require Mail::Box::Manager }) {
-		import Mail::Box::Manager;
-		my $mgr = new Mail::Box::Manager;
+	my $mgr = new Mail::Box::Manager;
 
-		my $folder = $mgr->open(folder => $MBOX,
-		                        access => 'a',
-		                        create => 1);
-		my $msg = Mail::Message->build
-			( From => ${$mail}{'From'}
-			, To => ${$mail}{'To'}
-			, Subject => ${$mail}{'Subject'}
-			, 'X-Mail-Originator' => ${$mail}{'X-Mail-Originator'}
-			, 'Content-Type' => ${$mail}{'content-type'}
-			, data => ${$mail}{body}
-			);
-		$mgr->appendMessage($folder, $msg);
-		$folder->write();
-		$mgr->close();
-	} else {
-		die "The --postpone and --mutt options require the ".
-		    "perl Mail::Box package. Please install the Debian ".
-		    "libmail-box-perl package if you want to use these ".
-		    "options. No mail written or sent.";
-	}
+	my $folder = $mgr->open(folder => $MBOX,
+	                        access => 'a',
+	                        create => 1);
+	my $msg = Mail::Message->build
+		( From => ${$mail}{'From'}
+		, To => ${$mail}{'To'}
+		, Subject => ${$mail}{'Subject'}
+		, 'X-Mail-Originator' => ${$mail}{'X-Mail-Originator'}
+		, 'Content-Type' => ${$mail}{'content-type'}
+		, data => ${$mail}{body}
+		);
+	$mgr->appendMessage($folder, $msg);
+	$folder->write();
+	$mgr->close();
 }
 




More information about the Po4a-commits mailing list